diff options
author | Prasad Vyawahare <pvyawaha@amazon.com> | 2021-04-26 12:43:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 12:43:57 -0700 |
commit | 04f0f68f61c7bb029b602931f2fc4a42ebfc47e7 (patch) | |
tree | 9d199559a44d13c16444c3283f8f7ea6368027d9 | |
parent | 43bd42db271e0f915b475c362197284268a0149e (diff) | |
download | freertos-git-04f0f68f61c7bb029b602931f2fc4a42ebfc47e7.tar.gz |
OTA Demos (#573)
This change adds the OTA demos and required dependencies and helper components .
* Add demos , configs and project files
* Add subscription manager
* Add HTTP utils
* Submodules the OTA LTS 3.0 Library.
* Add OTA pal
36 files changed, 13741 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index 6d2043a22..77ca17f8f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent"] path = FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent url = https://github.com/FreeRTOS/coreMQTT-Agent.git +[submodule "FreeRTOS-Plus/Source/AWS/ota"] + path = FreeRTOS-Plus/Source/AWS/ota + url = https://github.com/aws/ota-for-aws-iot-embedded-sdk.git diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.c new file mode 100644 index 000000000..17e3cf11f --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.c @@ -0,0 +1,248 @@ +/* + * FreeRTOS V202012.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 + * + */ + +/* Standard includes. */ +#include <assert.h> + +#include "http_demo_utils.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* Parser utilities. */ +#include "http_parser.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define RETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed + * operation with server. + */ +#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation + * retry attempts. + */ +#define RETRY_BACKOFF_BASE_MS ( 500U ) + +/*-----------------------------------------------------------*/ + +/** + * @brief Each compilation unit that consumes the NetworkContext must define it. + * It should contain a single pointer to the type of your desired transport. + * This utility is used by both TLS and plaintext HTTP demos, so define this pointer as void *. + * + * @note Transport stacks are defined in FreeRTOS-Plus/Source/Application-Protocols/network_transport. + */ +struct NetworkContext +{ + void * pParams; +}; + +/*-----------------------------------------------------------*/ + +extern UBaseType_t uxRand(); + +/*-----------------------------------------------------------*/ +BaseType_t connectToServerWithBackoffRetries( TransportConnect_t connectFunction, + NetworkContext_t * pxNetworkContext ) +{ + BaseType_t xReturn = pdFAIL; + /* Status returned by the retry utilities. */ + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + /* Struct containing the next backoff time. */ + BackoffAlgorithmContext_t xReconnectParams; + uint16_t usNextBackoff = 0U; + + assert( connectFunction != NULL ); + + /* Initialize reconnect attempts and interval */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + RETRY_BACKOFF_BASE_MS, + RETRY_MAX_BACKOFF_DELAY_MS, + RETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to the HTTP server. If connection fails, retry after a + * timeout. The timeout value will exponentially increase until either the + * maximum timeout value is reached or the set number of attempts are + * exhausted.*/ + do + { + xReturn = connectFunction( pxNetworkContext ); + + if( xReturn != pdPASS ) + { + /* Generate a random number and calculate backoff value (in milliseconds) for + * the next connection retry. + * Note: It is recommended to seed the random number generator with a device-specific + * entropy source so that possibility of multiple devices retrying failed network operations + * at similar intervals can be avoided. */ + xBackoffAlgStatus = BackoffAlgorithm_GetNextBackoff( &xReconnectParams, uxRand(), &usNextBackoff ); + + if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the HTTP server failed. " + "Retrying connection with backoff and jitter." ) ); + LogInfo( ( "Retry attempt %lu out of maximum retry attempts %lu.", + xReconnectParams.attemptsDone, + RETRY_MAX_ATTEMPTS ) ); + } + } + } while( ( xReturn == pdFAIL ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + if( xReturn == pdFAIL ) + { + LogError( ( "Connection to the server failed, all attempts exhausted." ) ); + } + + return xReturn; +} + +/*-----------------------------------------------------------*/ + +HTTPStatus_t getUrlPath( const char * pcUrl, + size_t xUrlLen, + const char ** pcPath, + size_t * pxPathLen ) +{ + /* http-parser status. Initialized to 1 to signify failure. */ + int lParserStatus = 1; + struct http_parser_url xUrlParser; + HTTPStatus_t xHTTPStatus = HTTPSuccess; + + /* Sets all members in xUrlParser to 0. */ + http_parser_url_init( &xUrlParser ); + + if( ( pcUrl == NULL ) || ( pcPath == NULL ) || ( pxPathLen == NULL ) ) + { + LogError( ( "NULL parameter passed to getUrlPath()." ) ); + xHTTPStatus = HTTPInvalidParameter; + } + + if( xHTTPStatus == HTTPSuccess ) + { + lParserStatus = http_parser_parse_url( pcUrl, xUrlLen, 0, &xUrlParser ); + + if( lParserStatus != 0 ) + { + LogError( ( "Error parsing the input URL %.*s. Error code: %d.", + ( int32_t ) xUrlLen, + pcUrl, + lParserStatus ) ); + xHTTPStatus = HTTPParserInternalError; + } + } + + if( xHTTPStatus == HTTPSuccess ) + { + *pxPathLen = ( size_t ) ( xUrlParser.field_data[ UF_PATH ].len ); + + if( *pxPathLen == 0 ) + { + xHTTPStatus = HTTPNoResponse; + *pcPath = NULL; + } + else + { + *pcPath = &pcUrl[ xUrlParser.field_data[ UF_PATH ].off ]; + } + } + + if( xHTTPStatus != HTTPSuccess ) + { + LogError( ( "Error parsing the path from URL %s. Error code: %d", + pcUrl, + xHTTPStatus ) ); + } + + return xHTTPStatus; +} + +/*-----------------------------------------------------------*/ + +HTTPStatus_t getUrlAddress( const char * pcUrl, + size_t xUrlLen, + const char ** pcAddress, + size_t * pxAddressLen ) +{ + /* http-parser status. Initialized to 1 to signify failure. */ + int lParserStatus = 1; + struct http_parser_url xUrlParser; + HTTPStatus_t xHTTPStatus = HTTPSuccess; + + /* Sets all members in xUrlParser to 0. */ + http_parser_url_init( &xUrlParser ); + + if( ( pcUrl == NULL ) || ( pcAddress == NULL ) || ( pxAddressLen == NULL ) ) + { + LogError( ( "NULL parameter passed to getUrlAddress()." ) ); + xHTTPStatus = HTTPInvalidParameter; + } + + if( xHTTPStatus == HTTPSuccess ) + { + lParserStatus = http_parser_parse_url( pcUrl, xUrlLen, 0, &xUrlParser ); + + if( lParserStatus != 0 ) + { + LogError( ( "Error parsing the input URL %.*s. Error code: %d.", + ( int32_t ) xUrlLen, + pcUrl, + lParserStatus ) ); + xHTTPStatus = HTTPParserInternalError; + } + } + + if( xHTTPStatus == HTTPSuccess ) + { + *pxAddressLen = ( size_t ) ( xUrlParser.field_data[ UF_HOST ].len ); + + if( *pxAddressLen == 0 ) + { + xHTTPStatus = HTTPNoResponse; + *pcAddress = NULL; + } + else + { + *pcAddress = &pcUrl[ xUrlParser.field_data[ UF_HOST ].off ]; + } + } + + if( xHTTPStatus != HTTPSuccess ) + { + LogError( ( "Error parsing the address from URL %s. Error code %d", + pcUrl, + xHTTPStatus ) ); + } + + return xHTTPStatus; +} diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.h new file mode 100644 index 000000000..9deaddb90 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/HTTP_Utils/http_demo_utils.h @@ -0,0 +1,127 @@ +/* + * FreeRTOS V202012.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 HTTP_DEMO_UTILS_H +#define HTTP_DEMO_UTILS_H + +/* Standard includes. */ +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* HTTP API header. */ +#include "core_http_client.h" + +/** + * @brief Function pointer for establishing connection to a server. + * + * @param[out] pxNetworkContext Implementation-defined network context. + * + * @return pdFAIL on failure; pdPASS on successful connection. + */ +typedef BaseType_t ( * TransportConnect_t )( NetworkContext_t * pxNetworkContext ); + +/** + * @brief Connect to a server with reconnection retries. + * + * If connection fails, retry is attempted after a timeout. The timeout value + * will exponentially increase until either the maximum timeout value is reached + * or the set number of attempts are exhausted. + * + * @param[in] connectFunction Function pointer for establishing connection to a + * server. + * @param[out] pxNetworkContext Implementation-defined network context. + * + * @return pdFAIL on failure; pdPASS on successful connection. + */ +BaseType_t connectToServerWithBackoffRetries( TransportConnect_t connectFunction, + NetworkContext_t * pxNetworkContext ); + +/** + * @brief Retrieve the path from the input URL. + * + * This function retrieves the location and length of the path from within the + * input the URL. The query is not included in the length returned. + * + * The URL MUST start with "http://" or "https://" to find the path. + * + * For example, if pcUrl is: + * "https://www.somewebsite.com/path/to/item.txt?optionalquery=stuff" + * + * Then pcPath and pxPathLen will be the following: + * *pcPath = "/path/to/item.txt?optionalquery=stuff" + * *pxPathLen = 17 + * + * @param[in] pcUrl URL string to parse. + * @param[in] xUrlLen The length of the URL string input. + * @param[out] pcPath pointer within input url that the path starts at. + * @param[out] pxPathLen Length of the path. + * + * @return The status of the parsing attempt: + * HTTPSuccess if the path was successfully parsed, + * HTTPParserInternalError if there was an error parsing the URL, + * or HTTPNoResponse if the path was not found. + */ +HTTPStatus_t getUrlPath( const char * pcUrl, + size_t xUrlLen, + const char ** pcPath, + size_t * pxPathLen ); + +/** + * @brief Retrieve the Address from the input URL. + * + * This function retrieves the location and length of the address from within + * the input URL. The path and query are not included in the length returned. + * + * The URL MUST start with "http://" or "https://" to find the address. + * + * For example, if pcUrl is: + * "https://www.somewebsite.com/path/to/item.txt?optionalquery=stuff" + * + * Then pcAddress and pxAddressLen will be the following: + * *pcAddress = "www.somewebsite.com/path/to/item.txt?optionalquery=stuff" + * *pxAddressLen = 19 + * + * @param[in] pcUrl URL string to parse. + * @param[in] xUrlLen The length of the URL string input. + * @param[out] pcAddress pointer within input url that the address starts at. + * @param[out] pxAddressLen Length of the address. + * + * @return The status of the parsing attempt: + * HTTPSuccess if the path was successfully parsed, + * HTTPParserInternalError if there was an error parsing the URL, + * or HTTPNoResponse if the path was not found. + */ +HTTPStatus_t getUrlAddress( const char * pcUrl, + size_t xUrlLen, + const char ** pcAddress, + size_t * pxAddressLen ); + +#endif /* ifndef HTTP_DEMO_UTILS_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/aws_ota_codesigner_certificate.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/aws_ota_codesigner_certificate.h new file mode 100644 index 000000000..3b21b551d --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/aws_ota_codesigner_certificate.h @@ -0,0 +1,49 @@ +/* + * FreeRTOS V202012.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 aws_ota_codesigner_certificate.h + * @brief Code signer certifciate as char array. + * + * Define this char array containing the PEM encode signing certificate. + * Note - It is highly recommended to use this for demo pupose and store + * certificates in secure location in production devices. + */ + +#ifndef __CODESIGNER_CERTIFICATE__H__ +#define __CODESIGNER_CERTIFICATE__H__ + +/* + * PEM-encoded code signer certificate + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n" + * "...base64 data...\n" + * "-----END CERTIFICATE-----\n"; + */ +static const char signingcredentialSIGNING_CERTIFICATE_PEM[] = "...Insert here..."; + +#endif diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification.h new file mode 100644 index 000000000..b8155665c --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification.h @@ -0,0 +1,45 @@ +/* + * FreeRTOS V202012.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 code_signature_verification.h + * @brief Interface for code siganture verfication funtions. + * + */ + +#ifndef CODE_SIGNATURE_VERIFICATION_H +#define CODE_SIGNATURE_VERIFICATION_H + +#include "FreeRTOS.h" + + /** + * @brief Validate the integrity of the new image to be activated. + * @param[in] pFileContext pointer to File context + * @return OtaPalMainStatus_t , OtaPalSuccess if the signature of the image is valid. + */ +OtaPalMainStatus_t xValidateImageSignature( OtaFileContext_t* const pFileContext ); + +#endif diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification_mbedtls.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification_mbedtls.c new file mode 100644 index 000000000..326e9e6f5 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/Code_Signature_Verification/code_signature_verification_mbedtls.c @@ -0,0 +1,465 @@ +/* + * FreeRTOS V202012.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 code_signature_verfication_mbedtls.c + * @brief Code signature verification using mbedtls crypto. + * + * The file demonstrates implements the code signature verfication functionality on + * the specified file using mbedtls for SHA256 ECDSA. + */ + + /* C runtime includes. */ +#include <string.h> + + /* FreeRTOS includes. */ +#include "FreeRTOS.h" + +/* mbedTLS includes. */ +#if !defined( MBEDTLS_CONFIG_FILE ) +#include "mbedtls/config.h" +#else +#include MBEDTLS_CONFIG_FILE +#endif +#include "mbedtls/platform.h" +#include "mbedtls/sha256.h" +#include "mbedtls/sha1.h" +#include "mbedtls/pk.h" +#include "mbedtls/x509_crt.h" + +/* OTA includes. */ +#include "ota.h" + +/* Signature verification includes. */ +#include "code_signature_verification.h" +#include "aws_ota_codesigner_certificate.h" + +/** + * @brief SHA256 buffer size for storing cryptographic hash computation results. + */ +#define SHA256_DIGEST_BYTES 32 + + /* Size of buffer used in file operations on this platform (Windows). */ +#define OTA_PAL_WIN_BUF_SIZE ( ( size_t ) 4096UL ) + +/** + * @brief Library-independent cryptographic algorithm identifiers. + */ +#define HASH_ALGORITHM_SHA1 1 +#define HASH_ALGORITHM_SHA256 2 +#define ASYMMETRIC_ALGORITHM_RSA 1 +#define ASYMMETRIC_ALGORITHM_ECDSA 2 + + /** + * @brief Internal signature verification context structure. + */ +typedef struct SignatureVerificationState +{ + BaseType_t xAsymmetricAlgorithm; + BaseType_t xHashAlgorithm; + mbedtls_sha256_context xSHA256Context; +} SignatureVerificationState_t, * SignatureVerificationStatePtr_t; + +/** + * @brief Initializes digital signature verification. + * + * @param[out] ppvContext Opaque context structure. + * @param[in] xAsymmetricAlgorithm Cryptographic public key cryptosystem. + * @param[in] xHashAlgorithm Cryptographic hash algorithm that was used for signing. + * + * @return pdTRUE if initialization succeeds, or pdFALSE otherwise. + */ +static BaseType_t prvSignatureVerificationStart(void** ppvContext, + BaseType_t xAsymmetricAlgorithm, + BaseType_t xHashAlgorithm); + +/** + * @brief Updates a cryptographic hash computation with the specified byte array. + * + * @param[in] pvContext Opaque context structure. + * @param[in] pucData Byte array that was signed. + * @param[in] xDataLength Length in bytes of data that was signed. + */ +static void prvSignatureVerificationUpdate(void* pvContext, + const uint8_t* pucData, + size_t xDataLength); + +/** + * @brief Verifies a digital signature computation using the public key from the + * specified certificate. + * + * @param[in] pvContext Opaque context structure. + * @param[in] pucSignerCertificate Base64 and DER encoded X.509 certificate of the + * signer. + * @param[in] xSignerCertificateLength Length in bytes of the certificate. + * @param[in] pucSignature Digital signature result to verify. + * @param[in] xSignatureLength in bytes of digital signature result. + * + * @return pdTRUE if the signature is correct or pdFALSE if the signature is invalid. + */ +static BaseType_t prvSignatureVerificationFinal(void* pvContext, + char* pcSignerCertificate, + size_t xSignerCertificateLength, + uint8_t* pucSignature, + size_t xSignatureLength); + +/* Read the specified signer certificate from the filesystem into a local buffer. The allocated + * memory becomes the property of the caller who is responsible for freeing it. + */ + +static uint8_t* otaPal_ReadAndAssumeCertificate(const uint8_t* const pucCertName, + uint32_t* const ulSignerCertSize) +{ + FILE* pFile; + uint8_t* pucSignerCert = NULL; + uint8_t* pucCertData = NULL; + int32_t lSize = 0; /* For MISRA mandatory. */ + int32_t lWindowsError; + + pFile = fopen((const char*)pucCertName, "rb"); /*lint !e586 + * C standard library call is being used for portability. */ + + if (pFile != NULL) + { + lWindowsError = fseek(pFile, 0, SEEK_END); /*lint !e586 + * C standard library call is being used for portability. */ + + if (lWindowsError == 0) /* fseek returns a non-zero value on error. */ + { + lSize = (int32_t)ftell(pFile); /*lint !e586 Allow call in this context. */ + + if (lSize != -1L) /* ftell returns -1 on error. */ + { + lWindowsError = fseek(pFile, 0, SEEK_SET); /*lint !e586 + * C standard library call is being used for portability. */ + } + else /* ftell returned an error, pucSignerCert remains NULL. */ + { + lWindowsError = -1L; + } + } /* else fseek returned an error, pucSignerCert remains NULL. */ + + if (lWindowsError == 0) + { + /* Allocate memory for the signer certificate plus a terminating zero so we can load and return it to the caller. */ + pucSignerCert = pvPortMalloc(lSize + 1); /*lint !e732 !e9034 !e9079 Allow conversion. */ + } + + if (pucSignerCert != NULL) + { + if (fread(pucSignerCert, 1, lSize, pFile) == (size_t)lSize) /*lint !e586 !e732 !e9034 + * C standard library call is being used for portability. */ + { + /* The crypto code requires the terminating zero to be part of the length so add 1 to the size. */ + *ulSignerCertSize = lSize + 1; + pucSignerCert[lSize] = 0; + } + else + { /* There was a problem reading the certificate file so free the memory and abort. */ + vPortFree(pucSignerCert); + pucSignerCert = NULL; + } + } + else + { + LogError(("Failed to allocate memory for signer cert contents.\r\n")); + /* Nothing special to do. */ + } + + lWindowsError = fclose(pFile); /*lint !e586 + * C standard library call is being used for portability. */ + + if (lWindowsError != 0) + { + LogError(("File pointer operation failed.\r\n")); + pucSignerCert = NULL; + } + } + else + { + LogError(("No such certificate file: %s. Using aws_ota_codesigner_certificate.h.\r\n", + (const char*)pucCertName)); + + /* Allocate memory for the signer certificate plus a terminating zero so we can copy it and return to the caller. */ + lSize = sizeof(signingcredentialSIGNING_CERTIFICATE_PEM); + pucSignerCert = pvPortMalloc(lSize); /*lint !e9029 !e9079 !e838 malloc proto requires void*. */ + pucCertData = (uint8_t*)signingcredentialSIGNING_CERTIFICATE_PEM; /*lint !e9005 we don't modify the cert but it could be set by PKCS11 so it's not const. */ + + if (pucSignerCert != NULL) + { + memcpy(pucSignerCert, pucCertData, lSize); + *ulSignerCertSize = lSize; + } + else + { + LogError(("No memory for certificate of size %d!\r\n", lSize)); + } + } + + return pucSignerCert; /*lint !e480 !e481 fopen and fclose are being used by-design. */ +} + +/** + * @brief Verifies a cryptographic signature based on the signer + * certificate, hash algorithm, and the data that was signed. + */ +static BaseType_t prvVerifySignature(char* pcSignerCertificate, + size_t xSignerCertificateLength, + BaseType_t xHashAlgorithm, + uint8_t* pucHash, + size_t xHashLength, + uint8_t* pucSignature, + size_t xSignatureLength) +{ + BaseType_t xResult = pdTRUE; + mbedtls_x509_crt xCertCtx; + mbedtls_md_type_t xMbedHashAlg = MBEDTLS_MD_SHA256; + + (void)xHashAlgorithm; + + memset(&xCertCtx, 0, sizeof(mbedtls_x509_crt)); + + /* + * Decode and create a certificate context + */ + mbedtls_x509_crt_init(&xCertCtx); + + if (0 != mbedtls_x509_crt_parse( + &xCertCtx, (const unsigned char*)pcSignerCertificate, xSignerCertificateLength)) + { + xResult = pdFALSE; + } + + /* + * Verify the signature using the public key from the decoded certificate + */ + if (pdTRUE == xResult) + { + if (0 != mbedtls_pk_verify( + &xCertCtx.pk, + xMbedHashAlg, + pucHash, + xHashLength, + pucSignature, + xSignatureLength)) + { + xResult = pdFALSE; + } + } + + /* + * Clean-up + */ + mbedtls_x509_crt_free(&xCertCtx); + + return xResult; +} + + + +/** + * @brief Creates signature verification context. + */ +static BaseType_t prvSignatureVerificationStart(void** ppvContext, + BaseType_t xAsymmetricAlgorithm, + BaseType_t xHashAlgorithm) +{ + BaseType_t xResult = pdTRUE; + SignatureVerificationState_t* pxCtx = NULL; + + /* + * Allocate the context + */ + if (NULL == (pxCtx = (SignatureVerificationStatePtr_t)pvPortMalloc( + sizeof(*pxCtx)))) /*lint !e9087 Allow casting void* to other types. */ + { + xResult = pdFALSE; + } + + if (pdTRUE == xResult) + { + *ppvContext = pxCtx; + + /* + * Store the algorithm identifiers + */ + pxCtx->xAsymmetricAlgorithm = xAsymmetricAlgorithm; + pxCtx->xHashAlgorithm = xHashAlgorithm; + + /* + * Initialize the requested hash type + */ + mbedtls_sha256_init(&pxCtx->xSHA256Context); + (void)mbedtls_sha256_starts_ret(&pxCtx->xSHA256Context, 0); + } + + return xResult; +} + +/** + * @brief Adds bytes to an in-progress hash for subsequent signature verification. + */ +static void prvSignatureVerificationUpdate(void* pvContext, + const uint8_t* pucData, + size_t xDataLength) +{ + SignatureVerificationState_t* pxCtx = (SignatureVerificationStatePtr_t)pvContext; /*lint !e9087 Allow casting void* to other types. */ + + /* + * Add the data to the hash of the requested type + */ + (void)mbedtls_sha256_update_ret(&pxCtx->xSHA256Context, pucData, xDataLength); + +} + +/** + * @brief Performs signature verification on a cryptographic hash. + */ +static BaseType_t prvSignatureVerificationFinal(void* pvContext, + char* pcSignerCertificate, + size_t xSignerCertificateLength, + uint8_t* pucSignature, + size_t xSignatureLength) +{ + BaseType_t xResult = pdFALSE; + + if (pvContext != NULL) + { + SignatureVerificationStatePtr_t pxCtx = (SignatureVerificationStatePtr_t)pvContext; /*lint !e9087 Allow casting void* to other types. */ + uint8_t ucSHA256[SHA256_DIGEST_BYTES]; /* Reserve enough space for the larger for SHA256 results. */ + uint8_t* pucHash = NULL; + size_t xHashLength = 0; + + if ((pcSignerCertificate != NULL) && + (pucSignature != NULL) && + (xSignerCertificateLength > 0UL) && + (xSignatureLength > 0UL)) + { + /* + * Finish the hash. + */ + (void)mbedtls_sha256_finish_ret(&pxCtx->xSHA256Context, ucSHA256); + pucHash = ucSHA256; + xHashLength = SHA256_DIGEST_BYTES; + + /* + * Verify the signature. + */ + xResult = prvVerifySignature(pcSignerCertificate, + xSignerCertificateLength, + pxCtx->xHashAlgorithm, + pucHash, + xHashLength, + pucSignature, + xSignatureLength); + } + else + { + /* Allow function to be called with only the context pointer for cleanup after a failure. */ + } + + /* + * Clean-up + */ + vPortFree(pxCtx); + } + + return xResult; +} + +/* Verify the signature of the specified file. */ +OtaPalMainStatus_t xValidateImageSignature(OtaFileContext_t* const C) +{ + OtaPalMainStatus_t eResult = OtaPalSuccess; + uint32_t ulBytesRead; + uint32_t ulSignerCertSize; + uint8_t* pucBuf, * pucSignerCert; + void* pvSigVerifyContext; + + /* Verify an ECDSA-SHA256 signature. */ + if (pdFALSE == prvSignatureVerificationStart(&pvSigVerifyContext, ASYMMETRIC_ALGORITHM_ECDSA, HASH_ALGORITHM_SHA256)) + { + eResult = OtaPalSignatureCheckFailed; + } + else + { + LogInfo(("Started %s signature verification, file: %s\r\n", + OTA_JsonFileSignatureKey, (const char*)C->pCertFilepath)); + pucSignerCert = otaPal_ReadAndAssumeCertificate((const uint8_t* const)C->pCertFilepath, &ulSignerCertSize); + + if (pucSignerCert != NULL) + { + pucBuf = pvPortMalloc( OTA_PAL_WIN_BUF_SIZE ); /*lint !e9079 Allow conversion. */ + + if (pucBuf != NULL) + { + /* Rewind the received file to the beginning. */ + if (fseek(C->pFile, 0L, SEEK_SET) == 0) /*lint !e586 + * C standard library call is being used for portability. */ + { + do + { + ulBytesRead = fread(pucBuf, 1, OTA_PAL_WIN_BUF_SIZE, C->pFile); /*lint !e586 + * C standard library call is being used for portability. */ + /* Include the file chunk in the signature validation. Zero size is OK. */ + prvSignatureVerificationUpdate(pvSigVerifyContext, pucBuf, ulBytesRead); + } while (ulBytesRead > 0UL); + + if (pdFALSE == prvSignatureVerificationFinal(pvSigVerifyContext, + (char*)pucSignerCert, + (size_t)ulSignerCertSize, + C->pSignature->data, + C->pSignature->size)) /*lint !e732 !e9034 Allow comparison in this context. */ + { + eResult = OtaPalSignatureCheckFailed; + } + pvSigVerifyContext = NULL; /* The context has been freed by prvSignatureVerificationFinal(). */ + } + else + { + /* Nothing special to do. */ + } + + /* Free the temporary file page buffer. */ + vPortFree(pucBuf); + } + else + { + LogError(("Failed to allocate buffer memory.\r\n")); + eResult = OtaPalOutOfMemory; + } + + /* Free the signer certificate that we now own after prvReadAndAssumeCertificate(). */ + vPortFree(pucSignerCert); + } + else + { + eResult = OtaPalBadSignerCert; + } + } + + return eResult; +}
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.c new file mode 100644 index 000000000..9cc6470f8 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.c @@ -0,0 +1,419 @@ +/* + * FreeRTOS V202012.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 ota_pal.c + * @brief OTA PAL implementation for Windows platform. + */ + +/* Standard includes. */ +#include <stdio.h> +#include <stdlib.h> + +/* Kernel includes. */ +#include "FreeRTOS.h" + +/* Library config includes. */ +#include "ota_config.h" + +/* OTA Library include. */ +#include "ota.h" +#include "ota_pal.h" + +#include "code_signature_verification.h" + +/* Specify the OTA signature algorithm we support on this platform. */ +const char OTA_JsonFileSignatureKey[ OTA_FILE_SIG_KEY_STR_MAX_LENGTH ] = "sig-sha256-ecdsa"; + +static OtaPalMainStatus_t otaPal_CheckFileSignature( OtaFileContext_t * const C ); + +/*-----------------------------------------------------------*/ + +static inline BaseType_t prvContextValidate( OtaFileContext_t* pFileContext ) +{ + return( ( pFileContext != NULL ) && + ( pFileContext->pFile != NULL ) ); /*lint !e9034 Comparison is correct for file pointer type. */ +} + +/* Used to set the high bit of Windows error codes for a negative return value. */ +#define OTA_PAL_INT16_NEGATIVE_MASK ( 1 << 15 ) + +/* Attempt to create a new receive file for the file chunks as they come in. */ + +OtaPalStatus_t otaPal_CreateFileForRx( OtaFileContext_t* const C ) +{ + OtaPalMainStatus_t mainErr = OtaPalUninitialized; + OtaPalSubStatus_t subErr = 0; + + if( C != NULL ) + { + if ( C->pFilePath != NULL ) + { + C->pFile = fopen( ( const char * )C->pFilePath, "w+b" ); /*lint !e586 + * C standard library call is being used for portability. */ + + if ( C->pFile != NULL ) + { + mainErr = OtaPalSuccess; + LogInfo( ( "Receive file created.\r\n" ) ); + } + else + { + mainErr = OtaPalRxFileCreateFailed; + subErr = errno; + LogError( ( "ERROR - Failed to start operation: already active!\r\n" ) ); + } + } + else + { + mainErr = OtaPalRxFileCreateFailed; + LogError( ( "ERROR - Invalid filepath in filecontext.\r\n" ) ); + } + } + else + { + mainErr = OtaPalRxFileCreateFailed; + LogError( ( "ERROR - Invalid file context provided.\r\n" ) ); + } + + return OTA_PAL_COMBINE_ERR(mainErr,subErr); +} + + +/* Abort receiving the specified OTA update by closing the file. */ + +OtaPalStatus_t otaPal_Abort( OtaFileContext_t * const C ) +{ + /* Set default return status to uninitialized. */ + OtaPalMainStatus_t mainErr = OtaPalUninitialized; + OtaPalSubStatus_t subErr = 0; + int32_t lFileCloseResult; + + if( NULL != C ) + { + /* Close the OTA update file if it's open. */ + if( NULL != C->pFile ) + { + lFileCloseResult = fclose( C->pFile ); /*lint !e482 !e586 + * Context file handle state is managed by this API. */ + C->pFile = NULL; + + if( 0 == lFileCloseResult ) + { + LogInfo( ( "File closed.\r\n" ) ); + mainErr = OtaPalSuccess; + } + else /* Failed to close file. */ + { + LogError( ( "ERROR - Closing file failed.\r\n" ) ); + mainErr = OtaPalFileAbort; + subErr = errno; + } + } + else + { + /* Nothing to do. No open file associated with this context. */ + mainErr = OtaPalSuccess; + } + } + else /* Context was not valid. */ + { + LogError( ( "ERROR - Invalid context.\r\n" ) ); + mainErr = OtaPalFileAbort; + } + + return OTA_PAL_COMBINE_ERR(mainErr,subErr); +} + +/* Write a block of data to the specified file. */ +int16_t otaPal_WriteBlock( OtaFileContext_t * const C, + uint32_t ulOffset, + uint8_t * const pacData, + uint32_t ulBlockSize ) +{ + int32_t lResult = 0; + + if( prvContextValidate( C ) == pdTRUE ) + { + lResult = fseek( C->pFile, ulOffset, SEEK_SET ); /*lint !e586 !e713 !e9034 + * C standard library call is being used for portability. */ + + if( 0 == lResult ) + { + lResult = fwrite( pacData, 1, ulBlockSize, C->pFile ); /*lint !e586 !e713 !e9034 + * C standard library call is being used for portability. */ + + if( lResult < 0 ) + { + LogError( ( "ERROR - fwrite failed\r\n" ) ); + /* Mask to return a negative value. */ + lResult = OTA_PAL_INT16_NEGATIVE_MASK | errno; /*lint !e40 !e9027 + * Errno is being used in accordance with host API documentation. + * Bitmasking is being used to preserve host API error with library status code. */ + } + } + else + { + LogError( ( "ERROR - fseek failed\r\n" ) ); + /* Mask to return a negative value. */ + lResult = OTA_PAL_INT16_NEGATIVE_MASK | errno; /*lint !e40 !e9027 + * Errno is being used in accordance with host API documentation. + * Bitmasking is being used to preserve host API error with library status code. */ + } + } + else /* Invalid context or file pointer provided. */ + { + LogError( ( "ERROR - Invalid context.\r\n" ) ); + lResult = -1; /*TODO: Need a negative error code from the PAL here. */ + } + + return ( int16_t ) lResult; +} + +/* Close the specified file. This shall authenticate the file if it is marked as secure. */ + +OtaPalStatus_t otaPal_CloseFile( OtaFileContext_t * const C ) +{ + OtaPalMainStatus_t mainErr = OtaPalUninitialized; + OtaPalSubStatus_t subErr = 0; + int32_t lWindowsError = 0; + + if( prvContextValidate( C ) == pdTRUE ) + { + if( C->pSignature != NULL ) + { + /* Verify the file signature, close the file and return the signature verification result. */ + mainErr = otaPal_CheckFileSignature( C ); + } + else + { + LogError( ( "NULL OTA Signature structure.\r\n" ) ); + mainErr = OtaPalSignatureCheckFailed; + } + + /* Close the file. */ + lWindowsError = fclose( C->pFile ); /*lint !e482 !e586 + * C standard library call is being used for portability. */ + C->pFile = NULL; + + if( lWindowsError != 0 ) + { + LogError( ( "Failed to close OTA update file.\r\n" ) ); + mainErr = OtaPalFileClose; + subErr = errno; + } + + if( mainErr == OtaPalSuccess ) + { + LogInfo( ( "%s signature verification passed.\r\n", OTA_JsonFileSignatureKey ) ); + } + else + { + LogError( ( "Failed to pass %s signature verification: %d.\r\n", + OTA_JsonFileSignatureKey, OTA_PAL_COMBINE_ERR(mainErr,subErr) ) ); + + /* If we fail to verify the file signature that means the image is not valid. We need to set the image state to aborted. */ + otaPal_SetPlatformImageState( C, OtaImageStateAborted ); + + } + } + else /* Invalid OTA Context. */ + { + /* FIXME: Invalid error code for a null file context and file handle. */ + LogError( ( "Invalid file context.\r\n" ) ); + mainErr = OtaPalFileClose; + } + + return OTA_PAL_COMBINE_ERR(mainErr,subErr); +} + + +/* Verify the signature of the specified file. */ + +static OtaPalMainStatus_t otaPal_CheckFileSignature( OtaFileContext_t* const C ) +{ + OtaPalMainStatus_t eResult = OtaPalSignatureCheckFailed; + + if ( prvContextValidate( C ) == pdTRUE ) + { + eResult = xValidateImageSignature( C ); + } + else + { + LogError( ( "OTA image signature is invalid.\r\n" ) ); + } + + return eResult; +} + +/*-----------------------------------------------------------*/ + +OtaPalStatus_t otaPal_ResetDevice( OtaFileContext_t* const pFileContext ) +{ + (void)pFileContext; + + /* Return no error. Windows implementation does not reset device. */ + return OTA_PAL_COMBINE_ERR(OtaPalSuccess,0); +} + +/*-----------------------------------------------------------*/ + +OtaPalStatus_t otaPal_ActivateNewImage( OtaFileContext_t* const pFileContext ) +{ + (void)pFileContext; + + /* Return no error. Windows implementation simply does nothing on activate. + * To run the new firmware image, double click the newly downloaded exe */ + return OTA_PAL_COMBINE_ERR(OtaPalSuccess,0); +} + + +/* + * Set the final state of the last transferred (final) OTA file (or bundle). + * On Windows, the state of the OTA image is stored in PlaformImageState.txt. + */ + +OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const pFileContext, OtaImageState_t eState ) +{ + (void)pFileContext; + + OtaPalMainStatus_t mainErr = OtaPalSuccess; + OtaPalSubStatus_t subErr = 0; + FILE * pstPlatformImageState; + + if( eState != OtaImageStateUnknown && eState <= OtaLastImageState ) + { + pstPlatformImageState = fopen( "PlatformImageState.txt", "w+b" ); /*lint !e586 + * C standard library call is being used for portability. */ + + if( pstPlatformImageState != NULL ) + { + /* Write the image state to PlatformImageState.txt. */ + if( 1 != fwrite( &eState, sizeof( OtaImageState_t ), 1, pstPlatformImageState ) ) /*lint !e586 !e9029 + * C standard library call is being used for portability. */ + { + LogError( ( "Unable to write to image state file.\r\n" ) ); + mainErr = OtaPalBadImageState; + subErr = errno; + } + + /* Close PlatformImageState.txt. */ + if( 0 != fclose( pstPlatformImageState ) ) /*lint !e586 Allow call in this context. */ + { + LogError( ( "Unable to close image state file.\r\n" ) ); + mainErr = OtaPalBadImageState; + subErr = errno; + } + } + else + { + LogError( ( "Unable to open image state file.\r\n" ) ); + mainErr = OtaPalBadImageState; + subErr = errno; + } + } /*lint !e481 Allow fopen and fclose calls in this context. */ + else /* Image state invalid. */ + { + LogError( ( "ERROR - Invalid image state provided.\r\n" ) ); + mainErr = OtaPalBadImageState; + } + + return OTA_PAL_COMBINE_ERR(mainErr,subErr); +} + +/* Get the state of the currently running image. + * + * On Windows, this is simulated by looking for and reading the state from + * the PlatformImageState.txt file in the current working directory. + * + * We read this at OTA_Init time so we can tell if the MCU image is in self + * test mode. If it is, we expect a successful connection to the OTA services + * within a reasonable amount of time. If we don't satisfy that requirement, + * we assume there is something wrong with the firmware and reset the device, + * causing it to rollback to the previous code. On Windows, this is not + * fully simulated as there is no easy way to reset the simulated device. + */ +OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const pFileContext ) +{ + (void)pFileContext; + + FILE * pstPlatformImageState; + OtaImageState_t eSavedAgentState = OtaImageStateUnknown; + OtaPalImageState_t ePalState = OtaPalImageStateUnknown; + + pstPlatformImageState = fopen( "PlatformImageState.txt", "r+b" ); /*lint !e586 + * C standard library call is being used for portability. */ + + if( pstPlatformImageState != NULL ) + { + if( 1 != fread( &eSavedAgentState, sizeof(OtaImageState_t), 1, pstPlatformImageState ) ) /*lint !e586 !e9029 + * C standard library call is being used for portability. */ + { + /* If an error occured reading the file, mark the state as aborted. */ + LogError( ( "Unable to read image state file.\r\n" ) ); + ePalState = ( OtaPalImageStateInvalid | (errno & OTA_PAL_ERR_MASK) ); + } + else + { + switch (eSavedAgentState) + { + case OtaImageStateTesting: + ePalState = OtaPalImageStatePendingCommit; + break; + case OtaImageStateAccepted: + ePalState = OtaPalImageStateValid; + break; + case OtaImageStateRejected: + case OtaImageStateAborted: + default: + ePalState = OtaPalImageStateInvalid; + break; + } + } + + + if( 0 != fclose( pstPlatformImageState ) ) /*lint !e586 + * C standard library call is being used for portability. */ + { + LogError( ( "Unable to close image state file.\r\n" ) ); + ePalState = (OtaPalImageStateInvalid | ( errno & OTA_PAL_ERR_MASK ) ); + } + } + else + { + /* If no image state file exists, assume a factory image. */ + ePalState = OtaPalImageStateValid; /*lint !e64 Allow assignment. */ + } + + return ePalState; /*lint !e64 !e480 !e481 I/O calls and return type are used per design. */ +} + +/*-----------------------------------------------------------*/ + +/* Provide access to private members for testing. */ +#ifdef FREERTOS_ENABLE_UNIT_TESTS +#include "aws_ota_pal_test_access_define.h" +#endif diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.h new file mode 100644 index 000000000..cf52459bd --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/Ota_PAL/Win32/ota_pal.h @@ -0,0 +1,207 @@ +/* + * FreeRTOS V202012.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 ota_pal.h + * @brief Function declarations for ota_ptal.c. + */ + +#ifndef _OTA_PAL_H_ +#define _OTA_PAL_H_ + +#include "ota.h" + +//static const char signingcredentialSIGNING_CERTIFICATE_PEM[] = "Paste code signing certificate here."; + +/** + * @brief Abort an OTA transfer. + * + * Aborts access to an existing open file represented by the OTA file context C. This is only valid + * for jobs that started successfully. + * + * @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this + * function is called. + * This function may be called before the file is opened, so the file pointer C->fileHandle may be NULL + * when this function is called. + * + * @param[in] C OTA file context information. + * + * @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent + * error codes information in ota.h. + * + * The file pointer will be set to NULL after this function returns. + * OTA_ERR_NONE is returned when aborting access to the open file was successful. + * OTA_ERR_FILE_ABORT is returned when aborting access to the open file context was unsuccessful. + */ +OtaPalStatus_t otaPal_Abort( OtaFileContext_t * const C ); + +/** + * @brief Create a new receive file for the data chunks as they come in. + * + * @note Opens the file indicated in the OTA file context in the MCU file system. + * + * @note The previous image may be present in the designated image download partition or file, so the partition or file + * must be completely erased or overwritten in this routine. + * + * @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this + * function is called. + * The device file path is a required field in the OTA job document, so C->pFilePath is + * checked for NULL by the OTA agent before this function is called. + * + * @param[in] C OTA file context information. + * + * @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent + * error codes information in ota.h. + * + * OTA_ERR_NONE is returned when file creation is successful. + * OTA_ERR_RX_FILE_TOO_LARGE is returned if the file to be created exceeds the device's non-volatile memory size constraints. + * OTA_ERR_BOOT_INFO_CREATE_FAILED is returned if the bootloader information file creation fails. + * OTA_ERR_RX_FILE_CREATE_FAILED is returned for other errors creating the file in the device's non-volatile memory. + */ +OtaPalStatus_t otaPal_CreateFileForRx( OtaFileContext_t * const C ); + +/* @brief Authenticate and close the underlying receive file in the specified OTA context. + * + * @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this + * function is called. This function is called only at the end of block ingestion. + * prvPAL_CreateFileForRx() must succeed before this function is reached, so + * C->fileHandle(or C->pFile) is never NULL. + * The certificate path on the device is a required job document field in the OTA Agent, + * so C->pCertFilepath is never NULL. + * The file signature key is required job document field in the OTA Agent, so C->pSignature will + * never be NULL. + * + * If the signature verification fails, file close should still be attempted. + * + * @param[in] C OTA file context information. + * + * @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent + * error codes information in ota.h. + * + * OTA_ERR_NONE is returned on success. + * OTA_ERR_SIGNATURE_CHECK_FAILED is returned when cryptographic signature verification fails. + * OTA_ERR_BAD_SIGNER_CERT is returned for errors in the certificate itself. + * OTA_ERR_FILE_CLOSE is returned when closing the file fails. + */ +OtaPalStatus_t otaPal_CloseFile( OtaFileContext_t * const C ); + +/** + * @brief Write a block of data to the specified file at the given offset. + * + * @note The input OtaFileContext_t C is checked for NULL by the OTA agent before this + * function is called. + * The file pointer/handle C->pFile, is checked for NULL by the OTA agent before this + * function is called. + * pacData is checked for NULL by the OTA agent before this function is called. + * ulBlockSize is validated for range by the OTA agent before this function is called. + * ulBlockIndex is validated by the OTA agent before this function is called. + * + * @param[in] C OTA file context information. + * @param[in] ulOffset Byte offset to write to from the beginning of the file. + * @param[in] pacData Pointer to the byte array of data to write. + * @param[in] ulBlockSize The number of bytes to write. + * + * @return The number of bytes written on a success, or a negative error code from the platform abstraction layer. + */ +int16_t otaPal_WriteBlock( OtaFileContext_t * const C, + uint32_t ulOffset, + uint8_t * const pcData, + uint32_t ulBlockSize ); + +/** + * @brief Activate the newest MCU image received via OTA. + * + * This function shall do whatever is necessary to activate the newest MCU + * firmware received via OTA. It is typically just a reset of the device. + * + * @note This function SHOULD not return. If it does, the platform does not support + * an automatic reset or an error occurred. + * + * @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent + * error codes information in ota.h. + */ +OtaPalStatus_t otaPal_ActivateNewImage( OtaFileContext_t * const C ); + +/** + * @brief Reset the device. + * + * This function shall reset the MCU and cause a reboot of the system. + * + * @note This function SHOULD not return. If it does, the platform does not support + * an automatic reset or an error occurred. + * + * @return The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent + * error codes information in ota.h. + */ + +OtaPalStatus_t otaPal_ResetDevice( OtaFileContext_t * const C ); + +/** + * @brief Attempt to set the state of the OTA update image. + * + * Do whatever is required by the platform to Accept/Reject the OTA update image (or bundle). + * Refer to the PAL implementation to determine what happens on your platform. + * + * @param[in] eState The desired state of the OTA update image. + * + * @return The OtaErr_t error code combined with the MCU specific error code. See ota.h for + * OTA major error codes and your specific PAL implementation for the sub error code. + * + * Major error codes returned are: + * + * OTA_ERR_NONE on success. + * OTA_ERR_BAD_IMAGE_STATE: if you specify an invalid OtaImageState_t. No sub error code. + * OTA_ERR_ABORT_FAILED: failed to roll back the update image as requested by OtaImageStateAborted. + * OTA_ERR_REJECT_FAILED: failed to roll back the update image as requested by OtaImageStateRejected. + * OTA_ERR_COMMIT_FAILED: failed to make the update image permanent as requested by OtaImageStateAccepted. + */ +OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const C, + OtaImageState_t eState ); + +/** + * @brief Get the state of the OTA update image. + * + * We read this at OTA_Init time and when the latest OTA job reports itself in self + * test. If the update image is in the "pending commit" state, we start a self test + * timer to assure that we can successfully connect to the OTA services and accept + * the OTA update image within a reasonable amount of time (user configurable). If + * we don't satisfy that requirement, we assume there is something wrong with the + * firmware and automatically reset the device, causing it to roll back to the + * previously known working code. + * + * If the update image state is not in "pending commit," the self test timer is + * not started. + * + * @return An OtaPalImageState_t. One of the following: + * OtaPalImageStatePendingCommit (the new firmware image is in the self test phase) + * OtaPalImageStateValid (the new firmware image is already committed) + * OtaPalImageStateInvalid (the new firmware image is invalid or non-existent) + * + * NOTE: OtaPalImageStateUnknown should NEVER be returned and indicates an implementation error. + */ +OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const C ); + +#endif /* ifndef _OTA_PAL_H_ */
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.c new file mode 100644 index 000000000..69259e124 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.c @@ -0,0 +1,170 @@ +/* + * FreeRTOS V202012.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 subscription_manager.c + * @brief Functions for managing MQTT subscriptions. + */ + +/* Standard includes. */ +#include <string.h> + +/* Subscription manager header include. */ +#include "subscription_manager.h" + + +bool addSubscription( SubscriptionElement_t * pxSubscriptionList, + const char * pcTopicFilterString, + uint16_t usTopicFilterLength, + IncomingPubCallback_t pxIncomingPublishCallback, + void * pvIncomingPublishCallbackContext ) +{ + int32_t lIndex = 0; + size_t xAvailableIndex = SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; + bool xReturnStatus = false; + + if( ( pxSubscriptionList == NULL ) || + ( pcTopicFilterString == NULL ) || + ( usTopicFilterLength == 0U ) || + ( pxIncomingPublishCallback == NULL ) ) + { + LogError( ( "Invalid parameter. pxSubscriptionList=%p, pcTopicFilterString=%p," + " usTopicFilterLength=%u, pxIncomingPublishCallback=%p.", + pxSubscriptionList, + pcTopicFilterString, + ( unsigned int ) usTopicFilterLength, + pxIncomingPublishCallback ) ); + } + else + { + /* Start at end of array, so that we will insert at the first available index. + * Scans backwards to find duplicates. */ + for( lIndex = ( int32_t ) SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS - 1; lIndex >= 0; lIndex-- ) + { + if( pxSubscriptionList[ lIndex ].usFilterStringLength == 0 ) + { + xAvailableIndex = lIndex; + } + else if( ( pxSubscriptionList[ lIndex ].usFilterStringLength == usTopicFilterLength ) && + ( strncmp( pcTopicFilterString, pxSubscriptionList[ lIndex ].pcSubscriptionFilterString, ( size_t ) usTopicFilterLength ) == 0 ) ) + { + /* If a subscription already exists, don't do anything. */ + if( ( pxSubscriptionList[ lIndex ].pxIncomingPublishCallback == pxIncomingPublishCallback ) && + ( pxSubscriptionList[ lIndex ].pvIncomingPublishCallbackContext == pvIncomingPublishCallbackContext ) ) + { + LogWarn( ( "Subscription already exists.\n" ) ); + xAvailableIndex = SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; + xReturnStatus = true; + break; + } + } + } + + if( xAvailableIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ) + { + pxSubscriptionList[ xAvailableIndex ].pcSubscriptionFilterString = pcTopicFilterString; + pxSubscriptionList[ xAvailableIndex ].usFilterStringLength = usTopicFilterLength; + pxSubscriptionList[ xAvailableIndex ].pxIncomingPublishCallback = pxIncomingPublishCallback; + pxSubscriptionList[ xAvailableIndex ].pvIncomingPublishCallbackContext = pvIncomingPublishCallbackContext; + xReturnStatus = true; + } + } + + return xReturnStatus; +} + +/*-----------------------------------------------------------*/ + +void removeSubscription( SubscriptionElement_t * pxSubscriptionList, + const char * pcTopicFilterString, + uint16_t usTopicFilterLength ) +{ + int32_t lIndex = 0; + + if( ( pxSubscriptionList == NULL ) || + ( pcTopicFilterString == NULL ) || + ( usTopicFilterLength == 0U ) ) + { + LogError( ( "Invalid parameter. pxSubscriptionList=%p, pcTopicFilterString=%p," + " usTopicFilterLength=%u.", + pxSubscriptionList, + pcTopicFilterString, + ( unsigned int ) usTopicFilterLength ) ); + } + else + { + for( lIndex = 0; lIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; lIndex++ ) + { + if( pxSubscriptionList[ lIndex ].usFilterStringLength == usTopicFilterLength ) + { + if( strncmp( pxSubscriptionList[ lIndex ].pcSubscriptionFilterString, pcTopicFilterString, usTopicFilterLength ) == 0 ) + { + memset( &( pxSubscriptionList[ lIndex ] ), 0x00, sizeof( SubscriptionElement_t ) ); + } + } + } + } +} + +/*-----------------------------------------------------------*/ + +bool handleIncomingPublishes( SubscriptionElement_t * pxSubscriptionList, + MQTTPublishInfo_t * pxPublishInfo ) +{ + int32_t lIndex = 0; + bool isMatched = false, publishHandled = false; + + if( ( pxSubscriptionList == NULL ) || + ( pxPublishInfo == NULL ) ) + { + LogError( ( "Invalid parameter. pxSubscriptionList=%p, pxPublishInfo=%p,", + pxSubscriptionList, + pxPublishInfo ) ); + } + else + { + for( lIndex = 0; lIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; lIndex++ ) + { + if( pxSubscriptionList[ lIndex ].usFilterStringLength > 0 ) + { + MQTT_MatchTopic( pxPublishInfo->pTopicName, + pxPublishInfo->topicNameLength, + pxSubscriptionList[ lIndex ].pcSubscriptionFilterString, + pxSubscriptionList[ lIndex ].usFilterStringLength, + &isMatched ); + + if( isMatched == true ) + { + pxSubscriptionList[ lIndex ].pxIncomingPublishCallback( pxSubscriptionList[ lIndex ].pvIncomingPublishCallbackContext, + pxPublishInfo ); + publishHandled = true; + } + } + } + } + + return publishHandled; +} diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.h new file mode 100644 index 000000000..0e9cb1207 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Common/subscription-manager/subscription_manager.h @@ -0,0 +1,150 @@ +/* + * FreeRTOS V202012.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 subscription_manager.h + * @brief Functions for managing MQTT subscriptions. + */ +#ifndef SUBSCRIPTION_MANAGER_H +#define SUBSCRIPTION_MANAGER_H + +/**************************************************/ +/******* DO NOT CHANGE the following order ********/ +/**************************************************/ + +/* Logging related header files are required to be included in the following order: + * 1. Include the header file "logging_levels.h". + * 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL. + * 3. Include the header file "logging_stack.h". + */ + +/* Include header that defines log levels. */ +#include "logging_levels.h" + +/* Logging configuration for the Subscription Manager module. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "Subscription Manager" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_ERROR +#endif + +#include "logging_stack.h" + + +/* Demo config include. */ +#include "demo_config.h" + +/* core MQTT include. */ +#include "core_mqtt.h" + + +/** + * @brief Maximum number of subscriptions maintained by the subscription manager + * simultaneously in a list. + */ +#ifndef SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS + #define SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS 10U +#endif + +/** + * @brief Callback function called when receiving a publish. + * + * @param[in] pvIncomingPublishCallbackContext The incoming publish callback context. + * @param[in] pxPublishInfo Deserialized publish information. + */ +typedef void (* IncomingPubCallback_t )( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ); + +/** + * @brief An element in the list of subscriptions. + * + * This subscription manager implementation expects that the array of the + * subscription elements used for storing subscriptions to be initialized to 0. + * + * @note This implementation allows multiple tasks to subscribe to the same topic. + * In this case, another element is added to the subscription list, differing + * in the intended publish callback. Also note that the topic filters are not + * copied in the subscription manager and hence the topic filter strings need to + * stay in scope until unsubscribed. + */ +typedef struct subscriptionElement +{ + IncomingPubCallback_t pxIncomingPublishCallback; + void * pvIncomingPublishCallbackContext; + uint16_t usFilterStringLength; + const char * pcSubscriptionFilterString; +} SubscriptionElement_t; + +/** + * @brief Add a subscription to the subscription list. + * + * @note Multiple tasks can be subscribed to the same topic with different + * context-callback pairs. However, a single context-callback pair may only be + * associated to the same topic filter once. + * + * @param[in] pxSubscriptionList The pointer to the subscription list array. + * @param[in] pcTopicFilterString Topic filter string of subscription. + * @param[in] usTopicFilterLength Length of topic filter string. + * @param[in] pxIncomingPublishCallback Callback function for the subscription. + * @param[in] pvIncomingPublishCallbackContext Context for the subscription callback. + * + * @return `true` if subscription added or exists, `false` if insufficient memory. + */ +bool addSubscription( SubscriptionElement_t * pxSubscriptionList, + const char * pcTopicFilterString, + uint16_t usTopicFilterLength, + IncomingPubCallback_t pxIncomingPublishCallback, + void * pvIncomingPublishCallbackContext ); + +/** + * @brief Remove a subscription from the subscription list. + * + * @note If the topic filter exists multiple times in the subscription list, + * then every instance of the subscription will be removed. + * + * @param[in] pxSubscriptionList The pointer to the subscription list array. + * @param[in] pcTopicFilterString Topic filter of subscription. + * @param[in] usTopicFilterLength Length of topic filter. + */ +void removeSubscription( SubscriptionElement_t * pxSubscriptionList, + const char * pcTopicFilterString, + uint16_t usTopicFilterLength ); + +/** + * @brief Handle incoming publishes by invoking the callbacks registered + * for the incoming publish's topic filter. + * + * @param[in] pxSubscriptionList The pointer to the subscription list array. + * @param[in] pxPublishInfo Info of incoming publish. + * + * @return `true` if an application callback could be invoked; + * `false` otherwise. + */ +bool handleIncomingPublishes( SubscriptionElement_t * pxSubscriptionList, + MQTTPublishInfo_t * pxPublishInfo ); + +#endif /* SUBSCRIPTION_MANAGER_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/DemoTasks/OtaOverHttpDemoExample.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/DemoTasks/OtaOverHttpDemoExample.c new file mode 100644 index 000000000..acbb4276b --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/DemoTasks/OtaOverHttpDemoExample.c @@ -0,0 +1,2438 @@ +/* + * FreeRTOS V202012.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 OtaOverHttpDemoExample.c + * @brief Over The Air Update demo using coreMQTT Agent for jobs operations and coreHTTP for file download. + * + * The file demonstrates how to perform Over The Air update using OTA agent and coreMQTT Agent + * and coreHTTP library. It creates an OTA agent task which manages the OTA firmware update + * for the device. The example also provides implementations to subscribe, publish, + * from an MQTT broker and receive data from s3 service using presigned url. The implementation + * uses coreMQTT agent which manages thread safety of the MQTT operations and allows OTA agent to + * share the same MQTT broker connection with other tasks. OTA agent invokes the callback + * implementations to publish job related control information as well as request and receive chunks + * of pre-signed firmware image from the S3 service. + * + */ + +/* Standard includes. */ +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "semphr.h" + +/* Demo config includes. */ +#include "demo_config.h" + +/* Demo config includes. */ +#include "ota_config.h" + +/* MQTT library includes. */ +#include "core_mqtt_agent.h" + +/* MQTT Agent ports. */ +#include "freertos_agent_message.h" +#include "freertos_command_pool.h" + +/* HTTP include. */ +#include "core_http_client.h" + +/* Common HTTP demo utilities. */ +#include "http_demo_utils.h" + +/* Subscription manager header include. */ +#include "subscription_manager.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* mbedTLS transport interface header.*/ +#include "using_mbedtls.h" + +/* OTA Library include. */ +#include "ota.h" + +/* OTA Library Interface include. */ +#include "ota_os_freertos.h" +#include "ota_mqtt_interface.h" +#include "ota_platform_interface.h" + +/* Include firmware version struct definition. */ +#include "ota_appversion32.h" + +/* Include platform abstraction header. */ +#include "ota_pal.h" + +/*------------- Demo configurations -------------------------*/ + +/** + * @brief The maximum size of the file paths used in the demo. + */ +#define otaexampleMAX_FILE_PATH_SIZE ( 260 ) + +/** + * @brief The maximum size of the stream name required for downloading update file + * from streaming service. + */ +#define otaexampleMAX_STREAM_NAME_SIZE ( 128 ) + +/** + * @brief The delay used in the OTA demo task to periodically output the OTA + * statistics like number of packets received, dropped, processed and queued per connection. + */ +#define otaexampleTASK_DELAY_MS ( 1000U ) + +/** + * @brief The maximum time for which OTA demo waits for an MQTT operation to be complete. + * This involves receiving an acknowledgment for broker for SUBSCRIBE, UNSUBSCRIBE and non + * QOS0 publishes. + */ +#define otaexampleMQTT_TIMEOUT_MS ( 5000U ) + + /** + * @brief HTTP response codes used in this demo. + */ +#define HTTP_RESPONSE_PARTIAL_CONTENT ( 206 ) +#define HTTP_RESPONSE_BAD_REQUEST ( 400 ) +#define HTTP_RESPONSE_FORBIDDEN ( 403 ) +#define HTTP_RESPONSE_NOT_FOUND ( 404 ) + + /** + * @brief Transport timeout in milliseconds for transport send and receive. + */ +#define otaexampleHTTPS_TRANSPORT_SEND_RECV_TIMEOUT_MS ( 2000U ) + +/** + * @brief The common prefix for all OTA topics. + * + * Thing name is substituted with a wildcard symbol `+`. OTA agent + * registers with MQTT broker with the thing name in the topic. This topic + * filter is used to match incoming packet received and route them to OTA. + * Thing name is not needed for this matching. + */ +#define OTA_TOPIC_PREFIX "$aws/things/+/" + +/** + * @brief Wildcard topic filter for job notification. + * The filter is used to match the constructed job notify topic filter from OTA agent and register + * appropriate callback for it. + */ +#define OTA_JOB_NOTIFY_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/notify-next" + +/** + * @brief Length of job notification topic filter. + */ +#define OTA_JOB_NOTIFY_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_NOTIFY_TOPIC_FILTER ) - 1 ) ) + +/** + * @brief Wildcard topic filter for matching job response messages. + * This topic filter is used to match the responses from OTA service for OTA agent job requests. THe + * topic filter is a reserved topic which is not subscribed with MQTT broker. + * + */ +#define OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/$next/get/accepted" + +/** + * @brief Length of job accepted response topic filter. + */ +#define OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER ) - 1 ) ) + + +/** + * @brief Wildcard topic filter for matching OTA data packets. + * The filter is used to match the constructed data stream topic filter from OTA agent and register + * appropriate callback for it. + */ +#define OTA_DATA_STREAM_TOPIC_FILTER OTA_TOPIC_PREFIX "streams/#" + +/** + * @brief Length of data stream topic filter. + */ +#define OTA_DATA_STREAM_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_DATA_STREAM_TOPIC_FILTER ) - 1 ) ) + + +/** + * @brief Starting index of client identifier within OTA topic. + */ +#define OTA_TOPIC_CLIENT_IDENTIFIER_START_IDX ( 12U ) + + /** + * @brief Default topic filter for OTA. + * This is used to route all the packets for OTA reserved topics which OTA agent has not subscribed for. + */ +#define OTA_DEFAULT_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/#" + + /** + * @brief Length of default topic filter. + */ +#define OTA_DEFAULT_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_DEFAULT_TOPIC_FILTER ) - 1 ) ) + +/** + * @brief Used to clear bits in a task's notification value. + */ +#define otaexampleMAX_UINT32 ( 0xffffffff ) + + /** + * @brief Dimensions the buffer used to serialize and deserialize MQTT packets. + * @note Specified in bytes. Must be large enough to hold the maximum + * anticipated MQTT payload. + */ +#define MQTT_AGENT_NETWORK_BUFFER_SIZE ( 10240 ) + + + /** + * @brief The length of the queue used to hold commands for the agent. + */ +#define MQTT_AGENT_COMMAND_QUEUE_LENGTH ( 10 ) + +/** + * @brief The maximum amount of time in milliseconds to wait for the commands + * to be posted to the MQTT agent should the MQTT agent's command queue be full. + * Tasks wait in the Blocked state, so don't use any CPU time. + */ +#define MQTT_AGENT_SEND_BLOCK_TIME_MS ( 200U ) + + /** + * @brief This demo uses task notifications to signal tasks from MQTT callback + * functions. mqttexampleMS_TO_WAIT_FOR_NOTIFICATION defines the time, in ticks, + * to wait for such a callback. + */ +#define MQTT_AGENT_MS_TO_WAIT_FOR_NOTIFICATION ( 5000U ) + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define RETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed operation + * with server. + */ +#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation retry + * attempts. + */ +#define RETRY_BACKOFF_BASE_MS ( 500U ) + +/** + * @brief 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 the this Keep Alive value. In the + * absence of sending any other Control Packets, the Client MUST send a + * PINGREQ Packet. + */ +#define otaexampleKEEP_ALIVE_INTERVAL_SECONDS ( 60U ) + +/** + * @brief Socket send and receive timeouts to use. Specified in milliseconds. + */ +#define otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 750 ) + + /** + * @brief Timeout for receiving CONNACK after sending an MQTT CONNECT packet. + * Defined in milliseconds. + */ +#define otaexampleCONNACK_RECV_TIMEOUT_MS ( 1000U ) + +/** + * @brief Stack size required for MQTT agent task. + * MQTT agent task takes care of TLS connection and reconnection, keeping task stack size + * to high enough required for TLS connection. + */ +#define MQTT_AGENT_TASK_STACK_SIZE ( 6000U ) + +/** + * @brief Priority required for OTA statistics task. + */ +#define MQTT_AGENT_TASK_PRIORITY ( tskIDLE_PRIORITY ) + +/** + * @brief Stack size required for OTA agent task. + */ +#define OTA_AGENT_TASK_STACK_SIZE ( 10000U ) + +/** + * @brief Priority required for OTA agent task. + */ +#define OTA_AGENT_TASK_PRIORITY ( tskIDLE_PRIORITY ) + +/** + * @brief Used to convert times to/from ticks and milliseconds. + */ +#define otaexampleMILLISECONDS_PER_SECOND ( 1000U ) +#define otaexampleMILLISECONDS_PER_TICK ( otaexampleMILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) + + /** + * @brief The timeout for waiting for the agent to get suspended after closing the + * connection. + * + * Timeout value should be large enough for OTA agent to finish any pending MQTT operations + * and suspend itself. + * + */ +#define OTA_SUSPEND_TIMEOUT_MS ( 10000U ) + +/** + * @brief Maximum size of the url. + */ +#define OTA_MAX_URL_SIZE ( 2048U ) + +/** + * @brief Maximum size of the auth scheme. + */ +#define OTA_MAX_AUTH_SCHEME_SIZE ( 48U ) + +/** + * @brief The maximum size of the HTTP header. + */ +#define HTTP_HEADER_SIZE_MAX ( 1024U ) + +/* HTTP buffers used for http request and response. */ +#define HTTP_USER_BUFFER_LENGTH ( otaconfigFILE_BLOCK_SIZE + HTTP_HEADER_SIZE_MAX ) + +/*---------------------------------------------------------*/ + +/** + * @brief Structure used to store the topic filter to ota callback mappings. + */ +typedef struct OtaTopicFilterCallback +{ + const char * pTopicFilter; + uint16_t topicFilterLength; + IncomingPubCallback_t callback; +} OtaTopicFilterCallback_t; + +/** + * @brief Defines the structure to use as the command callback context in this + * demo. + */ +struct MQTTAgentCommandContext +{ + MQTTStatus_t xReturnStatus; + TaskHandle_t xTaskToNotify; + void * pArgs; +}; + +/** + * @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 *. + * + * @note Transport stacks are defined in FreeRTOS-Plus/Source/Application-Protocols/network_transport. + */ +struct NetworkContext +{ + TlsTransportParams_t * pParams; +}; + + +/*---------------------------------------------------------*/ + +/** + * @brief Global entry time into the application to use as a reference timestamp + * in the #prvGetTimeMs function. #prvGetTimeMs will always return the difference + * between the current time and the global entry time. This will reduce the chances + * of overflow for the 32 bit unsigned integer used for holding the timestamp. + */ +static uint32_t ulGlobalEntryTimeMs; + +/** + * @brief The buffer is used to hold the serialized packets for transmission to and from + * the transport interface. + */ +static uint8_t xNetworkBuffer[ MQTT_AGENT_NETWORK_BUFFER_SIZE ]; + +/** + * @brief FreeRTOS blocking queue to be used as MQTT Agent context. + */ +static MQTTAgentMessageContext_t xCommandQueue; + +/** + * @brief The network context used by the MQTT library transport interface. + * See https://www.freertos.org/network-interface.html + */ +static NetworkContext_t xNetworkContextMqtt; + +/** + * @brief Network connection context used for HTTP connection. + */ +static NetworkContext_t xNetworkContextHttp; + +/** + * @brief The host address string extracted from the pre-signed URL. + * + * @note S3_PRESIGNED_GET_URL_LENGTH is set as the array length here as the + * length of the host name string cannot exceed this value. + */ +static char acServerHost[256]; + +/** + * @brief The length of the host address found in the pre-signed URL. + */ +static size_t xServerHostLength; + +/** + * @brief A buffer used in the demo for storing HTTP request headers and + * HTTP response headers and body. + * + * @note This demo shows how the same buffer can be re-used for storing the HTTP + * response after the HTTP request is sent out. However, the user can also + * decide to use separate buffers for storing the HTTP request and response. + */ +static uint8_t aucHttpUserBuffer[HTTP_USER_BUFFER_LENGTH]; + +/** + * @brief The parameters for the network context using a TLS channel. + */ +static TlsTransportParams_t xTlsTransportParams; + +/** + * @brief The parameters for the network context using a TLS channel for https. + */ +static TlsTransportParams_t xTlsTransportParamsHttps; + +/** + * @brief The global array of subscription elements. + * + * @note No thread safety is required to this array, since the updates the array + * elements are done only from one task at a time. The subscription manager + * implementation expects that the array of the subscription elements used for + * storing subscriptions to be initialized to 0. As this is a global array, it + * will be intialized to 0 by default. + */ +static SubscriptionElement_t xGlobalSubscriptionList[ SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ]; + +/** + * @brief Buffer used to store the firmware image file path. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t updateFilePath[ otaexampleMAX_FILE_PATH_SIZE ]; + +/** + * @brief Buffer used to store the code signing certificate file path. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t certFilePath[ otaexampleMAX_FILE_PATH_SIZE ]; + +/** + * @brief Buffer used to store the name of the data stream. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t streamName[ otaexampleMAX_STREAM_NAME_SIZE ]; + +/** + * @brief Buffer used decode the CBOR message from the MQTT payload. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t decodeMem[ ( 1U << otaconfigLOG2_FILE_BLOCK_SIZE ) ]; + +/** + * @brief Application buffer used to store the bitmap for requesting firmware image + * chunks from MQTT broker. Buffer is passed to the OTA agent during initialization. + */ +static uint8_t bitmap[ OTA_MAX_BLOCK_BITMAP_SIZE ]; + +/** + * @brief Certificate File path buffer. + */ +static uint8_t updateUrl[OTA_MAX_URL_SIZE]; + +/** + * @brief Auth scheme buffer. + */ +static uint8_t authScheme[OTA_MAX_URL_SIZE]; + + +/** + * @brief A statically allocated array of event buffers used by the OTA agent. + * Maximum number of buffers are determined by how many chunks are requested + * by OTA agent at a time along with an extra buffer to handle control message. + * The size of each buffer is determined by the maximum size of firmware image + * chunk, and other metadata send along with the chunk. + */ +static OtaEventData_t eventBuffer[ otaconfigMAX_NUM_OTA_DATA_BUFFERS ] = { 0 }; + +/* + * @brief Mutex used to manage thread safe access of OTA event buffers. + */ +static SemaphoreHandle_t xBufferSemaphore; + +/** + * @brief Static handle used for MQTT agent context. + */ +static MQTTAgentContext_t xGlobalMqttAgentContext; + +/* The transport layer interface used by the HTTP Client library. */ +static TransportInterface_t xTransportInterfaceHttp; + +/** + * @brief The location of the path within the pre-signed URL. + */ +static const char* pcPath; + +/*---------------------------------------------------------*/ + +/** + * @brief Task for MQTT agent. + * Task runs MQTT agent command loop, which returns only when the user disconnects + * MQTT, terminates agent, or the mqtt connection is broken. If the mqtt connection is broken, the task + * suspends OTA agent reconnects to the broker and then resumes OTA agent. + * + * @param[in] pParam Can be used to pass down functionality to the agent task + */ +static void prvMQTTAgentTask(void* pParam); + +/** + * @brief Function used by OTA agent to publish control messages to the MQTT broker. + * + * The implementation uses MQTT agent to queue a publish request. It then waits + * for the request complete notification from the agent. The notification along with result of the + * operation is sent back to the caller task using xTaksNotify API. For publishes involving QOS 1 and + * QOS2 the operation is complete once an acknowledgment (PUBACK) is received. OTA agent uses this function + * to fetch new job, provide status update and send other control related messges to the MQTT broker. + * + * @param[in] pacTopic Topic to publish the control packet to. + * @param[in] topicLen Length of the topic string. + * @param[in] pMsg Message to publish. + * @param[in] msgSize Size of the message to publish. + * @param[in] qos Qos for the publish. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + */ +static OtaMqttStatus_t prvMQTTPublish( const char * const pacTopic, + uint16_t topicLen, + const char * pMsg, + uint32_t msgSize, + uint8_t qos ); + +/** + * @brief Function used by OTA agent to subscribe for a control or data packet from the MQTT broker. + * + * The implementation queues a SUBSCRIBE request for the topic filter with the MQTT agent. It then waits for + * a notification of the request completion. Notification will be sent back to caller task, + * using xTaskNotify APIs. MQTT agent also stores a callback provided by this function with + * the associated topic filter. The callback will be used to + * route any data received on the matching topic to the OTA agent. OTA agent uses this function + * to subscribe to all topic filters necessary for receiving job related control messages as + * well as firmware image chunks from MQTT broker. + * + * @param[in] pTopicFilter The topic filter used to subscribe for packets. + * @param[in] topicFilterLength Length of the topic filter string. + * @param[in] ucQoS Intended qos value for the messages received on this topic. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + */ +static OtaMqttStatus_t prvMQTTSubscribe( const char * pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS ); + +/** + * @brief Function is used by OTA agent to unsubscribe a topicfilter from MQTT broker. + * + * The implementation queues an UNSUBSCRIBE request for the topic filter with the MQTT agent. It then waits + * for a successful completion of the request from the agent. Notification along with results of + * operation is sent using xTaskNotify API to the caller task. MQTT agent also removes the topic filter + * subscription from its memory so any future + * packets on this topic will not be routed to the OTA agent. + * + * @param[in] pTopicFilter Topic filter to be unsubscribed. + * @param[in] topicFilterLength Length of the topic filter. + * @param[in] ucQos Qos value for the topic. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + * + */ +static OtaMqttStatus_t prvMQTTUnsubscribe( const char * pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS ); + +/** + * @brief Fetch an unused OTA event buffer from the pool. + * + * Demo uses a simple statically allocated array of fixed size event buffers. The + * number of event buffers is configured by the param otaconfigMAX_NUM_OTA_DATA_BUFFERS + * within ota_config.h. This function is used to fetch a free buffer from the pool for processing + * by the OTA agent task. It uses a mutex for thread safe access to the pool. + * + * @return A pointer to an unused buffer. NULL if there are no buffers available. + */ +static OtaEventData_t * prvOTAEventBufferGet( void ); + +/** + * @brief Free an event buffer back to pool + * + * OTA demo uses a statically allocated array of fixed size event buffers . The + * number of event buffers is configured by the param otaconfigMAX_NUM_OTA_DATA_BUFFERS + * within ota_config.h. The function is used by the OTA application callback to free a buffer, + * after OTA agent has completed processing with the event. The access to the pool is made thread safe + * using a mutex. + * + * @param[in] pxBuffer Pointer to the buffer to be freed. + */ +static void prvOTAEventBufferFree( OtaEventData_t * const pxBuffer ); + +/** + * @brief The function which runs the OTA agent task. + * + * The function runs the OTA Agent Event processing loop, which waits for + * any events for OTA agent and process them. The loop never returns until the OTA agent + * is shutdown. The tasks exits gracefully by freeing up all resources in the event of an + * OTA agent shutdown. + * + * @param[in] pvParam Any parameters to be passed to OTA agent task. + */ +static void prvOTAAgentTask( void * pvParam ); + + +/** + * @brief The function which runs the OTA demo task. + * + * The demo task initializes the OTA agent an loops until OTA agent is shutdown. + * It reports OTA update statistics (which includes number of blocks received, processed and dropped), + * at regular intervals. + */ +static void vOtaDemoTask( void* pvParam ); + +/** + * @brief The function which implements the flow for OTA demo. + * + * @return pdPASS if success or pdFAIL. + */ +static BaseType_t prvRunOTADemo(void); + +/** + * @brief Callback registered with the OTA library that notifies the OTA agent + * of an incoming PUBLISH containing a job document. + * + * @param[in] pContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet information which stores details of the + * job document. + */ +static void prvMqttJobCallback( void * pContext, + MQTTPublishInfo_t * pPublish ); + + +/** + * @brief Callback that notifies the OTA library when a data block is received. + * + * @param[in] pContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet that stores the information of the file block. + */ +static void prvMqttDataCallback( void * pContext, + MQTTPublishInfo_t * pPublish ); + +/** + * @brief Default callback used to receive unsolicited messages for OTA. + * + * The callback is not subscribed with MQTT broker, but only with local subscription manager. + * A wildcard OTA job topic is used for subscription so that all unsolicited messages related to OTA is + * forwarded to this callback for filteration. Right now the callback is used to filter responses to job requests + * from the OTA service. + * + * @param[in] pvIncomingPublishCallbackContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet that stores the information of the file block. + */ +static void prvMqttDefaultCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ); + + +/** + * @brief Attempt to connect to the MQTT broker. + * + */ +static void prvConnectToMQTTBroker(void); + +/** + * @brief Retry logic to establish a connection to the MQTT broker. + * + * If the connection fails, keep retrying with exponentially increasing + * timeout value, until max retries, max timeout or successful connect. + * + * @param[in] pNetworkContext Network context to connect on. + * @return int pdFALSE if connection failed after retries. + */ +static BaseType_t prvSocketConnect(NetworkContext_t* pNetworkContext); + +/** + * @brief Disconnects from the MQTT broker. + * Initiates an MQTT disconnect and then teardown underlying TCP connection. + * + */ +static void prvDisconnectFromMQTTBroker(void); + +/** + * @brief Initializes an MQTT context, including transport interface and + * network buffer. + * + * @return `MQTTSuccess` if the initialization succeeds, else `MQTTBadParameter`. + */ +static MQTTStatus_t prvMqttInit(void); + +/** + * @brief Sends an MQTT Connect packet over the already connected TCP socket. + * + * @param[in] pxMQTTContext MQTT context pointer. + * @param[in] xCleanSession If a clean session should be established. + * + * @return `MQTTSuccess` if connection succeeds, else appropriate error code + * from MQTT_Connect. + */ +static MQTTStatus_t prvMQTTConnect( bool xCleanSession ); + +/** + * @brief Register OTA callbacks with the subscription manager. + * + * @param[in] pTopicFilter The topic filter for which a callback needs to be registered for. + * @param[in] topicFilterLength length of the topic filter. + * + */ +static void prvRegisterOTACallback(const char* pTopicFilter, + uint16_t topicFilterLength); + +/** + * @brief Suspend OTA demo. + * + * @return pPASS or pdFAIL. + */ +static BaseType_t prvSuspendOTA(void); + +/** + * @brief Resume OTA demo. + * + * @return pPASS or pdFAIL. + */ +static BaseType_t prvResumeOTA(void); + +/** + * @brief Set OTA interfaces. + * + * @param[in] pOtaInterfaces pointer to OTA interface structure. + * + * @return None. + */ +static void setOtaInterfaces(OtaInterfaces_t* pOtaInterfaces); + +/** + * @brief Structure containing all application allocated buffers used by the OTA agent. + * Structure is passed to the OTA agent during initialization. + */ +static OtaAppBuffer_t otaBuffer = +{ + .pUpdateFilePath = updateFilePath, + .updateFilePathsize = otaexampleMAX_FILE_PATH_SIZE, + .pCertFilePath = certFilePath, + .certFilePathSize = otaexampleMAX_FILE_PATH_SIZE, + .pDecodeMemory = decodeMem, + .decodeMemorySize = ( 1U << otaconfigLOG2_FILE_BLOCK_SIZE ), + .pFileBitmap = bitmap, + .fileBitmapSize = OTA_MAX_BLOCK_BITMAP_SIZE, + .pUrl = updateUrl, + .urlSize = OTA_MAX_URL_SIZE, + .pAuthScheme = authScheme, + .authSchemeSize = OTA_MAX_AUTH_SCHEME_SIZE +}; + +/** + * @brief Structure used for encoding firmware version. + */ +const AppVersion32_t appFirmwareVersion = +{ + .u.x.major = APP_VERSION_MAJOR, + .u.x.minor = APP_VERSION_MINOR, + .u.x.build = APP_VERSION_BUILD, +}; + +/** + * @brief Registry for all mqtt topic filters to their corresponding callbacks for OTA. + */ +static OtaTopicFilterCallback_t otaTopicFilterCallbacks[] = +{ + { + .pTopicFilter = OTA_JOB_NOTIFY_TOPIC_FILTER, + .topicFilterLength = OTA_JOB_NOTIFY_TOPIC_FILTER_LENGTH, + .callback = prvMqttJobCallback + }, + { + .pTopicFilter = OTA_DATA_STREAM_TOPIC_FILTER, + .topicFilterLength = OTA_DATA_STREAM_TOPIC_FILTER_LENGTH, + .callback = prvMqttDataCallback + }, + { + .pTopicFilter = OTA_DEFAULT_TOPIC_FILTER, + .topicFilterLength = OTA_DEFAULT_TOPIC_FILTER_LENGTH, + .callback = prvMqttDefaultCallback + } +}; + +/*-----------------------------------------------------------*/ + +static void prvOTAEventBufferFree( OtaEventData_t * const pxBuffer ) +{ + if( xSemaphoreTake( xBufferSemaphore, portMAX_DELAY ) == pdTRUE ) + { + pxBuffer->bufferUsed = false; + ( void ) xSemaphoreGive( xBufferSemaphore ); + } +} + +/*-----------------------------------------------------------*/ + +static OtaEventData_t * prvOTAEventBufferGet( void ) +{ + uint32_t ulIndex = 0; + OtaEventData_t * pFreeBuffer = NULL; + + if( xSemaphoreTake( xBufferSemaphore, portMAX_DELAY ) == pdTRUE ) + { + for( ulIndex = 0; ulIndex < otaconfigMAX_NUM_OTA_DATA_BUFFERS; ulIndex++ ) + { + if( eventBuffer[ ulIndex ].bufferUsed == false ) + { + eventBuffer[ ulIndex ].bufferUsed = true; + pFreeBuffer = &eventBuffer[ ulIndex ]; + break; + } + } + + ( void ) xSemaphoreGive( xBufferSemaphore ); + } + + return pFreeBuffer; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief The OTA agent has completed the update job or it is in + * self test mode. If it was accepted, we want to activate the new image. + * This typically means we should reset the device to run the new firmware. + * If now is not a good time to reset the device, it may be activated later + * by your user code. If the update was rejected, just return without doing + * anything and we will wait for another job. If it reported that we should + * start test mode, normally we would perform some kind of system checks to + * make sure our new firmware does the basic things we think it should do + * but we will just go ahead and set the image as accepted for demo purposes. + * The accept function varies depending on your platform. Refer to the OTA + * PAL implementation for your platform in ota_pal.c to see what it + * does for you. + * + * @param[in] event Specify if this demo is running with the AWS IoT + * MQTT server. Set this to `false` if using another MQTT server. + * @param[in] pData Data associated with the event. + * @return None. + */ +static void otaAppCallback( OtaJobEvent_t event, + const void * pData ) +{ + OtaErr_t err = OtaErrUninitialized; + + switch( event ) + { + case OtaJobEventActivate: + LogInfo( ( "Received OtaJobEventActivate callback from OTA Agent." ) ); + + /** + * Activate the new firmware image immediately. Applications can choose to postpone + * the activation to a later stage if needed. + */ + err = OTA_ActivateNewImage(); + + /** + * Activation of the new image failed. This indicates an error that requires a follow + * up through manual activation by resetting the device. The demo reports the error + * and shuts down the OTA agent. + */ + LogError( ( "New image activation failed." ) ); + + /* Shutdown OTA Agent, if it is required that the unsubscribe operations are not + * performed while shutting down please set the second parameter to 0 instead of 1. */ + OTA_Shutdown( 0, 1 ); + + + break; + + case OtaJobEventFail: + + /** + * No user action is needed here. OTA agent handles the job failure event. + */ + LogInfo( ( "Received an OtaJobEventFail notification from OTA Agent." ) ); + + break; + + case OtaJobEventStartTest: + + /* This demo just accepts the image since it was a good OTA update and networking + * and services are all working (or we would not have made it this far). If this + * were some custom device that wants to test other things before validating new + * image, this would be the place to kick off those tests before calling + * OTA_SetImageState() with the final result of either accepted or rejected. */ + + LogInfo( ( "Received OtaJobEventStartTest callback from OTA Agent." ) ); + + err = OTA_SetImageState( OtaImageStateAccepted ); + + if( err == OtaErrNone ) + { + LogInfo( ( "New image validation succeeded in self test mode." ) ); + } + else + { + LogError( ( "Failed to set image state as accepted with error %d.", err ) ); + } + + break; + + case OtaJobEventProcessed: + + LogDebug( ( "OTA Event processing completed. Freeing the event buffer to pool." ) ); + configASSERT( pData != NULL ); + prvOTAEventBufferFree( ( OtaEventData_t * ) pData ); + + break; + + case OtaJobEventSelfTestFailed: + LogDebug( ( "Received OtaJobEventSelfTestFailed callback from OTA Agent." ) ); + + /* Requires manual activation of previous image as self-test for + * new image downloaded failed.*/ + LogError( ( "OTA Self-test failed for new image. shutting down OTA Agent." ) ); + + /* Shutdown OTA Agent, if it is required that the unsubscribe operations are not + * performed while shutting down please set the second parameter to 0 instead of 1. */ + OTA_Shutdown( 0, 1 ); + + break; + + default: + LogWarn( ( "Received an unhandled callback event from OTA Agent, event = %d", event ) ); + + break; + } +} + +static void prvMqttJobCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + OtaEventData_t * pData; + OtaEventMsg_t eventMsg = { 0 }; + + configASSERT( pxPublishInfo != NULL ); + ( void ) pvIncomingPublishCallbackContext; + + LogInfo( ( "Received job message callback, size %ld.\n\n", pxPublishInfo->payloadLength ) ); + + pData = prvOTAEventBufferGet(); + + if( pData != NULL ) + { + memcpy( pData->data, pxPublishInfo->pPayload, pxPublishInfo->payloadLength ); + pData->dataLength = pxPublishInfo->payloadLength; + eventMsg.eventId = OtaAgentEventReceivedJobDocument; + eventMsg.pEventData = pData; + + /* Send job document received event. */ + OTA_SignalEvent( &eventMsg ); + } + else + { + LogError( ( "Error: No OTA data buffers available.\r\n" ) ); + } +} + +/*-----------------------------------------------------------*/ +static void prvMqttDefaultCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + bool isMatch = false; + + ( void ) MQTT_MatchTopic( pxPublishInfo->pTopicName, + pxPublishInfo->topicNameLength, + OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER, + OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER_LENGTH, + &isMatch ); + + if( isMatch == true ) + { + prvMqttJobCallback( pvIncomingPublishCallbackContext, pxPublishInfo ); + } +} + +/*-----------------------------------------------------------*/ +static void prvMqttDataCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + OtaEventData_t * pxData; + OtaEventMsg_t eventMsg = { 0 }; + + configASSERT( pxPublishInfo != NULL ); + ( void ) pvIncomingPublishCallbackContext; + + LogInfo( ( "Received data message callback, size %zu.\n\n", pxPublishInfo->payloadLength ) ); + + pxData = prvOTAEventBufferGet(); + + if(pxData != NULL ) + { + memcpy(pxData->data, pxPublishInfo->pPayload, pxPublishInfo->payloadLength ); + pxData->dataLength = pxPublishInfo->payloadLength; + eventMsg.eventId = OtaAgentEventReceivedFileBlock; + eventMsg.pEventData = pxData; + + /* Send job document received event. */ + OTA_SignalEvent( &eventMsg ); + } + else + { + LogError( ( "Error: No OTA data buffers available.\r\n" ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvCommandCallback( MQTTAgentCommandContext_t * pxCommandContext, + MQTTAgentReturnInfo_t * pxReturnInfo ) +{ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if( pxCommandContext->xTaskToNotify != NULL ) + { + xTaskNotify( pxCommandContext->xTaskToNotify, ( uint32_t ) ( pxReturnInfo->returnCode ), eSetValueWithOverwrite ); + } +} + +static void prvMQTTSubscribeCompleteCallback( MQTTAgentCommandContext_t* pxCommandContext, + MQTTAgentReturnInfo_t* pxReturnInfo ) +{ + MQTTAgentSubscribeArgs_t* pSubsribeArgs; + + if (pxReturnInfo->returnCode == MQTTSuccess) + { + pSubsribeArgs = (MQTTAgentSubscribeArgs_t*)(pxCommandContext->pArgs); + prvRegisterOTACallback(pSubsribeArgs->pSubscribeInfo->pTopicFilter, pSubsribeArgs->pSubscribeInfo->topicFilterLength); + } + + /* Store the result in the application defined context so the task that + * initiated the publish can check the operation's status. */ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if (pxCommandContext->xTaskToNotify != NULL) + { + /* Send the context's ulNotificationValue as the notification value so + * the receiving task can check the value it set in the context matches + * the value it receives in the notification. */ + xTaskNotify(pxCommandContext->xTaskToNotify, (uint32_t)(pxReturnInfo->returnCode), eSetValueWithOverwrite); + } +} + +/*-----------------------------------------------------------*/ + +static void prvMQTTUnsubscribeCompleteCallback( MQTTAgentCommandContext_t* pxCommandContext, + MQTTAgentReturnInfo_t* pxReturnInfo ) +{ + /* Store the result in the application defined context so the task that + * initiated the publish can check the operation's status. */ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if (pxCommandContext->xTaskToNotify != NULL) + { + /* Send the context's ulNotificationValue as the notification value so + * the receiving task can check the value it set in the context matches + * the value it receives in the notification. */ + xTaskNotify(pxCommandContext->xTaskToNotify, (uint32_t)(pxReturnInfo->returnCode), eSetValueWithOverwrite); + } +} + +/*-----------------------------------------------------------*/ + +static uint32_t prvGetTimeMs( void ) +{ + TickType_t xTickCount = 0; + uint32_t ulTimeMs = 0UL; + + /* Get the current tick count. */ + xTickCount = xTaskGetTickCount(); + + /* Convert the ticks to milliseconds. */ + ulTimeMs = ( uint32_t ) xTickCount * otaexampleMILLISECONDS_PER_TICK; + + /* Reduce ulGlobalEntryTimeMs from obtained time so as to always return the + * elapsed time in the application. */ + ulTimeMs = ( uint32_t ) ( ulTimeMs - ulGlobalEntryTimeMs ); + + return ulTimeMs; +} + +/*-----------------------------------------------------------*/ + +static void prvIncomingPublishCallback( MQTTAgentContext_t * pMqttAgentContext, + uint16_t packetId, + MQTTPublishInfo_t * pxPublishInfo ) +{ + bool xPublishHandled = false; + char cOriginalChar, * pcLocation; + + ( void ) packetId; + + /* Fan out the incoming publishes to the callbacks registered using + * subscription manager. */ + xPublishHandled = handleIncomingPublishes( ( SubscriptionElement_t * ) pMqttAgentContext->pIncomingCallbackContext, + pxPublishInfo ); + + /* If there are no callbacks to handle the incoming publishes, + * handle it as an unsolicited publish. */ + if( xPublishHandled != true ) + { + /* Ensure the topic string is terminated for printing. This will over- + * write the message ID, which is restored afterwards. */ + pcLocation = ( char * ) &( pxPublishInfo->pTopicName[ pxPublishInfo->topicNameLength ] ); + cOriginalChar = *pcLocation; + *pcLocation = 0x00; + LogWarn( ( "Received an unsolicited publish from topic %s", pxPublishInfo->pTopicName ) ); + *pcLocation = cOriginalChar; + } +} + +/*-----------------------------------------------------------*/ + + + +static void prvSubscriptionCommandCallback( void * pxCommandContext, + MQTTAgentReturnInfo_t * pxReturnInfo ) +{ + size_t xIndex = 0; + MQTTAgentSubscribeArgs_t * pxSubscribeArgs = ( MQTTAgentSubscribeArgs_t * ) pxCommandContext; + + /* If the return code is success, no further action is required as all the topic filters + * are already part of the subscription list. */ + if( pxReturnInfo->returnCode != MQTTSuccess ) + { + /* Check through each of the suback codes and determine if there are any failures. */ + for( xIndex = 0; xIndex < pxSubscribeArgs->numSubscriptions; xIndex++ ) + { + /* This demo doesn't attempt to resubscribe in the event that a SUBACK failed. */ + if( pxReturnInfo->pSubackCodes[xIndex] == MQTTSubAckFailure ) + { + LogError( ( "Failed to resubscribe to topic %.*s.", + pxSubscribeArgs->pSubscribeInfo[xIndex].topicFilterLength, + pxSubscribeArgs->pSubscribeInfo[xIndex].pTopicFilter ) ); + /* Remove subscription callback for unsubscribe. */ + removeSubscription( xGlobalSubscriptionList, + pxSubscribeArgs->pSubscribeInfo[xIndex].pTopicFilter, + pxSubscribeArgs->pSubscribeInfo[xIndex].topicFilterLength ); + } + } + + /* Hit an assert as some of the tasks won't be able to proceed correctly without + * the subscriptions. This logic will be updated with exponential backoff and retry. */ + configASSERT( pdTRUE ); + } +} + + + +/*-----------------------------------------------------------*/ + +static MQTTStatus_t prvHandleResubscribe( void ) +{ + MQTTStatus_t xResult = MQTTBadParameter; + uint32_t ulIndex = 0U; + uint16_t usNumSubscriptions = 0U; + + /* These variables need to stay in scope until command completes. */ + static MQTTAgentSubscribeArgs_t xSubArgs = { 0 }; + static MQTTSubscribeInfo_t xSubInfo[ SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ] = { 0 }; + static MQTTAgentCommandInfo_t xCommandParams = { 0 }; + + /* Loop through each subscription in the subscription list and add a subscribe + * command to the command queue. */ + for( ulIndex = 0U; ulIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; ulIndex++ ) + { + /* Check if there is a subscription in the subscription list. This demo + * doesn't check for duplicate subscriptions. */ + if( xGlobalSubscriptionList[ ulIndex ].usFilterStringLength != 0 ) + { + xSubInfo[ usNumSubscriptions ].pTopicFilter = xGlobalSubscriptionList[ ulIndex ].pcSubscriptionFilterString; + xSubInfo[ usNumSubscriptions ].topicFilterLength = xGlobalSubscriptionList[ ulIndex ].usFilterStringLength; + + /* QoS1 is used for all the subscriptions in this demo. */ + xSubInfo[ usNumSubscriptions ].qos = MQTTQoS1; + + LogInfo( ( "Resubscribe to the topic %.*s will be attempted.", + xSubInfo[ usNumSubscriptions ].topicFilterLength, + xSubInfo[ usNumSubscriptions ].pTopicFilter ) ); + + usNumSubscriptions++; + } + } + + if( usNumSubscriptions > 0U ) + { + xSubArgs.pSubscribeInfo = xSubInfo; + xSubArgs.numSubscriptions = usNumSubscriptions; + + /* The block time can be 0 as the command loop is not running at this point. */ + xCommandParams.blockTimeMs = 0U; + xCommandParams.cmdCompleteCallback = prvSubscriptionCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = ( void * ) &xSubArgs; + + /* Enqueue subscribe to the command queue. These commands will be processed only + * when command loop starts. */ + xResult = MQTTAgent_Subscribe( &xGlobalMqttAgentContext, &xSubArgs, &xCommandParams ); + } + else + { + /* Mark the resubscribe as success if there is nothing to be subscribed. */ + xResult = MQTTSuccess; + } + + if( xResult != MQTTSuccess ) + { + LogError( ( "Failed to enqueue the MQTT subscribe command. xResult=%s.", + MQTT_Status_strerror( xResult ) ) ); + } + + return xResult; +} + +static void prvRegisterOTACallback( const char * pTopicFilter, + uint16_t topicFilterLength ) +{ + bool isMatch = false; + MQTTStatus_t mqttStatus = MQTTSuccess; + uint16_t index = 0U; + uint16_t numTopicFilters = sizeof( otaTopicFilterCallbacks ) / sizeof( OtaTopicFilterCallback_t ); + + + bool subscriptionAdded; + + ( void ) mqttStatus; + + /* Match the input topic filter against the wild-card pattern of topics filters + * relevant for the OTA Update service to determine the type of topic filter. */ + for( ; index < numTopicFilters; index++ ) + { + mqttStatus = MQTT_MatchTopic( pTopicFilter, + topicFilterLength, + otaTopicFilterCallbacks[ index ].pTopicFilter, + otaTopicFilterCallbacks[ index ].topicFilterLength, + &isMatch ); + assert( mqttStatus == MQTTSuccess ); + + if( isMatch ) + { + /* Add subscription so that incoming publishes are routed to the application callback. */ + subscriptionAdded = addSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext, + pTopicFilter, + topicFilterLength, + otaTopicFilterCallbacks[ index ].callback, + NULL ); + + if( subscriptionAdded == false ) + { + LogError( ( "Failed to register a publish callback for topic %.*s.", + pTopicFilter, + topicFilterLength ) ); + } + } + } +} + +static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext ) +{ + BaseType_t xConnected = pdFAIL; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xReconnectParams = { 0 }; + uint16_t usNextRetryBackOff = 0U; + + TlsTransportStatus_t xNetworkStatus = TLS_TRANSPORT_CONNECT_FAILURE; + NetworkCredentials_t xNetworkCredentials = { 0 }; + + /* ALPN protocols must be a NULL-terminated list of strings. Therefore, + * the first entry will contain the actual ALPN protocol string while the + * second entry must remain NULL. */ + char * pcAlpnProtocols[] = { NULL, NULL }; + + /* The ALPN string changes depending on whether username/password authentication is used. */ + #ifdef democonfigCLIENT_USERNAME + pcAlpnProtocols[ 0 ] = AWS_IOT_CUSTOM_AUTH_ALPN; + #else + pcAlpnProtocols[ 0 ] = AWS_IOT_MQTT_ALPN; + #endif + xNetworkCredentials.pAlpnProtos = pcAlpnProtocols; + + /* Set the credentials for establishing a TLS connection. */ + xNetworkCredentials.pRootCa = ( const unsigned char * ) democonfigROOT_CA_PEM; + xNetworkCredentials.rootCaSize = sizeof( democonfigROOT_CA_PEM ); + #ifdef democonfigCLIENT_CERTIFICATE_PEM + xNetworkCredentials.pClientCert = ( const unsigned char * ) democonfigCLIENT_CERTIFICATE_PEM; + xNetworkCredentials.clientCertSize = sizeof( democonfigCLIENT_CERTIFICATE_PEM ); + xNetworkCredentials.pPrivateKey = ( const unsigned char * ) democonfigCLIENT_PRIVATE_KEY_PEM; + xNetworkCredentials.privateKeySize = sizeof( democonfigCLIENT_PRIVATE_KEY_PEM ); + #endif + xNetworkCredentials.disableSni = democonfigDISABLE_SNI; + + + /* We will use a retry mechanism with an exponential backoff mechanism and + * jitter. That is done to prevent a fleet of IoT devices all trying to + * reconnect at exactly the same time should they become disconnected at + * the same time. We initialize reconnect attempts and interval here. */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + RETRY_BACKOFF_BASE_MS, + RETRY_MAX_BACKOFF_DELAY_MS, + RETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to MQTT broker. If connection fails, retry after a + * timeout. Timeout value will exponentially increase until the maximum + * number of attempts are reached. + */ + do + { + /* Establish a TCP connection with the MQTT broker. This example connects to + * the MQTT broker as specified in democonfigMQTT_BROKER_ENDPOINT and + * democonfigMQTT_BROKER_PORT at the top of this file. */ + LogInfo( ( "Creating a TLS connection to %s:%d.", + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT ) ); + xNetworkStatus = TLS_FreeRTOS_Connect( pxNetworkContext, + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT, + &xNetworkCredentials, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ); + xConnected = ( xNetworkStatus == TLS_TRANSPORT_SUCCESS ) ? pdPASS : pdFAIL; + + if( !xConnected ) + { + /* Get back-off value (in milliseconds) for the next connection retry. */ + xBackoffAlgStatus = BackoffAlgorithm_GetNextBackoff( &xReconnectParams, uxRand(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the broker failed. " + "Retrying connection in %hu ms.", + usNextRetryBackOff ) ); + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + } + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Connection to the broker failed, all attempts exhausted." ) ); + } + } while( ( xConnected != pdPASS ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + return xConnected; +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvSocketDisconnect(NetworkContext_t* pxNetworkContext) +{ + BaseType_t xDisconnected = pdFAIL; + + LogInfo(("Disconnecting TLS connection.\n")); + TLS_FreeRTOS_Disconnect(pxNetworkContext); + xDisconnected = pdPASS; + + return xDisconnected; +} + +static MQTTStatus_t prvMQTTInit( void ) +{ + TransportInterface_t xTransport; + MQTTStatus_t xReturn; + MQTTFixedBuffer_t xFixedBuffer = { .pBuffer = xNetworkBuffer, .size = MQTT_AGENT_NETWORK_BUFFER_SIZE }; + static uint8_t staticQueueStorageArea[ MQTT_AGENT_COMMAND_QUEUE_LENGTH * sizeof( MQTTAgentCommand_t * ) ]; + static StaticQueue_t staticQueueStructure; + MQTTAgentMessageInterface_t messageInterface = + { + .pMsgCtx = NULL, + .send = Agent_MessageSend, + .recv = Agent_MessageReceive, + .getCommand = Agent_GetCommand, + .releaseCommand = Agent_ReleaseCommand + }; + + LogDebug( ( "Creating command queue." ) ); + xCommandQueue.queue = xQueueCreateStatic( MQTT_AGENT_COMMAND_QUEUE_LENGTH, + sizeof(MQTTAgentCommand_t* ), + staticQueueStorageArea, + &staticQueueStructure ); + configASSERT( xCommandQueue.queue ); + messageInterface.pMsgCtx = &xCommandQueue; + + /* Initialize the task pool. */ + Agent_InitializePool(); + + /* Fill in Transport Interface send and receive function pointers. */ + xTransport.pNetworkContext = &xNetworkContextMqtt; + xTransport.send = TLS_FreeRTOS_send; + xTransport.recv = TLS_FreeRTOS_recv; + + /* Initialize MQTT library. */ + xReturn = MQTTAgent_Init( &xGlobalMqttAgentContext, + &messageInterface, + &xFixedBuffer, + &xTransport, + prvGetTimeMs, + prvIncomingPublishCallback, + /* Context to pass into the callback. Passing the pointer to subscription array. */ + xGlobalSubscriptionList ); + + return xReturn; +} + +static MQTTStatus_t prvMQTTConnect( bool xCleanSession ) +{ + MQTTStatus_t xResult; + MQTTConnectInfo_t xConnectInfo; + bool xSessionPresent = false; + + /* Many fields are not used in this demo so start with everything at 0. */ + memset( &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 = xCleanSession; + + /* 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 ); + + /* Set MQTT keep-alive period. It is the responsibility of the application + * to ensure that the interval between Control Packets being sent does not + * exceed the Keep Alive value. In the absence of sending any other Control + * Packets, the Client MUST send a PINGREQ Packet. This responsibility will + * be moved inside the agent. */ + xConnectInfo.keepAliveSeconds = otaexampleKEEP_ALIVE_INTERVAL_SECONDS; + + /* Append metrics when connecting to the AWS IoT Core broker. */ + #ifdef democonfigUSE_AWS_IOT_CORE_BROKER + #ifdef democonfigCLIENT_USERNAME + xConnectInfo.pUserName = CLIENT_USERNAME_WITH_METRICS; + xConnectInfo.userNameLength = ( uint16_t ) strlen( CLIENT_USERNAME_WITH_METRICS ); + xConnectInfo.pPassword = democonfigCLIENT_PASSWORD; + xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD ); + #else + xConnectInfo.pUserName = AWS_IOT_METRICS_STRING; + xConnectInfo.userNameLength = AWS_IOT_METRICS_STRING_LENGTH; + /* Password for authentication is not used. */ + xConnectInfo.pPassword = NULL; + xConnectInfo.passwordLength = 0U; + #endif + #else /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + #ifdef democonfigCLIENT_USERNAME + xConnectInfo.pUserName = democonfigCLIENT_USERNAME; + xConnectInfo.userNameLength = ( uint16_t ) strlen( democonfigCLIENT_USERNAME ); + xConnectInfo.pPassword = democonfigCLIENT_PASSWORD; + xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD ); + #endif /* ifdef democonfigCLIENT_USERNAME */ + #endif /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + + /* Send MQTT CONNECT packet to broker. MQTT's Last Will and Testament feature + * is not used in this demo, so it is passed as NULL. */ + xResult = MQTT_Connect( &( xGlobalMqttAgentContext.mqttContext ), + &xConnectInfo, + NULL, + otaexampleCONNACK_RECV_TIMEOUT_MS, + &xSessionPresent ); + + LogInfo( ( "Session present: %d\n", xSessionPresent ) ); + + /* Resume a session if desired. */ + if( ( xResult == MQTTSuccess ) && ( xCleanSession == false ) ) + { + xResult = MQTTAgent_ResumeSession( &xGlobalMqttAgentContext, xSessionPresent ); + + /* Resubscribe to all the subscribed topics. */ + if( ( xResult == MQTTSuccess ) && ( xSessionPresent == false ) ) + { + xResult = prvHandleResubscribe(); + } + } + + return xResult; +} + +static void prvConnectToMQTTBroker( void ) +{ + BaseType_t xNetworkStatus = pdFAIL; + MQTTStatus_t xMQTTStatus; + + /* Initialize network context. */ + xNetworkContextMqtt.pParams = &xTlsTransportParams; + + /* Connect a TCP socket to the broker. */ + xNetworkStatus = prvSocketConnect( &xNetworkContextMqtt ); + configASSERT( xNetworkStatus == pdPASS ); + + /* Initialize the MQTT context with the buffer and transport interface. */ + xMQTTStatus = prvMQTTInit(); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Form an MQTT connection without a persistent session. */ + xMQTTStatus = prvMQTTConnect( true ); + configASSERT( xMQTTStatus == MQTTSuccess ); +} + +static void prvDisconnectFromMQTTBroker( void ) +{ + MQTTAgentCommandContext_t xCommandContext = { 0 }; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTStatus_t xCommandStatus; + + /* Disconnect from broker. */ + LogInfo( ( "Disconnecting the MQTT connection with %s.", democonfigMQTT_BROKER_ENDPOINT ) ); + + xCommandParams.blockTimeMs = MQTT_AGENT_SEND_BLOCK_TIME_MS; + xCommandParams.cmdCompleteCallback = prvCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = &xCommandContext; + xCommandContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xCommandContext.pArgs = NULL; + xCommandContext.xReturnStatus = MQTTSendFailed; + + /* Disconnect MQTT session. */ + xCommandStatus = MQTTAgent_Disconnect( &xGlobalMqttAgentContext, &xCommandParams ); + configASSERT( xCommandStatus == MQTTSuccess ); + + xTaskNotifyWait( 0, + 0, + NULL, + pdMS_TO_TICKS( MQTT_AGENT_MS_TO_WAIT_FOR_NOTIFICATION ) ); + + /* End TLS session, then close TCP connection. */ + prvSocketDisconnect( &xNetworkContextMqtt ); +} + +static BaseType_t connectToS3Server(NetworkContext_t* pxNetworkContext, + const char* pcUrl) +{ + TlsTransportStatus_t xNetworkStatus; + NetworkCredentials_t xNetworkCredentials = { 0 }; + BaseType_t xStatus = pdFAIL; + HTTPStatus_t xHTTPStatus = HTTPSuccess; + + /* The location of the host address within the pre-signed URL. */ + const char* pcAddress = NULL; + + configASSERT(pxNetworkContext != NULL); + + /* Retrieve the address location and length from S3_PRESIGNED_GET_URL. */ + if (pcUrl != NULL) + { + /* Retrieve the address location and length from S3_PRESIGNED_GET_URL. */ + xHTTPStatus = getUrlAddress(pcUrl, + strlen(pcUrl), + &pcAddress, + &xServerHostLength); + + if (xHTTPStatus != HTTPSuccess) + { + LogError(("URL %s parsing failed. Error code: %d", + pcUrl, + xHTTPStatus)); + } + else + { + /* serverHost should consist only of the host address. */ + memcpy(acServerHost, pcAddress, xServerHostLength); + acServerHost[xServerHostLength] = '\0'; + } + + } + + if (xHTTPStatus == HTTPSuccess) + { + xNetworkCredentials.disableSni = democonfigDISABLE_SNI; + /* Set the credentials for establishing a TLS connection. */ + xNetworkCredentials.pRootCa = (const unsigned char*)democonfigHTTPS_ROOT_CA_PEM; + xNetworkCredentials.rootCaSize = sizeof(democonfigHTTPS_ROOT_CA_PEM); + + /* Establish a TLS session with the HTTP server. This example connects + * to the server host located in democonfigPRESIGNED_GET_URL and + * democonfigHTTPS_PORT in demo_config.h. */ + LogInfo(("Establishing a TLS session with %s:%d.", + acServerHost, + democonfigHTTPS_PORT)); + + /* Attempt to create a server-authenticated TLS connection. */ + xNetworkStatus = TLS_FreeRTOS_Connect(pxNetworkContext, + acServerHost, + democonfigHTTPS_PORT, + &xNetworkCredentials, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS); + + if (xNetworkStatus == TLS_TRANSPORT_SUCCESS) + { + xStatus = pdPASS; + } + } + + return xStatus; +} + +/*-----------------------------------------------------------*/ + +static OtaHttpStatus_t handleHttpResponse(const HTTPResponse_t* pResponse) +{ + /* Return error code. */ + OtaHttpStatus_t ret = OtaHttpRequestFailed; + + OtaEventData_t* pData; + OtaEventMsg_t eventMsg = { 0 }; + + switch (pResponse->statusCode) + { + case HTTP_RESPONSE_PARTIAL_CONTENT: + /* Get buffer to send event & data. */ + pData = prvOTAEventBufferGet(); + + if (pData != NULL) + { + /* Get the data from response buffer. */ + memcpy(pData->data, pResponse->pBody, pResponse->bodyLen); + pData->dataLength = pResponse->bodyLen; + + /* Send job document received event. */ + eventMsg.eventId = OtaAgentEventReceivedFileBlock; + eventMsg.pEventData = pData; + OTA_SignalEvent(&eventMsg); + + ret = OtaHttpSuccess; + } + else + { + LogError(("Error: No OTA data buffers available.")); + + ret = OtaHttpRequestFailed; + } + + break; + + case HTTP_RESPONSE_BAD_REQUEST: + case HTTP_RESPONSE_FORBIDDEN: + case HTTP_RESPONSE_NOT_FOUND: + /* Request the job document to get new url. */ + eventMsg.eventId = OtaAgentEventRequestJobDocument; + eventMsg.pEventData = NULL; + OTA_SignalEvent(&eventMsg); + + ret = OtaHttpSuccess; + break; + + default: + LogError(("Unhandled http response code: =%d.", + pResponse->statusCode)); + + ret = OtaHttpRequestFailed; + } + + return ret; +} + +static OtaHttpStatus_t httpInit(char* pUrl) +{ + /* OTA lib return error code. */ + OtaHttpStatus_t ret = OtaHttpSuccess; + + /* HTTPS Client library return status. */ + HTTPStatus_t httpStatus = HTTPSuccess; + + /* Return value from libraries. */ + BaseType_t xReturnStatus = pdFAIL; + + /* The length of the path within the pre-signed URL. This variable is + * defined in order to store the length returned from parsing the URL, but + * it is unused. The path used for the requests in this demo needs all the + * query information following the location of the object, to the end of the + * S3 presigned URL. */ + size_t xPathLen = 0; + + /* Establish HTTPs connection */ + LogInfo(("Performing TLS handshake on top of the TCP connection.")); + + xNetworkContextHttp.pParams = &xTlsTransportParamsHttps; + + /* Attempt to connect to the HTTPs server. If connection fails, retry after + * a timeout. Timeout value will be exponentially increased till the maximum + * attempts are reached or maximum timeout value is reached. The function + * returns EXIT_FAILURE if the TCP connection cannot be established to + * broker after configured number of attempts. */ + xReturnStatus = connectToS3Server(&xNetworkContextHttp, pUrl); + + if (xReturnStatus == pdPASS ) + { + /* Define the transport interface. */ + (void)memset(&xTransportInterfaceHttp, 0, sizeof(xTransportInterfaceHttp)); + /* Define the transport interface. */ + xTransportInterfaceHttp.pNetworkContext = &xNetworkContextHttp; + xTransportInterfaceHttp.send = TLS_FreeRTOS_send; + xTransportInterfaceHttp.recv = TLS_FreeRTOS_recv; + + /* Retrieve the path location from url. This + * function returns the length of the path without the query into + * pathLen, which is left unused in this demo. */ + httpStatus = getUrlPath(pUrl, + strlen(pUrl), + &pcPath, + &xPathLen); + + ret = (httpStatus == HTTPSuccess) ? OtaHttpSuccess : OtaHttpInitFailed; + } + else + { + /* Log an error to indicate connection failure after all + * reconnect attempts are over. */ + LogError(("Failed to connect to HTTP server %s.", + acServerHost)); + + ret = OtaHttpInitFailed; + } + + return ret; +} + +static OtaHttpStatus_t httpRequest(uint32_t rangeStart, + uint32_t rangeEnd) +{ + /* OTA lib return error code. */ + OtaHttpStatus_t ret = OtaHttpSuccess; + + /* Configurations of the initial request headers that are passed to + * #HTTPClient_InitializeRequestHeaders. */ + HTTPRequestInfo_t requestInfo; + /* Represents a response returned from an HTTP server. */ + HTTPResponse_t response; + /* Represents header data that will be sent in an HTTP request. */ + HTTPRequestHeaders_t requestHeaders; + + /* Return value of all methods from the HTTP Client library API. */ + HTTPStatus_t httpStatus = HTTPSuccess; + + /* Reconnection required flag. */ + bool reconnectRequired = false; + + /* Initialize all HTTP Client library API structs to 0. */ + (void)memset(&requestInfo, 0, sizeof(requestInfo)); + (void)memset(&response, 0, sizeof(response)); + (void)memset(&requestHeaders, 0, sizeof(requestHeaders)); + + /* Initialize the request object. */ + requestInfo.pHost = acServerHost; + requestInfo.hostLen = xServerHostLength; + requestInfo.pMethod = HTTP_METHOD_GET; + requestInfo.methodLen = sizeof(HTTP_METHOD_GET) - 1; + requestInfo.pPath = pcPath; + requestInfo.pathLen = strlen(pcPath); + + /* Set "Connection" HTTP header to "keep-alive" so that multiple requests + * can be sent over the same established TCP connection. */ + requestInfo.reqFlags = HTTP_REQUEST_KEEP_ALIVE_FLAG; + + /* Set the buffer used for storing request headers. */ + requestHeaders.pBuffer = aucHttpUserBuffer; + requestHeaders.bufferLen = HTTP_USER_BUFFER_LENGTH; + + httpStatus = HTTPClient_InitializeRequestHeaders(&requestHeaders, + &requestInfo); + + HTTPClient_AddRangeHeader(&requestHeaders, rangeStart, rangeEnd); + + if (httpStatus == HTTPSuccess) + { + /* Initialize the response object. The same buffer used for storing + * request headers is reused here. */ + response.pBuffer = aucHttpUserBuffer; + response.bufferLen = HTTP_USER_BUFFER_LENGTH; + + /* Send the request and receive the response. */ + httpStatus = HTTPClient_Send(&xTransportInterfaceHttp, + &requestHeaders, + NULL, + 0, + &response, + 0); + } + else + { + LogError(("Failed to initialize HTTP request headers: Error=%s.", + HTTPClient_strerror(httpStatus))); + } + + if (httpStatus != HTTPSuccess) + { + if ((httpStatus == HTTPNoResponse) || (httpStatus == HTTPNetworkError)) + { + reconnectRequired = true; + } + else + { + LogError(("HTTPClient_Send failed: Error=%s.", + HTTPClient_strerror(httpStatus))); + + ret = OtaHttpRequestFailed; + } + } + else + { + /* Check if reconnection required. */ + if (response.respFlags & HTTP_RESPONSE_CONNECTION_CLOSE_FLAG) + { + reconnectRequired = true; + } + + /* Handle the http response received. */ + ret = handleHttpResponse(&response); + } + + if (reconnectRequired == true) + { + /* End TLS session, then close TCP connection. */ + TLS_FreeRTOS_Disconnect(&xNetworkContextHttp); + + /* Try establishing connection to S3 server again. */ + if (connectToS3Server(&xNetworkContextHttp, NULL) == EXIT_SUCCESS) + { + ret = HTTPSuccess; + } + else + { + /* Log an error to indicate connection failure after all + * reconnect attempts are over. */ + LogError(("Failed to connect to HTTP server %s.", + acServerHost)); + + ret = OtaHttpRequestFailed; + } + } + + return ret; +} + +/*-----------------------------------------------------------*/ + +static OtaHttpStatus_t httpDeinit(void) +{ + OtaHttpStatus_t ret = OtaHttpSuccess; + + /* Nothing special to do here .*/ + + return ret; +} + +static OtaMqttStatus_t prvMQTTSubscribe(const char* pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS) +{ + MQTTStatus_t mqttStatus; + uint32_t ulNotifiedValue; + MQTTAgentSubscribeArgs_t xSubscribeArgs = { 0 }; + MQTTSubscribeInfo_t xSubscribeInfo = { 0 }; + BaseType_t result; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xApplicationDefinedContext = { 0 }; + OtaMqttStatus_t otaRet = OtaMqttSuccess; + + configASSERT(pTopicFilter != NULL); + configASSERT(topicFilterLength > 0); + + xSubscribeInfo.pTopicFilter = pTopicFilter; + xSubscribeInfo.topicFilterLength = topicFilterLength; + xSubscribeInfo.qos = ucQoS; + xSubscribeArgs.pSubscribeInfo = &xSubscribeInfo; + xSubscribeArgs.numSubscriptions = 1; + + xApplicationDefinedContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xApplicationDefinedContext.pArgs = &xSubscribeArgs; + xApplicationDefinedContext.xReturnStatus = MQTTSendFailed; + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvMQTTSubscribeCompleteCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xApplicationDefinedContext; + + xTaskNotifyStateClear(NULL); + + mqttStatus = MQTTAgent_Subscribe(&xGlobalMqttAgentContext, + &xSubscribeArgs, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, &ulNotifiedValue, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result == pdTRUE) + { + mqttStatus = xApplicationDefinedContext.xReturnStatus; + } + else + { + mqttStatus = MQTTRecvFailed; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to SUBSCRIBE to topic with error = %u.", + mqttStatus)); + + otaRet = OtaMqttSubscribeFailed; + } + else + { + LogInfo(("Subscribed to topic %.*s.\n\n", + topicFilterLength, + pTopicFilter)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + +static OtaMqttStatus_t prvMQTTPublish(const char* const pacTopic, + uint16_t topicLen, + const char* pMsg, + uint32_t msgSize, + uint8_t qos) +{ + OtaMqttStatus_t otaRet = OtaMqttSuccess; + BaseType_t result; + MQTTStatus_t mqttStatus = MQTTBadParameter; + MQTTPublishInfo_t publishInfo = { 0 }; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xCommandContext = { 0 }; + + publishInfo.pTopicName = pacTopic; + publishInfo.topicNameLength = topicLen; + publishInfo.qos = qos; + publishInfo.pPayload = pMsg; + publishInfo.payloadLength = msgSize; + + xCommandContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xTaskNotifyStateClear(NULL); + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xCommandContext; + + mqttStatus = MQTTAgent_Publish(&xGlobalMqttAgentContext, + &publishInfo, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, NULL, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result != pdTRUE) + { + mqttStatus = MQTTSendFailed; + } + else + { + mqttStatus = xCommandContext.xReturnStatus; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to send PUBLISH packet to broker with error = %u.", mqttStatus)); + otaRet = OtaMqttPublishFailed; + } + else + { + LogInfo(("Sent PUBLISH packet to broker %.*s to broker.\n\n", + topicLen, + pacTopic)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + +static OtaMqttStatus_t prvMQTTUnsubscribe(const char* pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS) +{ + MQTTStatus_t mqttStatus; + uint32_t ulNotifiedValue; + MQTTAgentSubscribeArgs_t xSubscribeArgs = { 0 }; + MQTTSubscribeInfo_t xSubscribeInfo = { 0 }; + BaseType_t result; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xApplicationDefinedContext = { 0 }; + OtaMqttStatus_t otaRet = OtaMqttSuccess; + + configASSERT(pTopicFilter != NULL); + configASSERT(topicFilterLength > 0); + + xSubscribeInfo.pTopicFilter = pTopicFilter; + xSubscribeInfo.topicFilterLength = topicFilterLength; + xSubscribeInfo.qos = ucQoS; + xSubscribeArgs.pSubscribeInfo = &xSubscribeInfo; + xSubscribeArgs.numSubscriptions = 1; + + + xApplicationDefinedContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvMQTTUnsubscribeCompleteCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xApplicationDefinedContext; + + LogInfo((" Unsubscribing to topic filter: %s", pTopicFilter)); + xTaskNotifyStateClear(NULL); + + + mqttStatus = MQTTAgent_Unsubscribe(&xGlobalMqttAgentContext, + &xSubscribeArgs, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, &ulNotifiedValue, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result == pdTRUE) + { + mqttStatus = xApplicationDefinedContext.xReturnStatus; + } + else + { + mqttStatus = MQTTRecvFailed; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to UNSUBSCRIBE from topic %.*s with error = %u.", + topicFilterLength, + pTopicFilter, + mqttStatus)); + + otaRet = OtaMqttUnsubscribeFailed; + } + else + { + LogInfo(("UNSUBSCRIBED from topic %.*s.\n\n", + topicFilterLength, + pTopicFilter)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + + + +/*-----------------------------------------------------------*/ + +static void setOtaInterfaces(OtaInterfaces_t* pOtaInterfaces) +{ + configASSERT(pOtaInterfaces != NULL); + + /* Initialize OTA library OS Interface. */ + pOtaInterfaces->os.event.init = OtaInitEvent_FreeRTOS; + pOtaInterfaces->os.event.send = OtaSendEvent_FreeRTOS; + pOtaInterfaces->os.event.recv = OtaReceiveEvent_FreeRTOS; + pOtaInterfaces->os.event.deinit = OtaDeinitEvent_FreeRTOS; + pOtaInterfaces->os.timer.start = OtaStartTimer_FreeRTOS; + pOtaInterfaces->os.timer.stop = OtaStopTimer_FreeRTOS; + pOtaInterfaces->os.timer.delete = OtaDeleteTimer_FreeRTOS; + pOtaInterfaces->os.mem.malloc = Malloc_FreeRTOS; + pOtaInterfaces->os.mem.free = Free_FreeRTOS; + + /* Initialize the OTA library MQTT Interface.*/ + pOtaInterfaces->mqtt.subscribe = prvMQTTSubscribe; + pOtaInterfaces->mqtt.publish = prvMQTTPublish; + pOtaInterfaces->mqtt.unsubscribe = prvMQTTUnsubscribe; + + /* Initialize the OTA library HTTP Interface.*/ + pOtaInterfaces->http.init = httpInit; + pOtaInterfaces->http.request = httpRequest; + pOtaInterfaces->http.deinit = httpDeinit; + + /* Initialize the OTA library PAL Interface.*/ + pOtaInterfaces->pal.getPlatformImageState = otaPal_GetPlatformImageState; + pOtaInterfaces->pal.setPlatformImageState = otaPal_SetPlatformImageState; + pOtaInterfaces->pal.writeBlock = otaPal_WriteBlock; + pOtaInterfaces->pal.activate = otaPal_ActivateNewImage; + pOtaInterfaces->pal.closeFile = otaPal_CloseFile; + pOtaInterfaces->pal.reset = otaPal_ResetDevice; + pOtaInterfaces->pal.abort = otaPal_Abort; + pOtaInterfaces->pal.createFile = otaPal_CreateFileForRx; +} + +/*-----------------------------------------------------------*/ + +static void prvOTAAgentTask(void* pParam) +{ + /* Calling OTA agent task. */ + OTA_EventProcessingTask(pParam); + LogInfo(("OTA Agent stopped.")); + + vTaskDelete(NULL); +} + +static void prvMQTTAgentTask(void* pParam) +{ + BaseType_t xResult = pdFAIL; + MQTTStatus_t xMQTTStatus = MQTTSuccess; + + (void)pParam; + + do + { + /* MQTTAgent_CommandLoop() is effectively the agent implementation. It + * will manage the MQTT protocol until such time that an error occurs, + * which could be a disconnect. If an error occurs the MQTT context on + * which the error happened is returned so there can be an attempt to + * clean up and reconnect however the application writer prefers. */ + xMQTTStatus = MQTTAgent_CommandLoop(&xGlobalMqttAgentContext); + + /* Clear Agent queue so that no any pending MQTT operations are processed. */ + xQueueReset(xCommandQueue.queue); + + /* Success is returned for application intiated disconnect or termination. The socket will also be disconnected by the caller. */ + if (xMQTTStatus != MQTTSuccess) + { + xResult = prvSuspendOTA(); + configASSERT(xResult == pdPASS); + + LogInfo(("Suspended OTA agent.")); + + /* End TLS session, then close TCP connection. */ + prvSocketDisconnect(&xNetworkContextMqtt); + + /* Connect to MQTT broker. */ + prvConnectToMQTTBroker(); + + xResult = prvResumeOTA(); + configASSERT(xResult == pdPASS); + + LogInfo(("Resumed OTA agent.")); + } + } while (xMQTTStatus != MQTTSuccess); + + vTaskDelete(NULL); +} + +static BaseType_t prvSuspendOTA(void) +{ + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + BaseType_t status = pdPASS; + uint32_t suspendTimeout; + + otaRet = OTA_Suspend(); + + if (otaRet == OtaErrNone) + { + suspendTimeout = OTA_SUSPEND_TIMEOUT_MS; + + while ((OTA_GetState() != OtaAgentStateSuspended) && (suspendTimeout > 0)) + { + /* Wait for OTA Library state to suspend */ + vTaskDelay(pdMS_TO_TICKS(otaexampleTASK_DELAY_MS)); + suspendTimeout -= otaexampleTASK_DELAY_MS; + } + + if (OTA_GetState() != OtaAgentStateSuspended) + { + LogError(("Failed to suspend OTA.")); + status = pdFAIL; + } + } + else + { + LogError(("Error while trying to suspend OTA agent %d", otaRet)); + status = pdFAIL; + } + + return status; +} + +static BaseType_t prvResumeOTA(void) +{ + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + BaseType_t status = pdPASS; + uint32_t suspendTimeout; + + otaRet = OTA_Resume(); + + if (otaRet == OtaErrNone) + { + suspendTimeout = OTA_SUSPEND_TIMEOUT_MS; + + while ((OTA_GetState() == OtaAgentStateSuspended) && (suspendTimeout > 0)) + { + /* Wait for OTA Library state to suspend */ + vTaskDelay(pdMS_TO_TICKS(otaexampleTASK_DELAY_MS)); + suspendTimeout -= otaexampleTASK_DELAY_MS; + } + + if (OTA_GetState() == OtaAgentStateSuspended) + { + LogError(("Failed to resume OTA.")); + status = pdFAIL; + } + } + else + { + LogError(("Error while trying to resume OTA agent %d", otaRet)); + status = pdFAIL; + } + + return status; +} + +static BaseType_t prvRunOTADemo( void ) +{ + /* Status indicating a successful demo or not. */ + BaseType_t xStatus = pdPASS; + + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + + /* OTA event message used for sending event to OTA Agent.*/ + OtaEventMsg_t eventMsg = { 0 }; + + /* OTA interface context required for library interface functions.*/ + OtaInterfaces_t otaInterfaces; + + /* OTA library packet statistics per job.*/ + OtaAgentStatistics_t otaStatistics = { 0 }; + + /* OTA Agent state returned from calling OTA_GetState.*/ + OtaState_t state = OtaAgentStateStopped; + + /* Set OTA Library interfaces.*/ + setOtaInterfaces( &otaInterfaces ); + + /****************************** Init OTA Library. ******************************/ + + if( xStatus == pdPASS ) + { + if( ( otaRet = OTA_Init( &otaBuffer, + &otaInterfaces, + ( const uint8_t * ) ( democonfigCLIENT_IDENTIFIER ), + otaAppCallback ) ) != OtaErrNone ) + { + LogError( ( "Failed to initialize OTA Agent, exiting = %u.", + otaRet ) ); + + xStatus = pdFAIL; + } + } + + /****************************** Create OTA Agent Task. ******************************/ + + if( xStatus == pdPASS ) + { + xStatus = xTaskCreate( prvOTAAgentTask, + "OTA Agent Task", + OTA_AGENT_TASK_STACK_SIZE, + NULL, + OTA_AGENT_TASK_PRIORITY, + NULL ); + + if( xStatus != pdPASS ) + { + LogError( ( "Failed to create OTA agent task:" ) ); + } + } + + /** + * Register a callback for receiving messages intended for OTA agent from broker, + * for which the topic has not been subscribed for. + */ + prvRegisterOTACallback( OTA_DEFAULT_TOPIC_FILTER, OTA_DEFAULT_TOPIC_FILTER_LENGTH ); + + /****************************** Start OTA ******************************/ + + if( xStatus == pdPASS ) + { + /* Send start event to OTA Agent.*/ + eventMsg.eventId = OtaAgentEventStart; + OTA_SignalEvent( &eventMsg ); + } + + /****************************** Loop and display OTA statistics ******************************/ + + if( xStatus == pdPASS ) + { + while( ( state = OTA_GetState() ) != OtaAgentStateStopped ) + { + /* Get OTA statistics for currently executing job. */ + if( state != OtaAgentStateSuspended ) + { + OTA_GetStatistics( &otaStatistics ); + + LogInfo( ( " Received: %u Queued: %u Processed: %u Dropped: %u", + otaStatistics.otaPacketsReceived, + otaStatistics.otaPacketsQueued, + otaStatistics.otaPacketsProcessed, + otaStatistics.otaPacketsDropped ) ); + } + + vTaskDelay( pdMS_TO_TICKS(otaexampleTASK_DELAY_MS) ); + } + } + + /** + * Remvove callback for receiving messages intended for OTA agent from broker, + * for which the topic has not been subscribed for. + */ + removeSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext, + OTA_DEFAULT_TOPIC_FILTER, + OTA_DEFAULT_TOPIC_FILTER_LENGTH ); + + return xStatus; +} + +/** + * @brief Entry point of Ota demo task. + * + * This example initializes the OTA library to enable OTA updates via the + * MQTT broker. It simply connects to the MQTT broker with the users + * credentials and spins in an indefinite loop to allow MQTT messages to be + * forwarded to the OTA agent for possible processing. The OTA agent does all + * of the real work; checking to see if the message topic is one destined for + * the OTA agent. If not, it is simply ignored. + * + */ +void vOtaDemoTask(void* pParam) +{ + (void)pParam; + + /* Return error status. */ + BaseType_t xReturnStatus = pdPASS; + + /* Flag for MQTT init status. */ + bool mqttInitialized = false; + + LogInfo( ( "OTA over MQTT demo, Application version %u.%u.%u", + appFirmwareVersion.u.x.major, + appFirmwareVersion.u.x.minor, + appFirmwareVersion.u.x.build ) ); + + /* Initialize semaphore for buffer operations. */ + xBufferSemaphore = xSemaphoreCreateMutex(); + + if( xBufferSemaphore == NULL ) + { + LogError( ( "Failed to initialize buffer semaphore." ) ); + xReturnStatus = pdFAIL; + } + + /****************************** Init MQTT ******************************/ + + if(xReturnStatus == pdPASS ) + { + /* Create the TCP connection to the broker, then the MQTT connection to the + * same. */ + prvConnectToMQTTBroker(); + } + + /****************************** Create MQTT Agent Task. ******************************/ + + if(xReturnStatus == pdPASS ) + { + if( xTaskCreate( prvMQTTAgentTask, + "MQTT Agent Task", + MQTT_AGENT_TASK_STACK_SIZE, + NULL, + MQTT_AGENT_TASK_PRIORITY, + NULL ) != pdPASS ) + { + xReturnStatus = pdFAIL; + LogError( ( "Failed to create MQTT agent task:" ) ); + } + } + + /****************************** Start OTA Demo. ******************************/ + + if(xReturnStatus == pdPASS) + { + /* Start OTA demo. The function returns only if OTA completes successfully and a + * shutdown of OTA is triggered for a manual restart of the device.*/ + if( prvRunOTADemo() != pdPASS ) + { + xReturnStatus = pdFAIL; + } + } + + /****************************** Cleanup ******************************/ + + if( mqttInitialized ) + { + prvDisconnectFromMQTTBroker(); + } + + if( xBufferSemaphore != NULL ) + { + /* Cleanup semaphore created for buffer operations. */ + vSemaphoreDelete( xBufferSemaphore ); + } +} + +/* + * @brief Create the task that demonstrates the Ota demo. + */ +void vStartOtaDemo(void) +{ + /* + * vOtaDemoTask() connects to the MQTT broker, creates the + * MQTT Agent task and calls the Ota demo loop prvRunOTADemo() + * which creates the OTA Agent task. + */ + + xTaskCreate(vOtaDemoTask, /* Function that implements the task. */ + "OTA Demo Task", /* Text name for the task - only used for debugging. */ + democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ + NULL, /* Optional - task parameter - not used in this case. */ + tskIDLE_PRIORITY + 1, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ + NULL); /* Optional - used to pass out a handle to the created task. */ +} diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSConfig.h new file mode 100644 index 000000000..30516ea96 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSConfig.h @@ -0,0 +1,210 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- +* Application specific definitions. +* +* These definitions should be adjusted for your particular hardware and +* application requirements. +* +* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE +* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. +* http://www.freertos.org/a00110.html +* +* The bottom of this file contains some constants specific to running the UDP +* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than +* the demo) are contained in FreeRTOSIPConfig.h. +*----------------------------------------------------------*/ +#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 + +/* This demo makes use of one or more example stats formatting functions. These + * format the raw data provided by the uxTaskGetSystemState() function in to human + * readable ASCII form. See the notes in the implementation of vTaskList() within + * FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS + * is set to 2 so the formatting functions are included without the stdio.h being + * included in tasks.c. That is because this project defines its own sprintf() + * functions. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Assert call defined for debug builds. */ +#ifdef _DEBUG + extern void vAssertCalled( const char * pcFile, + uint32_t ulLine ); + #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ ) +#endif /* _DEBUG */ + + + +/* Application specific definitions follow. **********************************/ + +/* 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 ( 5L ) + +/* 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 */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSIPConfig.h new file mode 100644 index 000000000..8fc154192 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/FreeRTOSIPConfig.h @@ -0,0 +1,310 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 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: + * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ +#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) + +/* ipconfigRAND32() is called by the IP stack to generate random numbers for + * things such as a DHCP transaction number or initial sequence number. Random + * number generation is performed via this macro to allow applications to use their + * own random number generation method. For example, it might be possible to + * generate a random number by sampling noise on an analogue input. */ +extern UBaseType_t uxRand(); +#define ipconfigRAND32() uxRand() + +/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the + * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK + * is not set to 1 then the network event hook will never be called. See + * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml + */ +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 + +/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but + * a network buffer cannot be obtained then the calling task is held in the Blocked + * state (so other tasks can continue to executed) until either a network buffer + * becomes available or the send block time expires. If the send block time expires + * then the send operation is aborted. The maximum allowable send block time is + * capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the + * maximum allowable send block time prevents 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 */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj new file mode 100644 index 000000000..a0b3d365f --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj @@ -0,0 +1,677 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid> + <ProjectName>RTOSDemo</ProjectName> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName> + <HeaderFileName> + </HeaderFileName> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging;..\..\..\Common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls;..\..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\..\Source\mbedtls_utils;..\..\..\..\ThirdParty\mbedtls\include;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Ota_Over_Http_Demo;..\..\..\..\..\FreeRTOS-Plus\Demo\Common\coreMQTT_Agent_Interface\include;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\include;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\subscription-manager;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\portable\os;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\Ota_PAL\Win32;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src;..\..\..\..\Source\Application-Protocols\coreHTTP\source\include;..\..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\..\..\\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\Ota_PAL\Win32\Code_Signature_Verification;C:\work\otaltsintegration\testing\FreeRTOS\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\HTTP_Utils;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <AdditionalOptions>/wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions)</AdditionalOptions> + <BrowseInformation>true</BrowseInformation> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <ExceptionHandling>false</ExceptionHandling> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0c09</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/RTOSDemo.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalDependencies>wpcap.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\Common\WinPCap</AdditionalLibraryDirectories> + <Profile>false</Profile> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/WIN32.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName> + <HeaderFileName> + </HeaderFileName> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\..\..\Source\include;..\..\..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0c09</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/RTOSDemo.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories> + <AdditionalDependencies>wpcap.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/WIN32.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\event_groups.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\list.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\queue.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\stream_buffer.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\tasks.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\timers.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\core_http_client.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser\http_parser.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent_command_functions.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder_close_container_checked.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborerrorstrings.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser_dup_string.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty_stdio.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborvalidation.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_base64.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_cbor.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_http.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_interface.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_mqtt.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_freertos_port.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.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\coreMQTT\source\core_mqtt.c" /> + <ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c" /> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aes.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aesni.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\arc4.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aria.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1parse.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1write.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\base64.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\bignum.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\blowfish.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\camellia.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ccm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\certs.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chacha20.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chachapoly.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher_wrap.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cmac.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ctr_drbg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\debug.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\des.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\dhm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdh.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdsa.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecjpake.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp_curves.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy_poll.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\error.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\gcm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\havege.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hkdf.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hmac_drbg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md2.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md4.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md5.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\memory_buffer_alloc.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\net_sockets.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\nist_kw.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\oid.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\padlock.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pem.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs11.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs12.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs5.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkparse.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkwrite.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk_wrap.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform_util.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\poly1305.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ripemd160.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa_internal.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha1.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha256.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha512.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cache.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ciphersuites.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cli.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cookie.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_msg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_srv.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ticket.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_tls.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\threading.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\timing.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version_features.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_crt.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_csr.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_create.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crl.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crt.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_csr.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\xtea.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Demo\Common\Logging\windows\Logging_WinSim.c" /> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_agent_message.c" /> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_command_pool.c" /> + <ClCompile Include="..\Common\HTTP_Utils\http_demo_utils.c" /> + <ClCompile Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification_mbedtls.c" /> + <ClCompile Include="..\Common\Ota_PAL\Win32\ota_pal.c" /> + <ClCompile Include="..\Common\subscription-manager\subscription_manager.c" /> + <ClCompile Include="DemoTasks\OtaOverHttpDemoExample.c" /> + <ClCompile Include="main.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\event_groups.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\FreeRTOS.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\portable.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\projdefs.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\queue.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\semphr.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\task.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\timers.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DNS.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP_Private.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Sockets.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Stream_Buffer.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_WIN.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_UDP_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_levels.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_stack.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser\http_parser.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_client.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_client_private.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_config_defaults.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_command_functions.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_message_interface.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cbor.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborinternal_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborjson.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\compilersupport_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\tinycbor-version.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\utf8_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_appversion32.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_base64_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_cbor_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_config_defaults.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_interface_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_os_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_platform_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.h" /> + <ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h" /> + <ClInclude Include="..\..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_errno_TCP.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\threading_alt.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.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\include\core_mqtt.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aes.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aesni.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\arc4.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aria.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1write.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\base64.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bignum.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\blowfish.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bn_mul.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\camellia.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ccm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\certs.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chacha20.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chachapoly.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\check_config.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cmac.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\compat-1.3.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\config.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ctr_drbg.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\debug.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\des.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\dhm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdh.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdsa.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecjpake.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy_poll.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\error.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\gcm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\havege.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hkdf.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hmac_drbg.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md2.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md4.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md5.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\memory_buffer_alloc.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net_sockets.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\nist_kw.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\oid.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\padlock.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pem.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs11.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs12.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs5.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_time.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_util.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\poly1305.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\psa_util.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ripemd160.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha1.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha256.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha512.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cache.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ciphersuites.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cookie.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ticket.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\threading.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\timing.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\version.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crl.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crt.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_csr.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\xtea.h" /> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_agent_message.h" /> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_command_pool.h" /> + <ClInclude Include="..\Common\HTTP_Utils\http_demo_utils.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\aws_ota_codesigner_certificate.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\ota_pal.h" /> + <ClInclude Include="..\Common\subscription-manager\subscription_manager.h" /> + <ClInclude Include="core_http_config.h" /> + <ClInclude Include="mbedtls_config.h" /> + <ClInclude Include="demo_config.h" /> + <ClInclude Include="FreeRTOSConfig.h" /> + <ClInclude Include="FreeRTOSIPConfig.h" /> + <ClInclude Include="core_mqtt_config.h" /> + <ClInclude Include="ota_config.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj.filters new file mode 100644 index 000000000..5a7bc1cee --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/WIN32.vcxproj.filters @@ -0,0 +1,1028 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="FreeRTOS"> + <UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS\Source"> + <UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier> + <Extensions>*.c</Extensions> + </Filter> + <Filter Include="FreeRTOS\Source\Portable"> + <UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+"> + <UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS\Source\include"> + <UniqueIdentifier>{d2dcd641-8d91-492b-852f-5563ffadaec6}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP"> + <UniqueIdentifier>{8672fa26-b119-481f-8b8d-086419c01a3e}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP\portable"> + <UniqueIdentifier>{4570be11-ec96-4b55-ac58-24b50ada980a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP\include"> + <UniqueIdentifier>{5d93ed51-023a-41ad-9243-8d230165d34b}</UniqueIdentifier> + </Filter> + <Filter Include="DemoTasks"> + <UniqueIdentifier>{b71e974a-9f28-4815-972b-d930ba8a34d0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries"> + <UniqueIdentifier>{60717407-397f-4ea5-8492-3314acdd25f0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard"> + <UniqueIdentifier>{8a90222f-d723-4b4e-8e6e-c57afaf7fa92}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT"> + <UniqueIdentifier>{2d17d5e6-ed70-4e42-9693-f7a63baf4948}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include"> + <UniqueIdentifier>{6ad56e6d-c330-4830-8f4b-c75b05dfa866}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform"> + <UniqueIdentifier>{84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls"> + <UniqueIdentifier>{7bedd2e3-adbb-4c95-9632-445132b459ce}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls\include"> + <UniqueIdentifier>{07a14673-4d02-4780-a099-6b8c654dff91}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls\library"> + <UniqueIdentifier>{e875c5e3-40a2-4408-941e-5e1a951cc663}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls"> + <UniqueIdentifier>{8a0aa896-6b3a-49b3-997e-681f0d1949ae}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport"> + <UniqueIdentifier>{c5a01679-3e7a-4320-97ac-ee5b872c1650}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include"> + <UniqueIdentifier>{c992824d-4198-46b2-8d59-5f99ab9946ab}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport"> + <UniqueIdentifier>{6a35782c-bc09-42d5-a850-98bcb668a4dc}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON"> + <UniqueIdentifier>{20aee693-d2dc-480e-ae21-0db2156e54ac}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS"> + <UniqueIdentifier>{0dacb84e-5cc3-4eed-8fb1-68b6e4741f77}</UniqueIdentifier> + </Filter> + <Filter Include="Config"> + <UniqueIdentifier>{d286fe5f-3c24-4a2f-881c-4b458623648d}</UniqueIdentifier> + </Filter> + <Filter Include="Logging"> + <UniqueIdentifier>{c8b7bd64-7a0e-458b-bcaa-8081806e4508}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include"> + <UniqueIdentifier>{6c6bc472-3f73-42c1-83e0-ffe6cae93393}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm"> + <UniqueIdentifier>{fcf93295-15e2-4a84-a5e9-b3c162e9f061}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include"> + <UniqueIdentifier>{7de8717e-b494-4eba-ba10-bc8252d9876a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota"> + <UniqueIdentifier>{3cce55b5-995f-476c-a3a5-9c659a977c89}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include"> + <UniqueIdentifier>{d6ca6595-6585-4fd8-b0dd-224128fbd230}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent"> + <UniqueIdentifier>{044f1490-9d76-41d8-9887-94f5e89cab11}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include"> + <UniqueIdentifier>{28ef5930-f7c7-44f3-9189-749dcdf13cdd}</UniqueIdentifier> + </Filter> + <Filter Include="subscription-manager"> + <UniqueIdentifier>{0025af31-a87a-438e-86fd-8048c9f98025}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable"> + <UniqueIdentifier>{e7b017ae-316c-4d8b-b427-5df150109d0f}</UniqueIdentifier> + </Filter> + <Filter Include="otapal"> + <UniqueIdentifier>{0d8ed7df-8ac2-4ac0-ba27-ca59624bf363}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\tinycbor"> + <UniqueIdentifier>{b43eb5ed-8c56-41eb-a67a-4ce41403629e}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\tinycbor\include"> + <UniqueIdentifier>{4650e6af-01d5-46c3-9674-8554dab982ac}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface"> + <UniqueIdentifier>{e3a23704-31ed-4869-b74e-6d09f842b336}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include"> + <UniqueIdentifier>{b5277e13-3a7f-46ab-a73d-7a8aa2831f98}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP"> + <UniqueIdentifier>{6886c3ff-2cf3-4391-827f-6032c74396e7}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include"> + <UniqueIdentifier>{479f3dc4-b697-4e74-be3e-60c8f84a1e30}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\httpparser"> + <UniqueIdentifier>{f076f8c1-267c-445c-8b4e-432cac57c90e}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\httpparser\include"> + <UniqueIdentifier>{407f38e3-f238-4922-9442-ac843d507077}</UniqueIdentifier> + </Filter> + <Filter Include="http-utils"> + <UniqueIdentifier>{d0d4cb81-9ea9-4235-b30c-c112777f0eda}</UniqueIdentifier> + </Filter> + <Filter Include="http-utils\include"> + <UniqueIdentifier>{48067e94-989e-4056-a173-39b35e17a13f}</UniqueIdentifier> + </Filter> + <Filter Include="otapal\code_signature_verification"> + <UniqueIdentifier>{8f0251d7-49ee-43d9-93a9-acedfe4f7152}</UniqueIdentifier> + </Filter> + <Filter Include="otapal\code_signature_verification\include"> + <UniqueIdentifier>{cc758a0a-4533-4cb6-8854-43f3e7f632ca}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c"> + <Filter>FreeRTOS\Source\Portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\timers.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\list.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\queue.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\tasks.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\event_groups.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c"> + <Filter>FreeRTOS\Source\Portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\stream_buffer.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_freertos_port.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aes.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aesni.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\arc4.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aria.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1parse.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1write.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\base64.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\bignum.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\blowfish.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\camellia.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ccm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\certs.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chacha20.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chachapoly.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher_wrap.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cmac.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ctr_drbg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\debug.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\des.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\dhm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdh.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdsa.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecjpake.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp_curves.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy_poll.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\error.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\gcm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\havege.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hkdf.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hmac_drbg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md2.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md4.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md5.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\memory_buffer_alloc.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\net_sockets.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\nist_kw.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\oid.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\padlock.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pem.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs11.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs12.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs5.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkparse.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkwrite.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk_wrap.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform_util.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\poly1305.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ripemd160.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa_internal.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha1.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha256.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha512.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cache.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ciphersuites.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cli.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cookie.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_msg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_srv.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ticket.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_tls.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\threading.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\timing.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version_features.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_crt.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_csr.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_create.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crl.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crt.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_csr.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\xtea.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON</Filter> + </ClCompile> + <ClCompile Include="main.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Demo\Common\Logging\windows\Logging_WinSim.c"> + <Filter>Logging</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_base64.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_cbor.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_http.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_interface.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_mqtt.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter> + </ClCompile> + <ClCompile Include="..\Common\Ota_PAL\Win32\ota_pal.c"> + <Filter>otapal</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder_close_container_checked.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborerrorstrings.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser_dup_string.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty_stdio.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborvalidation.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_agent_message.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_command_pool.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClCompile> + <ClCompile Include="..\Common\subscription-manager\subscription_manager.c"> + <Filter>subscription-manager</Filter> + </ClCompile> + <ClCompile Include="DemoTasks\OtaOverHttpDemoExample.c"> + <Filter>DemoTasks</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\core_http_client.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser\http_parser.c"> + <Filter>FreeRTOS+\httpparser</Filter> + </ClCompile> + <ClCompile Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification_mbedtls.c"> + <Filter>otapal\code_signature_verification</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent_command_functions.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter> + </ClCompile> + <ClCompile Include="..\Common\HTTP_Utils\http_demo_utils.c"> + <Filter>http-utils</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DNS.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Sockets.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_UDP_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\timers.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\event_groups.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\FreeRTOS.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\queue.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\semphr.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\task.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP_Private.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_WIN.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Stream_Buffer.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\portable.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\projdefs.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\threading_alt.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aes.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aesni.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\arc4.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aria.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1write.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\base64.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bignum.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\blowfish.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bn_mul.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\camellia.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ccm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\certs.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chacha20.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chachapoly.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\check_config.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cmac.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\compat-1.3.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\config.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ctr_drbg.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\debug.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\des.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\dhm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdh.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdsa.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecjpake.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy_poll.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\error.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\gcm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\havege.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hkdf.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hmac_drbg.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md2.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md4.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md5.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\memory_buffer_alloc.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net_sockets.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\nist_kw.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\oid.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\padlock.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pem.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs11.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs12.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs5.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_time.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_util.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\poly1305.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\psa_util.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ripemd160.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha1.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha256.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha512.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cache.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ciphersuites.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cookie.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ticket.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\threading.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\timing.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\version.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crl.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crt.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_csr.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\xtea.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="core_mqtt_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="FreeRTOSConfig.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="demo_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="FreeRTOSIPConfig.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_levels.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_stack.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="mbedtls_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_errno_TCP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_appversion32.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_base64_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_cbor_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_config_defaults.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_interface_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_os_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_platform_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="ota_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\ota_pal.h"> + <Filter>otapal</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cbor.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborinternal_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborjson.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\compilersupport_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\tinycbor-version.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\utf8_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_agent_message.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_command_pool.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\subscription-manager\subscription_manager.h"> + <Filter>subscription-manager</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_client.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_client_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\include\core_http_config_defaults.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include</Filter> + </ClInclude> + <ClInclude Include="core_http_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser\http_parser.h"> + <Filter>FreeRTOS+\httpparser\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification.h"> + <Filter>otapal\code_signature_verification\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_command_functions.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_message_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\HTTP_Utils\http_demo_utils.h"> + <Filter>http-utils\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\aws_ota_codesigner_certificate.h"> + <Filter>otapal\code_signature_verification\include</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_http_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_http_config.h new file mode 100644 index 000000000..326bc7e3a --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_http_config.h @@ -0,0 +1,57 @@ +/* + * FreeRTOS V202012.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 CORE_HTTP_CONFIG_H_ +#define CORE_HTTP_CONFIG_H_ + +/**************************************************/ +/******* DO NOT CHANGE the following order ********/ +/**************************************************/ + +/* Logging config definition and header files inclusion are required 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 HTTP. + * 3. Include the header file "logging_stack.h", if logging is enabled for HTTP. + */ + +#include "logging_levels.h" + +/* Logging configuration for the HTTP library. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "HTTP" +#endif + +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#endif + +#include "logging_stack.h" + + +/************ End of logging configuration ****************/ + +#endif /* ifndef CORE_HTTP_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_mqtt_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_mqtt_config.h new file mode 100644 index 000000000..f4d8df3cc --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_mqtt_config.h @@ -0,0 +1,109 @@ +/* + * FreeRTOS V202012.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 CORE_MQTT_CONFIG_H +#define CORE_MQTT_CONFIG_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 MQTT. + * 3. Include the header file "logging_stack.h", if logging is enabled for MQTT. + */ + +#include "logging_levels.h" + +/* Logging configuration for the MQTT library. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "MQTT" +#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 ****************/ + +/** + * @brief The maximum number of MQTT PUBLISH messages that may be pending + * acknowledgement at any time. + * + * QoS 1 and 2 MQTT PUBLISHes require acknowledgment from the server before + * they can be completed. While they are awaiting the acknowledgment, the + * client must maintain information about their state. The value of this + * macro sets the limit on how many simultaneous PUBLISH states an MQTT + * context maintains. + */ +#define MQTT_STATE_ARRAY_MAX_COUNT 10U + + /*********************** coreMQTT Agent Configurations **********************/ + /** + * @brief The maximum number of pending acknowledgments to track for a single + * connection. + * + * @note The MQTT agent tracks MQTT commands (such as PUBLISH and SUBSCRIBE) th + * at are still waiting to be acknowledged. MQTT_AGENT_MAX_OUTSTANDING_ACKS set + * the maximum number of acknowledgments that can be outstanding at any one time. + * The higher this number is the greater the agent's RAM consumption will be. + */ +#define MQTT_AGENT_MAX_OUTSTANDING_ACKS ( 20U ) + + /** + * @brief Time in MS that the MQTT agent task will wait in the Blocked state (so + * not using any CPU time) for a command to arrive in its command queue before + * exiting the blocked state so it can call MQTT_ProcessLoop(). + * + * @note It is important MQTT_ProcessLoop() is called often if there is known + * MQTT traffic, but calling it too often can take processing time away from + * lower priority tasks and waste CPU time and power. + */ +#define MQTT_AGENT_MAX_EVENT_QUEUE_WAIT_TIME ( 1000 ) + + /** + * @brief The number of command structures to allocate in the pool + * for the agent. + */ +#define MQTT_COMMAND_CONTEXTS_POOL_SIZE 10 + + +#endif /* ifndef CORE_MQTT_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_pkcs11_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_pkcs11_config.h new file mode 100644 index 000000000..54906f452 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/core_pkcs11_config.h @@ -0,0 +1,187 @@ +/* + * FreeRTOS V202012.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" + +/** + * @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 32 + +/** + * @brief Maximum number of token objects that can be stored + * by the PKCS #11 module. + */ +#define pkcs11configMAX_NUM_OBJECTS 6 + +/** + * @brief Maximum number of sessions that can be stored + * by the PKCS #11 module. + */ +#define pkcs11configMAX_SESSIONS 10 + +/** + * @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 0 + +/** + * @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 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 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_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/demo_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/demo_config.h new file mode 100644 index 000000000..42ed79ed8 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/demo_config.h @@ -0,0 +1,462 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef DEMO_CONFIG_H +#define DEMO_CONFIG_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 DEMO. + * 3. Include the header file "logging_stack.h", if logging is enabled for DEMO. + */ + +#include "logging_levels.h" + +/* Logging configuration for the Demo. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "OTADemo" +#endif + +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_DEBUG +#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 ****************/ + +/** + * @brief The version for the firmware which is running. OTA agent uses this + * version number to perform anti-rollback validation. The firmware version for the + * download image should be higher than the current version, otherwise the new image is + * rejected in self test phase. + */ +#define APP_VERSION_MAJOR 0 +#define APP_VERSION_MINOR 9 +#define APP_VERSION_BUILD 2 + +/** + * @brief The MQTT client identifier used in this example. Each client identifier + * must be unique so edit as required to ensure no two clients connecting to the + * same broker use the same client identifier. + * + *!!! Please note a #defined constant is used for convenience of demonstration + *!!! only. Production devices can use something unique to the device that can + *!!! be read by software, such as a production serial number, instead of a + *!!! hard coded constant. + * + */ +#define democonfigCLIENT_IDENTIFIER "...insert here..." + +/** + * @brief Endpoint of the MQTT broker to connect to. + * + * This demo application can be run with any MQTT broker, although it is + * recommended to use one that supports mutual authentication. If mutual + * authentication is not used, then #democonfigUSE_TLS should be set to 0. + * + * For AWS IoT MQTT broker, this is the Thing's REST API Endpoint. + * + * @note Your AWS IoT Core endpoint can be found in the AWS IoT console under + * Settings/Custom Endpoint, or using the describe-endpoint REST API (with + * AWS CLI command line tool). + * + */ +#define democonfigMQTT_BROKER_ENDPOINT "...insert here..." + +/** + * @brief The port to use for the demo. + * + * In general, port 8883 is for secured MQTT connections, and port 1883 if not + * using TLS. + * + * @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol + * name. Using ALPN with this demo would require additional changes, including + * setting the `pAlpnProtos` member of the `NetworkCredentials_t` struct before + * forming the TLS connection. When using port 8883, ALPN is not required. + * + * #define democonfigMQTT_BROKER_PORT ( insert here. ) + */ +#define democonfigMQTT_BROKER_PORT ( 8883 ) + +/** + * @brief Server's root CA certificate. + * + * For AWS IoT MQTT broker, this certificate is used to identify the AWS IoT + * server and is publicly available. Refer to the AWS documentation available + * in the link below. + * https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs + * + * @note This certificate should be PEM-encoded. + * + * @note If you would like to setup an MQTT broker for running this demo, + * please see `mqtt_broker_setup.txt`. + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n"\ + * "...base64 data...\n"\ + * "-----END CERTIFICATE-----\n" + * + * #define democonfigROOT_CA_PEM "...insert here..." + */ + + +/** + * @brief Client certificate. + * + * For AWS IoT MQTT broker, refer to the AWS documentation below for details + * regarding client authentication. + * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html + * + * @note This certificate should be PEM-encoded. + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n"\ + * "...base64 data...\n"\ + * "-----END CERTIFICATE-----\n" + * + * #define democonfigCLIENT_CERTIFICATE_PEM "...insert here..." + */ + + +/** + * @brief Client's private key. + * + *!!! Please note pasting a key into the header file in this manner is for + *!!! convenience of demonstration only and should not be done in production. + *!!! Never paste a production private key here!. Production devices should + *!!! store keys securely, such as within a secure element. Additionally, + *!!! we provide the corePKCS library that further enhances security by + *!!! enabling securely stored keys to be used without exposing them to + *!!! software. + * + * For AWS IoT MQTT broker, refer to the AWS documentation below for details + * regarding clientauthentication. + * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html + * + * @note This private key should be PEM-encoded. + * + * Must include the PEM header and footer: + * "-----BEGIN RSA PRIVATE KEY-----\n"\ + * "...base64 data...\n"\ + * "-----END RSA PRIVATE KEY-----\n" + * + * #define democonfigCLIENT_PRIVATE_KEY_PEM "...insert here..." + */ + +/* + * @brief Server's root CA certificate for TLS authentication with S3. + * + * The Baltimore Cybertrust Root CA Certificate is defined below. + * + * @note This certificate should be PEM-encoded. + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n"\ + * "...base64 data...\n"\ + * "-----END CERTIFICATE-----\n" + * + */ + +#ifndef democonfigHTTPS_ROOT_CA_PEM + #define democonfigHTTPS_ROOT_CA_PEM \ + "-----BEGIN CERTIFICATE-----\n" \ + "MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ\n" \ + "RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD\n" \ + "VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX\n" \ + "DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y\n" \ + "ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy\n" \ + "VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr\n" \ + "mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr\n" \ + "IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK\n" \ + "mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu\n" \ + "XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy\n" \ + "dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye\n" \ + "jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1\n" \ + "BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3\n" \ + "DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92\n" \ + "9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx\n" \ + "jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0\n" \ + "Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz\n" \ + "ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS\n" \ + "R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp\n" \ + "-----END CERTIFICATE-----\n" +#endif /* ifndef democonfigHTTPS_ROOT_CA_PEM */ + + /** + * @brief AWS IoT Core server port number for HTTPS connections. + * + * For this demo, an X.509 certificate is used to verify the client. + * + * @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol + * name being x-amzn-http-ca. When using port 8443, ALPN is not required. + */ +#define democonfigHTTPS_PORT 443 + +/** + * @brief An option to disable Server Name Indication. + * + * @note When using a local Mosquitto server setup, SNI needs to be disabled + * for an MQTT broker that only has an IP address but no hostname. However, + * SNI should be enabled whenever possible. + */ +#define democonfigDISABLE_SNI ( pdFALSE ) + +/** + * @brief Configuration that indicates if the demo connection is made to the AWS IoT Core MQTT broker. + * + * If username/password based authentication is used, the demo will use appropriate TLS ALPN and + * SNI configurations as required for the Custom Authentication feature of AWS IoT. + * For more information, refer to the following documentation: + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html#custom-auth-mqtt + * + * #define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 ) + */ +#define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 ) + +/** + * @brief The username value for authenticating client to the MQTT broker when + * username/password based client authentication is used. + * + * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for + * details regarding client authentication with a username and password. + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html + * An authorizer setup needs to be done, as mentioned in the above link, to use + * username/password based client authentication. + * + * #define democonfigCLIENT_USERNAME "...insert here..." + */ + +/** + * @brief The password value for authenticating client to the MQTT broker when + * username/password based client authentication is used. + * + * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for + * details regarding client authentication with a username and password. + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html + * An authorizer setup needs to be done, as mentioned in the above link, to use + * username/password based client authentication. + * + * #define democonfigCLIENT_PASSWORD "...insert here..." + */ + +/** + * @brief The name of the operating system that the application is running on. + * The current value is given as an example. Please update for your specific + * operating system. + */ +#define democonfigOS_NAME "FreeRTOS" + +/** + * @brief The version of the operating system that the application is running + * on. The current value is given as an example. Please update for your specific + * operating system version. + */ +#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER + +/** + * @brief The name of the hardware platform the application is running on. The + * current value is given as an example. Please update for your specific + * hardware platform. + */ +#define democonfigHARDWARE_PLATFORM_NAME "WinSim" + +/** + * @brief The name of the MQTT library used and its version, following an "@" + * symbol. + */ +#define democonfigMQTT_LIB "core-mqtt@1.0.0" + +/** + * @brief Whether to use mutual authentication. If this macro is not set to 1 + * or not defined, then plaintext TCP will be used instead of TLS over TCP. + */ +#define democonfigUSE_TLS 1 + +/** + * @brief Set the stack size of the main demo task. + * + * In the Windows port, this stack only holds a structure. The actual + * stack is created by an operating system thread. + */ +#define democonfigDEMO_STACKSIZE configMINIMAL_STACK_SIZE + +/********************************************************************************** +* Error checks and derived values only below here - do not edit below here. -----* +**********************************************************************************/ + + +/* Compile time error for some undefined configs, and provide default values + * for others. */ +#ifndef democonfigMQTT_BROKER_ENDPOINT + #error "Please define democonfigMQTT_BROKER_ENDPOINT in demo_config.h." +#endif + +#ifndef democonfigCLIENT_IDENTIFIER + +/** + * @brief The MQTT client identifier used in this example. Each client identifier + * must be unique so edit as required to ensure no two clients connecting to the + * same broker use the same client identifier. Using a #define is for convenience + * of demonstration only - production devices should use something unique to the + * device that can be read from software - such as a production serial number. + */ + #error "Please define democonfigCLIENT_IDENTIFIER in demo_config.h to something unique for this device." +#endif + + +#if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) + #ifndef democonfigROOT_CA_PEM + #error "Please define Root CA certificate of the MQTT broker(democonfigROOT_CA_PEM) in demo_config.h." + #endif + +/* If no username is defined, then a client certificate/key is required. */ + #ifndef democonfigCLIENT_USERNAME + +/* + *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for + *!!! convenience of demonstration only. Production devices should + *!!! store keys securely, such as within a secure element. + */ + + #ifndef democonfigCLIENT_CERTIFICATE_PEM + #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." + #endif + #ifndef democonfigCLIENT_PRIVATE_KEY_PEM + #error "Please define client private key(democonfigCLIENT_PRIVATE_KEY_PEM) in demo_config.h." + #endif + #else + +/* If a username is defined, a client password also would need to be defined for + * client authentication. */ + #ifndef democonfigCLIENT_PASSWORD + #error "Please define client password(democonfigCLIENT_PASSWORD) in demo_config.h for client authentication based on username/password." + #endif + +/* AWS IoT MQTT broker port needs to be 443 for client authentication based on + * username/password. */ + #if defined( democonfigUSE_AWS_IOT_CORE_BROKER ) && democonfigMQTT_BROKER_PORT != 443 + #error "Broker port(democonfigMQTT_BROKER_PORT) should be defined as 443 in demo_config.h for client authentication based on username/password in AWS IoT Core." + #endif + #endif /* ifndef democonfigCLIENT_USERNAME */ + + #ifndef democonfigMQTT_BROKER_PORT + #define democonfigMQTT_BROKER_PORT ( 8883 ) + #endif +#else /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */ + #ifndef democonfigMQTT_BROKER_PORT + #define democonfigMQTT_BROKER_PORT ( 1883 ) + #endif +#endif /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */ + +/** + * @brief ALPN (Application-Layer Protocol Negotiation) protocol name for AWS IoT MQTT. + * + * This will be used if democonfigMQTT_BROKER_PORT is configured as 443 for the AWS IoT MQTT broker. + * Please see more details about the ALPN protocol for AWS IoT MQTT endpoint + * in the link below. + * https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/ + */ +#define AWS_IOT_MQTT_ALPN "\x0ex-amzn-mqtt-ca" + +/** + * @brief This is the ALPN (Application-Layer Protocol Negotiation) string + * required by AWS IoT for password-based authentication using TCP port 443. + */ +#define AWS_IOT_CUSTOM_AUTH_ALPN "\x04mqtt" + +/** + * Provide default values for undefined configuration settings. + */ +#ifndef democonfigOS_NAME + #define democonfigOS_NAME "FreeRTOS" +#endif + +#ifndef democonfigOS_VERSION + #define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER +#endif + +#ifndef democonfigHARDWARE_PLATFORM_NAME + #define democonfigHARDWARE_PLATFORM_NAME "WinSim" +#endif + +#ifndef democonfigMQTT_LIB + #define democonfigMQTT_LIB "core-mqtt@1.0.0" +#endif + +/** + * @brief The MQTT metrics string expected by AWS IoT. + */ +#define AWS_IOT_METRICS_STRING \ + "?SDK=" democonfigOS_NAME "&Version=" democonfigOS_VERSION \ + "&Platform=" democonfigHARDWARE_PLATFORM_NAME "&MQTTLib=" democonfigMQTT_LIB + +/** + * @brief The length of the MQTT metrics string expected by AWS IoT. + */ +#define AWS_IOT_METRICS_STRING_LENGTH ( ( uint16_t ) ( sizeof( AWS_IOT_METRICS_STRING ) - 1 ) ) + +#ifdef democonfigCLIENT_USERNAME + +/** + * @brief Append the username with the metrics string if #democonfigCLIENT_USERNAME is defined. + * + * This is to support both metrics reporting and username/password based client + * authentication by AWS IoT. + */ + #define CLIENT_USERNAME_WITH_METRICS democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING +#endif + +/** + * @brief Length of client identifier. + */ +#define democonfigCLIENT_IDENTIFIER_LENGTH ( ( uint16_t ) ( sizeof( democonfigCLIENT_IDENTIFIER ) - 1 ) ) + +/** + * @brief Length of MQTT server host name. + */ +#define democonfigBROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( democonfigMQTT_BROKER_ENDPOINT ) - 1 ) ) + + +#endif /* DEMO_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/main.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/main.c new file mode 100644 index 000000000..8b74773bd --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/main.c @@ -0,0 +1,375 @@ +/* + * FreeRTOS V202012.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 https://www.FreeRTOS.org/coremqtt for configuration and usage instructions. + ***/ + +/* Standard includes. */ +#include <stdio.h> +#include <time.h> + +/* Visual studio intrinsics used so the __debugbreak() function is available + * should an assert get hit. */ +#include <intrin.h> + +/* FreeRTOS includes. */ +#include <FreeRTOS.h> +#include "task.h" + +/* TCP/IP stack includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* Demo logging includes. */ +#include "logging.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + + +/* + * Prototypes for the demos that can be started from this project. Note the + * Ota demo is not actually started until the network is already, which is + * indicated by vApplicationIPNetworkEventHook() executing - hence + * vStartOtaDemo() is called from inside vApplicationIPNetworkEventHook(). + */ +extern void vStartOtaDemo( 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(); + + /* 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 ); + + /* Start the RTOS scheduler. */ + vTaskStartScheduler(); + + /* If all is well, the scheduler will now be running, and the following + * 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). */ + for( ; ; ) + { + __debugbreak(); + } +} +/*-----------------------------------------------------------*/ + +/* 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" ) ); + vStartOtaDemo(); + 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; + + 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 ); + LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) ); +} +/*-----------------------------------------------------------*/ + +#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. + * The macros ipconfigRAND32() and configRAND32() are not in use + * anymore in FreeRTOS+TCP. + * + * 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; +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/mbedtls_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/mbedtls_config.h new file mode 100644 index 000000000..5f24aa1de --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/mbedtls_config.h @@ -0,0 +1,134 @@ +/* + * FreeRTOS V202012.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 +#define MBEDTLS_X509_CREATE_C +#define MBEDTLS_PK_WRITE_C +#define MBEDTLS_X509_CSR_WRITE_C + +/* 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_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 ); + +/* 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_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_config.h new file mode 100644 index 000000000..4d832dd14 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_config.h @@ -0,0 +1,200 @@ +/* + * FreeRTOS V202012.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 ota_config.h + * @brief OTA user configurable settings. + */ + +#ifndef OTA_CONFIG_H_ +#define OTA_CONFIG_H_ + +/**************************************************/ +/******* DO NOT CHANGE the following order ********/ +/**************************************************/ + +/* Logging related header files are required to be included in the following order: + * 1. Include the header file "logging_levels.h". + * 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL. + * 3. Include the header file "logging_stack.h". + */ + +/* Include header that defines log levels. */ +#include "logging_levels.h" + +/* Configure name and log level for the OTA library. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "OTA" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#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 ****************/ + +/** + * @brief Log base 2 of the size of the file data block message (excluding the header). + * + * 10 bits yields a data block size of 1KB. + */ +#define otaconfigLOG2_FILE_BLOCK_SIZE 11UL + +/** + * @brief Size of the file data block message (excluding the header). + * + */ +#define otaconfigFILE_BLOCK_SIZE ( 1UL << otaconfigLOG2_FILE_BLOCK_SIZE ) + +/** + * @brief Milliseconds to wait for the self test phase to succeed before we force reset. + */ +#define otaconfigSELF_TEST_RESPONSE_WAIT_MS 16000U + +/** + * @brief Milliseconds to wait before requesting data blocks from the OTA service if nothing is happening. + * + * The wait timer is reset whenever a data block is received from the OTA service so we will only send + * the request message after being idle for this amount of time. + */ +#define otaconfigFILE_REQUEST_WAIT_MS 10000U + +/** + * @brief The maximum allowed length of the thing name used by the OTA agent. + * + * AWS IoT requires Thing names to be unique for each device that connects to the broker. + * Likewise, the OTA agent requires the developer to construct and pass in the Thing name when + * initializing the OTA agent. The agent uses this size to allocate static storage for the + * Thing name used in all OTA base topics. Namely $aws/things/<thingName> + */ +#define otaconfigMAX_THINGNAME_LEN 128U + +/** + * @brief The maximum number of data blocks requested from OTA streaming service. + * + * This configuration parameter is sent with data requests and represents the maximum number of + * data blocks the service will send in response. The maximum limit for this must be calculated + * from the maximum data response limit (128 KB from service) divided by the block size. + * For example if block size is set as 1 KB then the maximum number of data blocks that we can + * request is 128/1 = 128 blocks. Configure this parameter to this maximum limit or lower based on + * how many data blocks response is expected for each data requests. + * Please note that this must be set larger than zero. + * + */ +#define otaconfigMAX_NUM_BLOCKS_REQUEST 4U + +/** + * @brief The maximum number of requests allowed to send without a response before we abort. + * + * This configuration parameter sets the maximum number of times the requests are made over + * the selected communication channel before aborting and returning error. + * + */ +#define otaconfigMAX_NUM_REQUEST_MOMENTUM 32U + +/** + * @brief The number of data buffers reserved by the OTA agent. + * + * This configurations parameter sets the maximum number of static data buffers used by + * the OTA agent for job and file data blocks received. + */ +#define otaconfigMAX_NUM_OTA_DATA_BUFFERS 5U + +/** + * @brief How frequently the device will report its OTA progress to the cloud. + * + * Device will update the job status with the number of blocks it has received every certain + * number of blocks it receives. For example, 25 means device will update job status every 25 blocks + * it receives. + */ +#define otaconfigOTA_UPDATE_STATUS_FREQUENCY 25U + + + +/** + * @brief Allow update to same or lower version. + * + * Set this to 1 to allow downgrade or same version update.This configurations parameter + * disables version check and allows update to a same or lower version.This is provided for + * testing purpose and it is recommended to always update to higher version and keep this + * configuration disabled. + */ +#define otaconfigAllowDowngrade 0U + +/** + * @brief The protocol selected for OTA control operations. + * + * This configurations parameter sets the default protocol for all the OTA control + * operations like requesting OTA job, updating the job status etc. + * + * Note - Only MQTT is supported at this time for control operations. + */ +#define configENABLED_CONTROL_PROTOCOL ( OTA_CONTROL_OVER_MQTT ) + +/** + * @brief The protocol selected for OTA data operations. + * + * This configurations parameter sets the protocols selected for the data operations + * like requesting file blocks from the service. + * + * Note - Both MQTT and HTTP is supported for data transfer from service. This configuration parameter + * can be set to following - + * Enable data over MQTT - ( OTA_DATA_OVER_MQTT ) + * Enable data over HTTP - ( OTA_DATA_OVER_HTTP) + * + * Note - Please check the OTA over MQTT demo which has the MQTT data trasnfer functionality and + * and this configuration is set to OTA_DATA_OVER_MQTT. + */ +#define configENABLED_DATA_PROTOCOLS ( OTA_DATA_OVER_HTTP ) + +/** + * @brief The preferred protocol selected for OTA data operations. + * + * Primary data protocol will be the protocol used for downloading file if more than + * one protocol is selected while creating OTA job. Default primary data protocol is MQTT + * and following update here to switch to HTTP as primary. + * + * Note - use OTA_DATA_OVER_HTTP for HTTP as primary data protocol. + */ + +#define configOTA_PRIMARY_DATA_PROTOCOL ( OTA_DATA_OVER_HTTP ) + +#endif /* OTA_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_over_http_demo.sln b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_over_http_demo.sln new file mode 100644 index 000000000..dcfc1fe09 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Http_Demo/ota_over_http_demo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29215.179 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4} + EndGlobalSection + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi + EndGlobalSection +EndGlobal diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/DemoTasks/OtaOverMqttDemoExample.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/DemoTasks/OtaOverMqttDemoExample.c new file mode 100644 index 000000000..823eacf00 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/DemoTasks/OtaOverMqttDemoExample.c @@ -0,0 +1,2031 @@ +/* + * FreeRTOS V202012.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 OtaOverMqttDemoExample.c + * @brief Over The Air Update demo using coreMQTT Agent. + * + * The file demonstrates how to perform Over The Air update using OTA agent and coreMQTT Agent + * library. It creates an OTA agent task which manages the OTA firmware update + * for the device. The example also provides implementations to subscribe, publish, + * and receive data from an MQTT broker. The implementation uses coreMQTT agent which manages + * thread safety of the MQTT operations and allows OTA agent to share the same MQTT + * broker connection with other tasks. OTA agent invokes the callback implementations to + * publish job related control information, as well as receive chunks + * of pre-signed firmware image from the MQTT broker. + * + * See https://freertos.org/mqtt/mqtt-agent-demo.html + * See https://freertos.org/ota/ota-mqtt-agent-demo.html + */ + +/* Standard includes. */ +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "semphr.h" + +/* Demo config includes. */ +#include "demo_config.h" + +/* Library config includes. */ +#include "ota_config.h" + +/* MQTT library includes. */ +#include "core_mqtt_agent.h" + +/* MQTT Agent ports. */ +#include "freertos_agent_message.h" +#include "freertos_command_pool.h" + +/* Subscription manager header include. */ +#include "subscription_manager.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* mbedTLS transport interface header.*/ +#include "using_mbedtls.h" + +/* OTA Library include. */ +#include "ota.h" + +/* OTA Library Interface include. */ +#include "ota_os_freertos.h" +#include "ota_mqtt_interface.h" +#include "ota_platform_interface.h" + +/* Include firmware version struct definition. */ +#include "ota_appversion32.h" + +/* Include platform abstraction header. */ +#include "ota_pal.h" + +/*------------- Demo configurations -------------------------*/ + +/** + * @brief The maximum size of the file paths used in the demo. + */ +#define otaexampleMAX_FILE_PATH_SIZE ( 260 ) + +/** + * @brief The maximum size of the stream name required for downloading update file + * from streaming service. + */ +#define otaexampleMAX_STREAM_NAME_SIZE ( 128 ) + +/** + * @brief The delay used in the OTA demo task to periodically output the OTA + * statistics like number of packets received, dropped, processed and queued per connection. + */ +#define otaexampleTASK_DELAY_MS ( 1000U ) + +/** + * @brief The maximum time for which OTA demo waits for an MQTT operation to be complete. + * This involves receiving an acknowledgment for broker for SUBSCRIBE, UNSUBSCRIBE and non + * QOS0 publishes. + */ +#define otaexampleMQTT_TIMEOUT_MS ( 5000U ) + +/** + * @brief The common prefix for all OTA topics. + * + * Thing name is substituted with a wildcard symbol `+`. OTA agent + * registers with MQTT broker with the thing name in the topic. This topic + * filter is used to match incoming packet received and route them to OTA. + * Thing name is not needed for this matching. + */ +#define OTA_TOPIC_PREFIX "$aws/things/+/" + +/** + * @brief Wildcard topic filter for job notification. + * The filter is used to match the constructed job notify topic filter from OTA agent and register + * appropriate callback for it. + */ +#define OTA_JOB_NOTIFY_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/notify-next" + +/** + * @brief Length of job notification topic filter. + */ +#define OTA_JOB_NOTIFY_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_NOTIFY_TOPIC_FILTER ) - 1 ) ) + +/** + * @brief Wildcard topic filter for matching job response messages. + * This topic filter is used to match the responses from OTA service for OTA agent job requests. THe + * topic filter is a reserved topic which is not subscribed with MQTT broker. + * + */ +#define OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/$next/get/accepted" + +/** + * @brief Length of job accepted response topic filter. + */ +#define OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER ) - 1 ) ) + + +/** + * @brief Wildcard topic filter for matching OTA data packets. + * The filter is used to match the constructed data stream topic filter from OTA agent and register + * appropriate callback for it. + */ +#define OTA_DATA_STREAM_TOPIC_FILTER OTA_TOPIC_PREFIX "streams/#" + +/** + * @brief Length of data stream topic filter. + */ +#define OTA_DATA_STREAM_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_DATA_STREAM_TOPIC_FILTER ) - 1 ) ) + + +/** + * @brief Starting index of client identifier within OTA topic. + */ +#define OTA_TOPIC_CLIENT_IDENTIFIER_START_IDX ( 12U ) + + /** + * @brief Default topic filter for OTA. + * This is used to route all the packets for OTA reserved topics which OTA agent has not subscribed for. + */ +#define OTA_DEFAULT_TOPIC_FILTER OTA_TOPIC_PREFIX "jobs/#" + + /** + * @brief Length of default topic filter. + */ +#define OTA_DEFAULT_TOPIC_FILTER_LENGTH ( ( uint16_t ) ( sizeof( OTA_DEFAULT_TOPIC_FILTER ) - 1 ) ) + +/** + * @brief Used to clear bits in a task's notification value. + */ +#define otaexampleMAX_UINT32 ( 0xffffffff ) + + /** + * @brief Dimensions the buffer used to serialize and deserialize MQTT packets. + * @note Specified in bytes. Must be large enough to hold the maximum + * anticipated MQTT payload. + */ +#ifndef MQTT_AGENT_NETWORK_BUFFER_SIZE +#define MQTT_AGENT_NETWORK_BUFFER_SIZE ( 10240 ) +#endif + + /** + * @brief The length of the queue used to hold commands for the agent. + */ +#ifndef MQTT_AGENT_COMMAND_QUEUE_LENGTH +#define MQTT_AGENT_COMMAND_QUEUE_LENGTH ( 10 ) +#endif + +/** + * @brief The maximum amount of time in milliseconds to wait for the commands + * to be posted to the MQTT agent should the MQTT agent's command queue be full. + * Tasks wait in the Blocked state, so don't use any CPU time. + */ +#define MQTT_AGENT_SEND_BLOCK_TIME_MS ( 200U ) + + /** + * @brief This demo uses task notifications to signal tasks from MQTT callback + * functions. mqttexampleMS_TO_WAIT_FOR_NOTIFICATION defines the time, in ticks, + * to wait for such a callback. + */ +#define MQTT_AGENT_MS_TO_WAIT_FOR_NOTIFICATION ( 5000U ) + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define RETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed operation + * with server. + */ +#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation retry + * attempts. + */ +#define RETRY_BACKOFF_BASE_MS ( 500U ) + +/** + * @brief 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 the this Keep Alive value. In the + * absence of sending any other Control Packets, the Client MUST send a + * PINGREQ Packet. + */ +#define otaexampleKEEP_ALIVE_INTERVAL_SECONDS ( 60U ) + +/** + * @brief Socket send and receive timeouts to use. Specified in milliseconds. + */ +#define otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 750 ) + + /** + * @brief Timeout for receiving CONNACK after sending an MQTT CONNECT packet. + * Defined in milliseconds. + */ +#define otaexampleCONNACK_RECV_TIMEOUT_MS ( 1000U ) + +/** + * @brief Stack size required for MQTT agent task. + * MQTT agent task takes care of TLS connection and reconnection, keeping task stack size + * to high enough required for TLS connection. + */ +#define MQTT_AGENT_TASK_STACK_SIZE ( 6000U ) + +/** + * @brief Priority required for OTA statistics task. + */ +#define MQTT_AGENT_TASK_PRIORITY ( tskIDLE_PRIORITY ) + +/** + * @brief Stack size required for OTA agent task. + */ +#define OTA_AGENT_TASK_STACK_SIZE ( 5000U ) + +/** + * @brief Priority required for OTA agent task. + */ +#define OTA_AGENT_TASK_PRIORITY ( tskIDLE_PRIORITY ) + +/** + * @brief Used to convert times to/from ticks and milliseconds. + */ +#define otaexampleMILLISECONDS_PER_SECOND ( 1000U ) +#define otaexampleMILLISECONDS_PER_TICK ( otaexampleMILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) + + /** + * @brief The timeout for waiting for the agent to get suspended after closing the + * connection. + * + * Timeout value should be large enough for OTA agent to finish any pending MQTT operations + * and suspend itself. + * + */ +#define OTA_SUSPEND_TIMEOUT_MS ( 10000U ) + +/*---------------------------------------------------------*/ + +/** + * @brief Structure used to store the topic filter to ota callback mappings. + */ +typedef struct OtaTopicFilterCallback +{ + const char * pTopicFilter; + uint16_t topicFilterLength; + IncomingPubCallback_t callback; +} OtaTopicFilterCallback_t; + +/** + * @brief Defines the structure to use as the command callback context in this + * demo. + */ +struct MQTTAgentCommandContext +{ + MQTTStatus_t xReturnStatus; + TaskHandle_t xTaskToNotify; + void * pArgs; +}; + +/** + * @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 *. + * + * @note Transport stacks are defined in FreeRTOS-Plus/Source/Application-Protocols/network_transport. + */ +struct NetworkContext +{ + TlsTransportParams_t * pParams; +}; + + +/*---------------------------------------------------------*/ + +/** + * @brief Global entry time into the application to use as a reference timestamp + * in the #prvGetTimeMs function. #prvGetTimeMs will always return the difference + * between the current time and the global entry time. This will reduce the chances + * of overflow for the 32 bit unsigned integer used for holding the timestamp. + */ +static uint32_t ulGlobalEntryTimeMs; + +/** + * @brief The buffer is used to hold the serialized packets for transmission to and from + * the transport interface. + */ +static uint8_t xNetworkBuffer[ MQTT_AGENT_NETWORK_BUFFER_SIZE ]; + +/** + * @brief FreeRTOS blocking queue to be used as MQTT Agent context. + */ +static MQTTAgentMessageContext_t xCommandQueue; + +/** + * @brief The network context used by the MQTT library transport interface. + * See https://www.freertos.org/network-interface.html + */ +static NetworkContext_t xNetworkContextMqtt; + +/** + * @brief The parameters for the network context using a TLS channel. + */ +static TlsTransportParams_t xTlsTransportParams; + +/** + * @brief The global array of subscription elements. + * + * @note No thread safety is required to this array, since the updates the array + * elements are done only from one task at a time. The subscription manager + * implementation expects that the array of the subscription elements used for + * storing subscriptions to be initialized to 0. As this is a global array, it + * will be intialized to 0 by default. + */ +static SubscriptionElement_t xGlobalSubscriptionList[ SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ]; + +/** + * @brief Buffer used to store the firmware image file path. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t updateFilePath[ otaexampleMAX_FILE_PATH_SIZE ]; + +/** + * @brief Buffer used to store the code signing certificate file path. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t certFilePath[ otaexampleMAX_FILE_PATH_SIZE ]; + +/** + * @brief Buffer used to store the name of the data stream. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t streamName[ otaexampleMAX_STREAM_NAME_SIZE ]; + +/** + * @brief Buffer used decode the CBOR message from the MQTT payload. + * Buffer is passed to the OTA agent during initialization. + */ +static uint8_t decodeMem[ ( 1U << otaconfigLOG2_FILE_BLOCK_SIZE ) ]; + +/** + * @brief Application buffer used to store the bitmap for requesting firmware image + * chunks from MQTT broker. Buffer is passed to the OTA agent during initialization. + */ +static uint8_t bitmap[ OTA_MAX_BLOCK_BITMAP_SIZE ]; + +/** + * @brief A statically allocated array of event buffers used by the OTA agent. + * Maximum number of buffers are determined by how many chunks are requested + * by OTA agent at a time along with an extra buffer to handle control message. + * The size of each buffer is determined by the maximum size of firmware image + * chunk, and other metadata send along with the chunk. + */ +static OtaEventData_t eventBuffer[ otaconfigMAX_NUM_OTA_DATA_BUFFERS ] = { 0 }; + +/* + * @brief Mutex used to manage thread safe access of OTA event buffers. + */ +static SemaphoreHandle_t xBufferSemaphore; + +/** + * @brief Static handle used for MQTT agent context. + */ +static MQTTAgentContext_t xGlobalMqttAgentContext; + +/*---------------------------------------------------------*/ + +/** + * @brief Task for MQTT agent. + * Task runs MQTT agent command loop, which returns only when the user disconnects + * MQTT, terminates agent, or the mqtt connection is broken. If the mqtt connection is broken, the task + * suspends OTA agent reconnects to the broker and then resumes OTA agent. + * + * @param[in] pParam Can be used to pass down functionality to the agent task + */ +static void prvMQTTAgentTask(void* pParam); + +/** + * @brief Function used by OTA agent to publish control messages to the MQTT broker. + * + * The implementation uses MQTT agent to queue a publish request. It then waits + * for the request complete notification from the agent. The notification along with result of the + * operation is sent back to the caller task using xTaksNotify API. For publishes involving QOS 1 and + * QOS2 the operation is complete once an acknowledgment (PUBACK) is received. OTA agent uses this function + * to fetch new job, provide status update and send other control related messges to the MQTT broker. + * + * @param[in] pacTopic Topic to publish the control packet to. + * @param[in] topicLen Length of the topic string. + * @param[in] pMsg Message to publish. + * @param[in] msgSize Size of the message to publish. + * @param[in] qos Qos for the publish. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + */ +static OtaMqttStatus_t prvMQTTPublish( const char * const pacTopic, + uint16_t topicLen, + const char * pMsg, + uint32_t msgSize, + uint8_t qos ); + +/** + * @brief Function used by OTA agent to subscribe for a control or data packet from the MQTT broker. + * + * The implementation queues a SUBSCRIBE request for the topic filter with the MQTT agent. It then waits for + * a notification of the request completion. Notification will be sent back to caller task, + * using xTaskNotify APIs. MQTT agent also stores a callback provided by this function with + * the associated topic filter. The callback will be used to + * route any data received on the matching topic to the OTA agent. OTA agent uses this function + * to subscribe to all topic filters necessary for receiving job related control messages as + * well as firmware image chunks from MQTT broker. + * + * @param[in] pTopicFilter The topic filter used to subscribe for packets. + * @param[in] topicFilterLength Length of the topic filter string. + * @param[in] ucQoS Intended qos value for the messages received on this topic. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + */ +static OtaMqttStatus_t prvMQTTSubscribe( const char * pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS ); + +/** + * @brief Function is used by OTA agent to unsubscribe a topicfilter from MQTT broker. + * + * The implementation queues an UNSUBSCRIBE request for the topic filter with the MQTT agent. It then waits + * for a successful completion of the request from the agent. Notification along with results of + * operation is sent using xTaskNotify API to the caller task. MQTT agent also removes the topic filter + * subscription from its memory so any future + * packets on this topic will not be routed to the OTA agent. + * + * @param[in] pTopicFilter Topic filter to be unsubscribed. + * @param[in] topicFilterLength Length of the topic filter. + * @param[in] ucQos Qos value for the topic. + * @return OtaMqttSuccess if successful. Appropriate error code otherwise. + * + */ +static OtaMqttStatus_t prvMQTTUnsubscribe( const char * pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS ); + +/** + * @brief Fetch an unused OTA event buffer from the pool. + * + * Demo uses a simple statically allocated array of fixed size event buffers. The + * number of event buffers is configured by the param otaconfigMAX_NUM_OTA_DATA_BUFFERS + * within ota_config.h. This function is used to fetch a free buffer from the pool for processing + * by the OTA agent task. It uses a mutex for thread safe access to the pool. + * + * @return A pointer to an unusued buffer. NULL if there are no buffers available. + */ +static OtaEventData_t * prvOTAEventBufferGet( void ); + +/** + * @brief Free an event buffer back to pool + * + * OTA demo uses a statically allocated array of fixed size event buffers . The + * number of event buffers is configured by the param otaconfigMAX_NUM_OTA_DATA_BUFFERS + * within ota_config.h. The function is used by the OTA application callback to free a buffer, + * after OTA agent has completed processing with the event. The access to the pool is made thread safe + * using a mutex. + * + * @param[in] pxBuffer Pointer to the buffer to be freed. + */ +static void prvOTAEventBufferFree( OtaEventData_t * const pxBuffer ); + +/** + * @brief The function which runs the OTA agent task. + * + * The function runs the OTA Agent Event processing loop, which waits for + * any events for OTA agent and process them. The loop never returns until the OTA agent + * is shutdown. The tasks exits gracefully by freeing up all resources in the event of an + * OTA agent shutdown. + * + * @param[in] pvParam Any parameters to be passed to OTA agent task. + */ +static void prvOTAAgentTask( void * pvParam ); + + +/** + * @brief The function which runs the OTA demo task. + * + * The demo task initializes the OTA agent an loops until OTA agent is shutdown. + * It reports OTA update statistics (which includes number of blocks received, processed and dropped), + * at regular intervals. + * + * @param[in] pvParam Any parameters to be passed to OTA Demo task. + */ +static void vOtaDemoTask( void* pvParam ); + +/** + * @brief The function which implements the flow for OTA demo. + * + * @return pdPASS if success or pdFAIL. + */ +static BaseType_t prvRunOTADemo(void); + +/** + * @brief Callback registered with the OTA library that notifies the OTA agent + * of an incoming PUBLISH containing a job document. + * + * @param[in] pContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet information which stores details of the + * job document. + */ +static void prvMqttJobCallback( void * pContext, + MQTTPublishInfo_t * pPublish ); + + +/** + * @brief Callback that notifies the OTA library when a data block is received. + * + * @param[in] pContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet that stores the information of the file block. + */ +static void prvMqttDataCallback( void * pContext, + MQTTPublishInfo_t * pPublish ); + +/** + * @brief Default callback used to receive unsolicited messages for OTA. + * + * The callback is not subscribed with MQTT broker, but only with local subscription manager. + * A wildcard OTA job topic is used for subscription so that all unsolicited messages related to OTA is + * forwarded to this callback for filteration. Right now the callback is used to filter responses to job requests + * from the OTA service. + * + * @param[in] pvIncomingPublishCallbackContext MQTT context which stores the connection. + * @param[in] pPublishInfo MQTT packet that stores the information of the file block. + */ +static void prvMqttDefaultCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ); + + +/** + * @brief Attempt to connect to the MQTT broker. + * + */ +static void prvConnectToMQTTBroker(void); + +/** + * @brief Retry logic to establish a connection to the MQTT broker. + * + * If the connection fails, keep retrying with exponentially increasing + * timeout value, until max retries, max timeout or successful connect. + * + * @param[in] pNetworkContext Network context to connect on. + * @return int pdFALSE if connection failed after retries. + */ +static BaseType_t prvSocketConnect(NetworkContext_t* pNetworkContext); + +/** + * @brief Disconnects from the MQTT broker. + * Initiates an MQTT disconnect and then teardown underlying TCP connection. + * + */ +static void prvDisconnectFromMQTTBroker(void); + +/** + * @brief Initializes an MQTT context, including transport interface and + * network buffer. + * + * @return `MQTTSuccess` if the initialization succeeds, else `MQTTBadParameter`. + */ +static MQTTStatus_t prvMqttInit(void); + +/** + * @brief Sends an MQTT Connect packet over the already connected TCP socket. + * + * @param[in] pxMQTTContext MQTT context pointer. + * @param[in] xCleanSession If a clean session should be established. + * + * @return `MQTTSuccess` if connection succeeds, else appropriate error code + * from MQTT_Connect. + */ +static MQTTStatus_t prvMQTTConnect( bool xCleanSession ); + +/** + * @brief Register OTA callbacks with the subscription manager. + * + * @param[in] pTopicFilter The topic filter for which a callback needs to be registered for. + * @param[in] topicFilterLength length of the topic filter. + * + */ +static void prvRegisterOTACallback(const char* pTopicFilter, + uint16_t topicFilterLength); + +/** + * @brief Suspend OTA demo. + * + * @return pPASS or pdFAIL. + */ +static BaseType_t prvSuspendOTA(void); + +/** + * @brief Resume OTA demo. + * + * @return pPASS or pdFAIL. + */ +static BaseType_t prvResumeOTA(void); + +/** + * @brief Set OTA interfaces. + * + * @param[in] pOtaInterfaces pointer to OTA interface structure. + * + * @return None. + */ +static void setOtaInterfaces(OtaInterfaces_t* pOtaInterfaces); + +/** + * @brief Structure containing all application allocated buffers used by the OTA agent. + * Structure is passed to the OTA agent during initialization. + */ +static OtaAppBuffer_t otaBuffer = +{ + .pUpdateFilePath = updateFilePath, + .updateFilePathsize = otaexampleMAX_FILE_PATH_SIZE, + .pCertFilePath = certFilePath, + .certFilePathSize = otaexampleMAX_FILE_PATH_SIZE, + .pStreamName = streamName, + .streamNameSize = otaexampleMAX_STREAM_NAME_SIZE, + .pDecodeMemory = decodeMem, + .decodeMemorySize = ( 1U << otaconfigLOG2_FILE_BLOCK_SIZE ), + .pFileBitmap = bitmap, + .fileBitmapSize = OTA_MAX_BLOCK_BITMAP_SIZE +}; + +/** + * @brief Structure used for encoding firmware version. + */ +const AppVersion32_t appFirmwareVersion = +{ + .u.x.major = APP_VERSION_MAJOR, + .u.x.minor = APP_VERSION_MINOR, + .u.x.build = APP_VERSION_BUILD, +}; + +/** + * @brief Registry for all mqtt topic filters to their corresponding callbacks for OTA. + */ +static OtaTopicFilterCallback_t otaTopicFilterCallbacks[] = +{ + { + .pTopicFilter = OTA_JOB_NOTIFY_TOPIC_FILTER, + .topicFilterLength = OTA_JOB_NOTIFY_TOPIC_FILTER_LENGTH, + .callback = prvMqttJobCallback + }, + { + .pTopicFilter = OTA_DATA_STREAM_TOPIC_FILTER, + .topicFilterLength = OTA_DATA_STREAM_TOPIC_FILTER_LENGTH, + .callback = prvMqttDataCallback + }, + { + .pTopicFilter = OTA_DEFAULT_TOPIC_FILTER, + .topicFilterLength = OTA_DEFAULT_TOPIC_FILTER_LENGTH, + .callback = prvMqttDefaultCallback + } +}; + +/*-----------------------------------------------------------*/ + +static void prvOTAEventBufferFree( OtaEventData_t * const pxBuffer ) +{ + if( xSemaphoreTake( xBufferSemaphore, portMAX_DELAY ) == pdTRUE ) + { + pxBuffer->bufferUsed = false; + ( void ) xSemaphoreGive( xBufferSemaphore ); + } +} + +/*-----------------------------------------------------------*/ + +static OtaEventData_t * prvOTAEventBufferGet( void ) +{ + uint32_t ulIndex = 0; + OtaEventData_t * pFreeBuffer = NULL; + + if( xSemaphoreTake( xBufferSemaphore, portMAX_DELAY ) == pdTRUE ) + { + for( ulIndex = 0; ulIndex < otaconfigMAX_NUM_OTA_DATA_BUFFERS; ulIndex++ ) + { + if( eventBuffer[ ulIndex ].bufferUsed == false ) + { + eventBuffer[ ulIndex ].bufferUsed = true; + pFreeBuffer = &eventBuffer[ ulIndex ]; + break; + } + } + + ( void ) xSemaphoreGive( xBufferSemaphore ); + } + + return pFreeBuffer; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief The OTA agent has completed the update job or it is in + * self test mode. If it was accepted, we want to activate the new image. + * This typically means we should reset the device to run the new firmware. + * If now is not a good time to reset the device, it may be activated later + * by your user code. If the update was rejected, just return without doing + * anything and we will wait for another job. If it reported that we should + * start test mode, normally we would perform some kind of system checks to + * make sure our new firmware does the basic things we think it should do + * but we will just go ahead and set the image as accepted for demo purposes. + * The accept function varies depending on your platform. Refer to the OTA + * PAL implementation for your platform in ota_pal.c to see what it + * does for you. + * + * @param[in] event Specify if this demo is running with the AWS IoT + * MQTT server. Set this to `false` if using another MQTT server. + * @param[in] pData Data associated with the event. + * @return None. + */ +static void otaAppCallback( OtaJobEvent_t event, + const void * pData ) +{ + OtaErr_t err = OtaErrUninitialized; + + switch( event ) + { + case OtaJobEventActivate: + LogInfo( ( "Received OtaJobEventActivate callback from OTA Agent." ) ); + + /** + * Activate the new firmware image immediately. Applications can choose to postpone + * the activation to a later stage if needed. + */ + err = OTA_ActivateNewImage(); + + /** + * Activation of the new image failed. This indicates an error that requires a follow + * up through manual activation by resetting the device. The demo reports the error + * and shuts down the OTA agent. + */ + LogError( ( "New image activation failed." ) ); + + /* Shutdown OTA Agent, if it is required that the unsubscribe operations are not + * performed while shutting down please set the second parameter to 0 instead of 1. */ + OTA_Shutdown( 0, 1 ); + + + break; + + case OtaJobEventFail: + + /** + * No user action is needed here. OTA agent handles the job failure event. + */ + LogInfo( ( "Received an OtaJobEventFail notification from OTA Agent." ) ); + + break; + + case OtaJobEventStartTest: + + /* This demo just accepts the image since it was a good OTA update and networking + * and services are all working (or we would not have made it this far). If this + * were some custom device that wants to test other things before validating new + * image, this would be the place to kick off those tests before calling + * OTA_SetImageState() with the final result of either accepted or rejected. */ + + LogInfo( ( "Received OtaJobEventStartTest callback from OTA Agent." ) ); + + err = OTA_SetImageState( OtaImageStateAccepted ); + + if( err == OtaErrNone ) + { + LogInfo( ( "New image validation succeeded in self test mode." ) ); + } + else + { + LogError( ( "Failed to set image state as accepted with error %d.", err ) ); + } + + break; + + case OtaJobEventProcessed: + + LogDebug( ( "OTA Event processing completed. Freeing the event buffer to pool." ) ); + configASSERT( pData != NULL ); + prvOTAEventBufferFree( ( OtaEventData_t * ) pData ); + + break; + + case OtaJobEventSelfTestFailed: + LogDebug( ( "Received OtaJobEventSelfTestFailed callback from OTA Agent." ) ); + + /* Requires manual activation of previous image as self-test for + * new image downloaded failed.*/ + LogError( ( "OTA Self-test failed for new image. shutting down OTA Agent." ) ); + + /* Shutdown OTA Agent, if it is required that the unsubscribe operations are not + * performed while shutting down please set the second parameter to 0 instead of 1. */ + OTA_Shutdown( 0, 1 ); + + break; + + default: + LogWarn( ( "Received an unhandled callback event from OTA Agent, event = %d", event ) ); + + break; + } +} + +static void prvMqttJobCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + OtaEventData_t * pData; + OtaEventMsg_t eventMsg = { 0 }; + + configASSERT( pxPublishInfo != NULL ); + ( void ) pvIncomingPublishCallbackContext; + + LogInfo( ( "Received job message callback, size %ld.\n\n", pxPublishInfo->payloadLength ) ); + + pData = prvOTAEventBufferGet(); + + if( pData != NULL ) + { + memcpy( pData->data, pxPublishInfo->pPayload, pxPublishInfo->payloadLength ); + pData->dataLength = pxPublishInfo->payloadLength; + eventMsg.eventId = OtaAgentEventReceivedJobDocument; + eventMsg.pEventData = pData; + + /* Send job document received event. */ + OTA_SignalEvent( &eventMsg ); + } + else + { + LogError( ( "Error: No OTA data buffers available.\r\n" ) ); + } +} + +/*-----------------------------------------------------------*/ +static void prvMqttDefaultCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + bool isMatch = false; + + ( void ) MQTT_MatchTopic( pxPublishInfo->pTopicName, + pxPublishInfo->topicNameLength, + OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER, + OTA_JOB_ACCEPTED_RESPONSE_TOPIC_FILTER_LENGTH, + &isMatch ); + + if( isMatch == true ) + { + prvMqttJobCallback( pvIncomingPublishCallbackContext, pxPublishInfo ); + } +} + +/*-----------------------------------------------------------*/ +static void prvMqttDataCallback( void * pvIncomingPublishCallbackContext, + MQTTPublishInfo_t * pxPublishInfo ) +{ + OtaEventData_t * pxData; + OtaEventMsg_t eventMsg = { 0 }; + + configASSERT( pxPublishInfo != NULL ); + ( void ) pvIncomingPublishCallbackContext; + + LogInfo( ( "Received data message callback, size %zu.\n\n", pxPublishInfo->payloadLength ) ); + + pxData = prvOTAEventBufferGet(); + + if(pxData != NULL ) + { + memcpy(pxData->data, pxPublishInfo->pPayload, pxPublishInfo->payloadLength ); + pxData->dataLength = pxPublishInfo->payloadLength; + eventMsg.eventId = OtaAgentEventReceivedFileBlock; + eventMsg.pEventData = pxData; + + /* Send job document received event. */ + OTA_SignalEvent( &eventMsg ); + } + else + { + LogError( ( "Error: No OTA data buffers available.\r\n" ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvCommandCallback( MQTTAgentCommandContext_t * pxCommandContext, + MQTTAgentReturnInfo_t * pxReturnInfo ) +{ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if( pxCommandContext->xTaskToNotify != NULL ) + { + xTaskNotify( pxCommandContext->xTaskToNotify, ( uint32_t ) ( pxReturnInfo->returnCode ), eSetValueWithOverwrite ); + } +} + +static void prvMQTTSubscribeCompleteCallback( MQTTAgentCommandContext_t* pxCommandContext, + MQTTAgentReturnInfo_t* pxReturnInfo ) +{ + MQTTAgentSubscribeArgs_t* pSubsribeArgs; + + if (pxReturnInfo->returnCode == MQTTSuccess) + { + pSubsribeArgs = (MQTTAgentSubscribeArgs_t*)(pxCommandContext->pArgs); + prvRegisterOTACallback(pSubsribeArgs->pSubscribeInfo->pTopicFilter, pSubsribeArgs->pSubscribeInfo->topicFilterLength); + } + + /* Store the result in the application defined context so the task that + * initiated the publish can check the operation's status. */ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if (pxCommandContext->xTaskToNotify != NULL) + { + /* Send the context's ulNotificationValue as the notification value so + * the receiving task can check the value it set in the context matches + * the value it receives in the notification. */ + xTaskNotify(pxCommandContext->xTaskToNotify, (uint32_t)(pxReturnInfo->returnCode), eSetValueWithOverwrite); + } +} + +/*-----------------------------------------------------------*/ + +static void prvMQTTUnsubscribeCompleteCallback( MQTTAgentCommandContext_t* pxCommandContext, + MQTTAgentReturnInfo_t* pxReturnInfo ) +{ + + /* Store the result in the application defined context so the task that + * initiated the publish can check the operation's status. */ + pxCommandContext->xReturnStatus = pxReturnInfo->returnCode; + + if (pxCommandContext->xTaskToNotify != NULL) + { + /* Send the context's ulNotificationValue as the notification value so + * the receiving task can check the value it set in the context matches + * the value it receives in the notification. */ + xTaskNotify(pxCommandContext->xTaskToNotify, (uint32_t)(pxReturnInfo->returnCode), eSetValueWithOverwrite); + } +} + +/*-----------------------------------------------------------*/ + +static uint32_t prvGetTimeMs( void ) +{ + TickType_t xTickCount = 0; + uint32_t ulTimeMs = 0UL; + + /* Get the current tick count. */ + xTickCount = xTaskGetTickCount(); + + /* Convert the ticks to milliseconds. */ + ulTimeMs = ( uint32_t ) xTickCount * otaexampleMILLISECONDS_PER_TICK; + + /* Reduce ulGlobalEntryTimeMs from obtained time so as to always return the + * elapsed time in the application. */ + ulTimeMs = ( uint32_t ) ( ulTimeMs - ulGlobalEntryTimeMs ); + + return ulTimeMs; +} + +/*-----------------------------------------------------------*/ + +static void prvIncomingPublishCallback( MQTTAgentContext_t * pMqttAgentContext, + uint16_t packetId, + MQTTPublishInfo_t * pxPublishInfo ) +{ + bool xPublishHandled = false; + char cOriginalChar, * pcLocation; + + ( void ) packetId; + + /* Fan out the incoming publishes to the callbacks registered using + * subscription manager. */ + xPublishHandled = handleIncomingPublishes( ( SubscriptionElement_t * ) pMqttAgentContext->pIncomingCallbackContext, + pxPublishInfo ); + + /* If there are no callbacks to handle the incoming publishes, + * handle it as an unsolicited publish. */ + if( xPublishHandled != true ) + { + /* Ensure the topic string is terminated for printing. This will over- + * write the message ID, which is restored afterwards. */ + pcLocation = ( char * ) &( pxPublishInfo->pTopicName[ pxPublishInfo->topicNameLength ] ); + cOriginalChar = *pcLocation; + *pcLocation = 0x00; + LogWarn( ( "Received an unsolicited publish from topic %s", pxPublishInfo->pTopicName ) ); + *pcLocation = cOriginalChar; + } +} + +/*-----------------------------------------------------------*/ + + + +static void prvSubscriptionCommandCallback( void * pxCommandContext, + MQTTAgentReturnInfo_t * pxReturnInfo ) +{ + size_t xIndex = 0; + MQTTAgentSubscribeArgs_t * pxSubscribeArgs = ( MQTTAgentSubscribeArgs_t * ) pxCommandContext; + + /* If the return code is success, no further action is required as all the topic filters + * are already part of the subscription list. */ + if( pxReturnInfo->returnCode != MQTTSuccess ) + { + /* Check through each of the suback codes and determine if there are any failures. */ + for( xIndex = 0; xIndex < pxSubscribeArgs->numSubscriptions; xIndex++ ) + { + /* This demo doesn't attempt to resubscribe in the event that a SUBACK failed. */ + if( pxReturnInfo->pSubackCodes[xIndex] == MQTTSubAckFailure ) + { + LogError( ( "Failed to resubscribe to topic %.*s.", + pxSubscribeArgs->pSubscribeInfo[xIndex].topicFilterLength, + pxSubscribeArgs->pSubscribeInfo[xIndex].pTopicFilter ) ); + /* Remove subscription callback for unsubscribe. */ + removeSubscription( xGlobalSubscriptionList, + pxSubscribeArgs->pSubscribeInfo[xIndex].pTopicFilter, + pxSubscribeArgs->pSubscribeInfo[xIndex].topicFilterLength ); + } + } + + /* Hit an assert as some of the tasks won't be able to proceed correctly without + * the subscriptions. This logic will be updated with exponential backoff and retry. */ + configASSERT( pdTRUE ); + } +} + + + +/*-----------------------------------------------------------*/ + +static MQTTStatus_t prvHandleResubscribe( void ) +{ + MQTTStatus_t xResult = MQTTBadParameter; + uint32_t ulIndex = 0U; + uint16_t usNumSubscriptions = 0U; + + /* These variables need to stay in scope until command completes. */ + static MQTTAgentSubscribeArgs_t xSubArgs = { 0 }; + static MQTTSubscribeInfo_t xSubInfo[ SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ] = { 0 }; + static MQTTAgentCommandInfo_t xCommandParams = { 0 }; + + /* Loop through each subscription in the subscription list and add a subscribe + * command to the command queue. */ + for( ulIndex = 0U; ulIndex < SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS; ulIndex++ ) + { + /* Check if there is a subscription in the subscription list. This demo + * doesn't check for duplicate subscriptions. */ + if( xGlobalSubscriptionList[ ulIndex ].usFilterStringLength != 0 ) + { + xSubInfo[ usNumSubscriptions ].pTopicFilter = xGlobalSubscriptionList[ ulIndex ].pcSubscriptionFilterString; + xSubInfo[ usNumSubscriptions ].topicFilterLength = xGlobalSubscriptionList[ ulIndex ].usFilterStringLength; + + /* QoS1 is used for all the subscriptions in this demo. */ + xSubInfo[ usNumSubscriptions ].qos = MQTTQoS1; + + LogInfo( ( "Resubscribe to the topic %.*s will be attempted.", + xSubInfo[ usNumSubscriptions ].topicFilterLength, + xSubInfo[ usNumSubscriptions ].pTopicFilter ) ); + + usNumSubscriptions++; + } + } + + if( usNumSubscriptions > 0U ) + { + xSubArgs.pSubscribeInfo = xSubInfo; + xSubArgs.numSubscriptions = usNumSubscriptions; + + /* The block time can be 0 as the command loop is not running at this point. */ + xCommandParams.blockTimeMs = 0U; + xCommandParams.cmdCompleteCallback = prvSubscriptionCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = ( void * ) &xSubArgs; + + /* Enqueue subscribe to the command queue. These commands will be processed only + * when command loop starts. */ + xResult = MQTTAgent_Subscribe( &xGlobalMqttAgentContext, &xSubArgs, &xCommandParams ); + } + else + { + /* Mark the resubscribe as success if there is nothing to be subscribed. */ + xResult = MQTTSuccess; + } + + if( xResult != MQTTSuccess ) + { + LogError( ( "Failed to enqueue the MQTT subscribe command. xResult=%s.", + MQTT_Status_strerror( xResult ) ) ); + } + + return xResult; +} + +static void prvRegisterOTACallback( const char * pTopicFilter, + uint16_t topicFilterLength ) +{ + bool isMatch = false; + MQTTStatus_t mqttStatus = MQTTSuccess; + uint16_t index = 0U; + uint16_t numTopicFilters = sizeof( otaTopicFilterCallbacks ) / sizeof( OtaTopicFilterCallback_t ); + + + bool subscriptionAdded; + + ( void ) mqttStatus; + + /* Match the input topic filter against the wild-card pattern of topics filters + * relevant for the OTA Update service to determine the type of topic filter. */ + for( ; index < numTopicFilters; index++ ) + { + mqttStatus = MQTT_MatchTopic( pTopicFilter, + topicFilterLength, + otaTopicFilterCallbacks[ index ].pTopicFilter, + otaTopicFilterCallbacks[ index ].topicFilterLength, + &isMatch ); + assert( mqttStatus == MQTTSuccess ); + + if( isMatch ) + { + /* Add subscription so that incoming publishes are routed to the application callback. */ + subscriptionAdded = addSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext, + pTopicFilter, + topicFilterLength, + otaTopicFilterCallbacks[ index ].callback, + NULL ); + + if( subscriptionAdded == false ) + { + LogError( ( "Failed to register a publish callback for topic %.*s.", + pTopicFilter, + topicFilterLength ) ); + } + } + } +} + +static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext ) +{ + BaseType_t xConnected = pdFAIL; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xReconnectParams = { 0 }; + uint16_t usNextRetryBackOff = 0U; + + TlsTransportStatus_t xNetworkStatus = TLS_TRANSPORT_CONNECT_FAILURE; + NetworkCredentials_t xNetworkCredentials = { 0 }; + + /* ALPN protocols must be a NULL-terminated list of strings. Therefore, + * the first entry will contain the actual ALPN protocol string while the + * second entry must remain NULL. */ + char * pcAlpnProtocols[] = { NULL, NULL }; + + /* The ALPN string changes depending on whether username/password authentication is used. */ + #ifdef democonfigCLIENT_USERNAME + pcAlpnProtocols[ 0 ] = AWS_IOT_CUSTOM_AUTH_ALPN; + #else + pcAlpnProtocols[ 0 ] = AWS_IOT_MQTT_ALPN; + #endif + xNetworkCredentials.pAlpnProtos = pcAlpnProtocols; + + /* Set the credentials for establishing a TLS connection. */ + xNetworkCredentials.pRootCa = ( const unsigned char * ) democonfigROOT_CA_PEM; + xNetworkCredentials.rootCaSize = sizeof( democonfigROOT_CA_PEM ); + #ifdef democonfigCLIENT_CERTIFICATE_PEM + xNetworkCredentials.pClientCert = ( const unsigned char * ) democonfigCLIENT_CERTIFICATE_PEM; + xNetworkCredentials.clientCertSize = sizeof( democonfigCLIENT_CERTIFICATE_PEM ); + xNetworkCredentials.pPrivateKey = ( const unsigned char * ) democonfigCLIENT_PRIVATE_KEY_PEM; + xNetworkCredentials.privateKeySize = sizeof( democonfigCLIENT_PRIVATE_KEY_PEM ); + #endif + xNetworkCredentials.disableSni = democonfigDISABLE_SNI; + + + /* We will use a retry mechanism with an exponential backoff mechanism and + * jitter. That is done to prevent a fleet of IoT devices all trying to + * reconnect at exactly the same time should they become disconnected at + * the same time. We initialize reconnect attempts and interval here. */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + RETRY_BACKOFF_BASE_MS, + RETRY_MAX_BACKOFF_DELAY_MS, + RETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to MQTT broker. If connection fails, retry after a + * timeout. Timeout value will exponentially increase until the maximum + * number of attempts are reached. + */ + do + { + /* Establish a TCP connection with the MQTT broker. This example connects to + * the MQTT broker as specified in democonfigMQTT_BROKER_ENDPOINT and + * democonfigMQTT_BROKER_PORT at the top of this file. */ + LogInfo( ( "Creating a TLS connection to %s:%d.", + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT ) ); + xNetworkStatus = TLS_FreeRTOS_Connect( pxNetworkContext, + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT, + &xNetworkCredentials, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + otaexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ); + xConnected = ( xNetworkStatus == TLS_TRANSPORT_SUCCESS ) ? pdPASS : pdFAIL; + + if( !xConnected ) + { + /* Get back-off value (in milliseconds) for the next connection retry. */ + xBackoffAlgStatus = BackoffAlgorithm_GetNextBackoff( &xReconnectParams, uxRand(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the broker failed. " + "Retrying connection in %hu ms.", + usNextRetryBackOff ) ); + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + } + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Connection to the broker failed, all attempts exhausted." ) ); + } + } while( ( xConnected != pdPASS ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + return xConnected; +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvSocketDisconnect(NetworkContext_t* pxNetworkContext) +{ + BaseType_t xDisconnected = pdFAIL; + + LogInfo(("Disconnecting TLS connection.\n")); + TLS_FreeRTOS_Disconnect(pxNetworkContext); + xDisconnected = pdPASS; + + return xDisconnected; +} + +static MQTTStatus_t prvMQTTInit( void ) +{ + TransportInterface_t xTransport; + MQTTStatus_t xReturn; + MQTTFixedBuffer_t xFixedBuffer = { .pBuffer = xNetworkBuffer, .size = MQTT_AGENT_NETWORK_BUFFER_SIZE }; + static uint8_t staticQueueStorageArea[ MQTT_AGENT_COMMAND_QUEUE_LENGTH * sizeof( MQTTAgentCommand_t * ) ]; + static StaticQueue_t staticQueueStructure; + MQTTAgentMessageInterface_t messageInterface = + { + .pMsgCtx = NULL, + .send = Agent_MessageSend, + .recv = Agent_MessageReceive, + .getCommand = Agent_GetCommand, + .releaseCommand = Agent_ReleaseCommand + }; + + LogDebug( ( "Creating command queue." ) ); + xCommandQueue.queue = xQueueCreateStatic( MQTT_AGENT_COMMAND_QUEUE_LENGTH, + sizeof( MQTTAgentCommand_t* ), + staticQueueStorageArea, + &staticQueueStructure ); + configASSERT( xCommandQueue.queue ); + messageInterface.pMsgCtx = &xCommandQueue; + + /* Initialize the task pool. */ + Agent_InitializePool(); + + /* Fill in Transport Interface send and receive function pointers. */ + xTransport.pNetworkContext = &xNetworkContextMqtt; + xTransport.send = TLS_FreeRTOS_send; + xTransport.recv = TLS_FreeRTOS_recv; + + /* Initialize MQTT library. */ + xReturn = MQTTAgent_Init( &xGlobalMqttAgentContext, + &messageInterface, + &xFixedBuffer, + &xTransport, + prvGetTimeMs, + prvIncomingPublishCallback, + /* Context to pass into the callback. Passing the pointer to subscription array. */ + xGlobalSubscriptionList ); + + return xReturn; +} + +static MQTTStatus_t prvMQTTConnect( bool xCleanSession ) +{ + MQTTStatus_t xResult; + MQTTConnectInfo_t xConnectInfo; + bool xSessionPresent = false; + + /* Many fields are not used in this demo so start with everything at 0. */ + memset( &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 = xCleanSession; + + /* 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 ); + + /* Set MQTT keep-alive period. It is the responsibility of the application + * to ensure that the interval between Control Packets being sent does not + * exceed the Keep Alive value. In the absence of sending any other Control + * Packets, the Client MUST send a PINGREQ Packet. This responsibility will + * be moved inside the agent. */ + xConnectInfo.keepAliveSeconds = otaexampleKEEP_ALIVE_INTERVAL_SECONDS; + + /* Append metrics when connecting to the AWS IoT Core broker. */ + #ifdef democonfigUSE_AWS_IOT_CORE_BROKER + #ifdef democonfigCLIENT_USERNAME + xConnectInfo.pUserName = CLIENT_USERNAME_WITH_METRICS; + xConnectInfo.userNameLength = ( uint16_t ) strlen( CLIENT_USERNAME_WITH_METRICS ); + xConnectInfo.pPassword = democonfigCLIENT_PASSWORD; + xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD ); + #else + xConnectInfo.pUserName = AWS_IOT_METRICS_STRING; + xConnectInfo.userNameLength = AWS_IOT_METRICS_STRING_LENGTH; + /* Password for authentication is not used. */ + xConnectInfo.pPassword = NULL; + xConnectInfo.passwordLength = 0U; + #endif + #else /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + #ifdef democonfigCLIENT_USERNAME + xConnectInfo.pUserName = democonfigCLIENT_USERNAME; + xConnectInfo.userNameLength = ( uint16_t ) strlen( democonfigCLIENT_USERNAME ); + xConnectInfo.pPassword = democonfigCLIENT_PASSWORD; + xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD ); + #endif /* ifdef democonfigCLIENT_USERNAME */ + #endif /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + + /* Send MQTT CONNECT packet to broker. MQTT's Last Will and Testament feature + * is not used in this demo, so it is passed as NULL. */ + xResult = MQTT_Connect( &( xGlobalMqttAgentContext.mqttContext ), + &xConnectInfo, + NULL, + otaexampleCONNACK_RECV_TIMEOUT_MS, + &xSessionPresent ); + + LogInfo( ( "Session present: %d\n", xSessionPresent ) ); + + /* Resume a session if desired. */ + if( ( xResult == MQTTSuccess ) && ( xCleanSession == false ) ) + { + xResult = MQTTAgent_ResumeSession( &xGlobalMqttAgentContext, xSessionPresent ); + + /* Resubscribe to all the subscribed topics. */ + if( ( xResult == MQTTSuccess ) && ( xSessionPresent == false ) ) + { + xResult = prvHandleResubscribe(); + } + } + + return xResult; +} + +static void prvConnectToMQTTBroker( void ) +{ + BaseType_t xNetworkStatus = pdFAIL; + MQTTStatus_t xMQTTStatus; + + /* Initialize network context. */ + xNetworkContextMqtt.pParams = &xTlsTransportParams; + + /* Connect a TCP socket to the broker. */ + xNetworkStatus = prvSocketConnect( &xNetworkContextMqtt ); + configASSERT( xNetworkStatus == pdPASS ); + + /* Initialize the MQTT context with the buffer and transport interface. */ + xMQTTStatus = prvMQTTInit(); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Form an MQTT connection without a persistent session. */ + xMQTTStatus = prvMQTTConnect( true ); + configASSERT( xMQTTStatus == MQTTSuccess ); +} + +static void prvDisconnectFromMQTTBroker( void ) +{ + MQTTAgentCommandContext_t xCommandContext = { 0 }; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTStatus_t xCommandStatus; + + /* Disconnect from broker. */ + LogInfo( ( "Disconnecting the MQTT connection with %s.", democonfigMQTT_BROKER_ENDPOINT ) ); + + xCommandParams.blockTimeMs = MQTT_AGENT_SEND_BLOCK_TIME_MS; + xCommandParams.cmdCompleteCallback = prvCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = &xCommandContext; + xCommandContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xCommandContext.pArgs = NULL; + xCommandContext.xReturnStatus = MQTTSendFailed; + + /* Disconnect MQTT session. */ + xCommandStatus = MQTTAgent_Disconnect( &xGlobalMqttAgentContext, &xCommandParams ); + configASSERT( xCommandStatus == MQTTSuccess ); + + xTaskNotifyWait( 0, + 0, + NULL, + pdMS_TO_TICKS( MQTT_AGENT_MS_TO_WAIT_FOR_NOTIFICATION ) ); + + /* End TLS session, then close TCP connection. */ + prvSocketDisconnect( &xNetworkContextMqtt ); +} + +static OtaMqttStatus_t prvMQTTSubscribe(const char* pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS) +{ + MQTTStatus_t mqttStatus; + uint32_t ulNotifiedValue; + MQTTAgentSubscribeArgs_t xSubscribeArgs = { 0 }; + MQTTSubscribeInfo_t xSubscribeInfo = { 0 }; + BaseType_t result; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xApplicationDefinedContext = { 0 }; + OtaMqttStatus_t otaRet = OtaMqttSuccess; + + configASSERT(pTopicFilter != NULL); + configASSERT(topicFilterLength > 0); + + xSubscribeInfo.pTopicFilter = pTopicFilter; + xSubscribeInfo.topicFilterLength = topicFilterLength; + xSubscribeInfo.qos = ucQoS; + xSubscribeArgs.pSubscribeInfo = &xSubscribeInfo; + xSubscribeArgs.numSubscriptions = 1; + + xApplicationDefinedContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xApplicationDefinedContext.pArgs = &xSubscribeArgs; + xApplicationDefinedContext.xReturnStatus = MQTTSendFailed; + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvMQTTSubscribeCompleteCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xApplicationDefinedContext; + + xTaskNotifyStateClear(NULL); + + mqttStatus = MQTTAgent_Subscribe(&xGlobalMqttAgentContext, + &xSubscribeArgs, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, &ulNotifiedValue, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result == pdTRUE) + { + mqttStatus = xApplicationDefinedContext.xReturnStatus; + } + else + { + mqttStatus = MQTTRecvFailed; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to SUBSCRIBE to topic with error = %u.", + mqttStatus)); + + otaRet = OtaMqttSubscribeFailed; + } + else + { + LogInfo(("Subscribed to topic %.*s.\n\n", + topicFilterLength, + pTopicFilter)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + +static OtaMqttStatus_t prvMQTTPublish(const char* const pacTopic, + uint16_t topicLen, + const char* pMsg, + uint32_t msgSize, + uint8_t qos) +{ + OtaMqttStatus_t otaRet = OtaMqttSuccess; + BaseType_t result; + MQTTStatus_t mqttStatus = MQTTBadParameter; + MQTTPublishInfo_t publishInfo = { 0 }; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xCommandContext = { 0 }; + + publishInfo.pTopicName = pacTopic; + publishInfo.topicNameLength = topicLen; + publishInfo.qos = qos; + publishInfo.pPayload = pMsg; + publishInfo.payloadLength = msgSize; + + xCommandContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + xTaskNotifyStateClear(NULL); + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvCommandCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xCommandContext; + + mqttStatus = MQTTAgent_Publish(&xGlobalMqttAgentContext, + &publishInfo, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, NULL, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result != pdTRUE) + { + mqttStatus = MQTTSendFailed; + } + else + { + mqttStatus = xCommandContext.xReturnStatus; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to send PUBLISH packet to broker with error = %u.", mqttStatus)); + otaRet = OtaMqttPublishFailed; + } + else + { + LogInfo(("Sent PUBLISH packet to broker %.*s to broker.\n\n", + topicLen, + pacTopic)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + +static OtaMqttStatus_t prvMQTTUnsubscribe(const char* pTopicFilter, + uint16_t topicFilterLength, + uint8_t ucQoS) +{ + MQTTStatus_t mqttStatus; + uint32_t ulNotifiedValue; + MQTTAgentSubscribeArgs_t xSubscribeArgs = { 0 }; + MQTTSubscribeInfo_t xSubscribeInfo = { 0 }; + BaseType_t result; + MQTTAgentCommandInfo_t xCommandParams = { 0 }; + MQTTAgentCommandContext_t xApplicationDefinedContext = { 0 }; + OtaMqttStatus_t otaRet = OtaMqttSuccess; + + configASSERT(pTopicFilter != NULL); + configASSERT(topicFilterLength > 0); + + xSubscribeInfo.pTopicFilter = pTopicFilter; + xSubscribeInfo.topicFilterLength = topicFilterLength; + xSubscribeInfo.qos = ucQoS; + xSubscribeArgs.pSubscribeInfo = &xSubscribeInfo; + xSubscribeArgs.numSubscriptions = 1; + + + xApplicationDefinedContext.xTaskToNotify = xTaskGetCurrentTaskHandle(); + + xCommandParams.blockTimeMs = otaexampleMQTT_TIMEOUT_MS; + xCommandParams.cmdCompleteCallback = prvMQTTUnsubscribeCompleteCallback; + xCommandParams.pCmdCompleteCallbackContext = (void*)&xApplicationDefinedContext; + + LogInfo((" Unsubscribing to topic filter: %s", pTopicFilter)); + xTaskNotifyStateClear(NULL); + + + mqttStatus = MQTTAgent_Unsubscribe(&xGlobalMqttAgentContext, + &xSubscribeArgs, + &xCommandParams); + + /* Wait for command to complete so MQTTSubscribeInfo_t remains in scope for the + * duration of the command. */ + if (mqttStatus == MQTTSuccess) + { + result = xTaskNotifyWait(0, otaexampleMAX_UINT32, &ulNotifiedValue, pdMS_TO_TICKS(otaexampleMQTT_TIMEOUT_MS)); + + if (result == pdTRUE) + { + mqttStatus = xApplicationDefinedContext.xReturnStatus; + } + else + { + mqttStatus = MQTTRecvFailed; + } + } + + if (mqttStatus != MQTTSuccess) + { + LogError(("Failed to UNSUBSCRIBE from topic %.*s with error = %u.", + topicFilterLength, + pTopicFilter, + mqttStatus)); + + otaRet = OtaMqttUnsubscribeFailed; + } + else + { + LogInfo(("UNSUBSCRIBED from topic %.*s.\n\n", + topicFilterLength, + pTopicFilter)); + + otaRet = OtaMqttSuccess; + } + + return otaRet; +} + +/*-----------------------------------------------------------*/ + +static void setOtaInterfaces(OtaInterfaces_t* pOtaInterfaces) +{ + configASSERT(pOtaInterfaces != NULL); + + /* Initialize OTA library OS Interface. */ + pOtaInterfaces->os.event.init = OtaInitEvent_FreeRTOS; + pOtaInterfaces->os.event.send = OtaSendEvent_FreeRTOS; + pOtaInterfaces->os.event.recv = OtaReceiveEvent_FreeRTOS; + pOtaInterfaces->os.event.deinit = OtaDeinitEvent_FreeRTOS; + pOtaInterfaces->os.timer.start = OtaStartTimer_FreeRTOS; + pOtaInterfaces->os.timer.stop = OtaStopTimer_FreeRTOS; + pOtaInterfaces->os.timer.delete = OtaDeleteTimer_FreeRTOS; + pOtaInterfaces->os.mem.malloc = Malloc_FreeRTOS; + pOtaInterfaces->os.mem.free = Free_FreeRTOS; + + /* Initialize the OTA library MQTT Interface.*/ + pOtaInterfaces->mqtt.subscribe = prvMQTTSubscribe; + pOtaInterfaces->mqtt.publish = prvMQTTPublish; + pOtaInterfaces->mqtt.unsubscribe = prvMQTTUnsubscribe; + + /* Initialize the OTA library PAL Interface.*/ + pOtaInterfaces->pal.getPlatformImageState = otaPal_GetPlatformImageState; + pOtaInterfaces->pal.setPlatformImageState = otaPal_SetPlatformImageState; + pOtaInterfaces->pal.writeBlock = otaPal_WriteBlock; + pOtaInterfaces->pal.activate = otaPal_ActivateNewImage; + pOtaInterfaces->pal.closeFile = otaPal_CloseFile; + pOtaInterfaces->pal.reset = otaPal_ResetDevice; + pOtaInterfaces->pal.abort = otaPal_Abort; + pOtaInterfaces->pal.createFile = otaPal_CreateFileForRx; +} + +/*-----------------------------------------------------------*/ + +static void prvOTAAgentTask(void* pParam) +{ + /* Calling OTA agent task. */ + OTA_EventProcessingTask(pParam); + LogInfo(("OTA Agent stopped.")); + + vTaskDelete(NULL); +} + +static void prvMQTTAgentTask(void* pParam) +{ + BaseType_t xResult = pdFAIL; + MQTTStatus_t xMQTTStatus = MQTTSuccess; + + (void)pParam; + + do + { + /* MQTTAgent_CommandLoop() is effectively the agent implementation. It + * will manage the MQTT protocol until such time that an error occurs, + * which could be a disconnect. If an error occurs the MQTT context on + * which the error happened is returned so there can be an attempt to + * clean up and reconnect however the application writer prefers. */ + xMQTTStatus = MQTTAgent_CommandLoop(&xGlobalMqttAgentContext); + + /* Clear Agent queue so that no any pending MQTT operations are processed. */ + xQueueReset(xCommandQueue.queue); + + /* Success is returned for application intiated disconnect or termination. The socket will also be disconnected by the caller. */ + if (xMQTTStatus != MQTTSuccess) + { + xResult = prvSuspendOTA(); + configASSERT(xResult == pdPASS); + + LogInfo(("Suspended OTA agent.")); + + /* End TLS session, then close TCP connection. */ + prvSocketDisconnect(&xNetworkContextMqtt); + + /* Connect to MQTT broker. */ + prvConnectToMQTTBroker(); + + xResult = prvResumeOTA(); + configASSERT(xResult == pdPASS); + + LogInfo(("Resumed OTA agent.")); + } + } while (xMQTTStatus != MQTTSuccess); + + vTaskDelete(NULL); +} + +static BaseType_t prvSuspendOTA(void) +{ + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + BaseType_t status = pdPASS; + uint32_t suspendTimeout; + + otaRet = OTA_Suspend(); + + if (otaRet == OtaErrNone) + { + suspendTimeout = OTA_SUSPEND_TIMEOUT_MS; + + while ((OTA_GetState() != OtaAgentStateSuspended) && (suspendTimeout > 0)) + { + /* Wait for OTA Library state to suspend */ + vTaskDelay(pdMS_TO_TICKS(otaexampleTASK_DELAY_MS)); + suspendTimeout -= otaexampleTASK_DELAY_MS; + } + + if (OTA_GetState() != OtaAgentStateSuspended) + { + LogError(("Failed to suspend OTA.")); + status = pdFAIL; + } + } + else + { + LogError(("Error while trying to suspend OTA agent %d", otaRet)); + status = pdFAIL; + } + + return status; +} + +static BaseType_t prvResumeOTA(void) +{ + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + BaseType_t status = pdPASS; + uint32_t suspendTimeout; + + otaRet = OTA_Resume(); + + if (otaRet == OtaErrNone) + { + suspendTimeout = OTA_SUSPEND_TIMEOUT_MS; + + while ((OTA_GetState() == OtaAgentStateSuspended) && (suspendTimeout > 0)) + { + /* Wait for OTA Library state to suspend */ + vTaskDelay(pdMS_TO_TICKS(otaexampleTASK_DELAY_MS)); + suspendTimeout -= otaexampleTASK_DELAY_MS; + } + + if (OTA_GetState() == OtaAgentStateSuspended) + { + LogError(("Failed to resume OTA.")); + status = pdFAIL; + } + } + else + { + LogError(("Error while trying to resume OTA agent %d", otaRet)); + status = pdFAIL; + } + + return status; +} + +static BaseType_t prvRunOTADemo( void ) +{ + /* Status indicating a successful demo or not. */ + BaseType_t xStatus = pdPASS; + + /* OTA library return status. */ + OtaErr_t otaRet = OtaErrNone; + + /* OTA event message used for sending event to OTA Agent.*/ + OtaEventMsg_t eventMsg = { 0 }; + + /* OTA interface context required for library interface functions.*/ + OtaInterfaces_t otaInterfaces; + + /* OTA library packet statistics per job.*/ + OtaAgentStatistics_t otaStatistics = { 0 }; + + /* OTA Agent state returned from calling OTA_GetState.*/ + OtaState_t state = OtaAgentStateStopped; + + /* Set OTA Library interfaces.*/ + setOtaInterfaces( &otaInterfaces ); + + /****************************** Init OTA Library. ******************************/ + + if( xStatus == pdPASS ) + { + if( ( otaRet = OTA_Init( &otaBuffer, + &otaInterfaces, + ( const uint8_t * ) ( democonfigCLIENT_IDENTIFIER ), + otaAppCallback ) ) != OtaErrNone ) + { + LogError( ( "Failed to initialize OTA Agent, exiting = %u.", + otaRet ) ); + + xStatus = pdFAIL; + } + } + + /****************************** Create OTA Agent Task. ******************************/ + + if( xStatus == pdPASS ) + { + xStatus = xTaskCreate( prvOTAAgentTask, + "OTA Agent Task", + OTA_AGENT_TASK_STACK_SIZE, + NULL, + OTA_AGENT_TASK_PRIORITY, + NULL ); + + if( xStatus != pdPASS ) + { + LogError( ( "Failed to create OTA agent task:" ) ); + } + } + + /** + * Register a callback for receiving messages intended for OTA agent from broker, + * for which the topic has not been subscribed for. + */ + prvRegisterOTACallback( OTA_DEFAULT_TOPIC_FILTER, OTA_DEFAULT_TOPIC_FILTER_LENGTH ); + + /****************************** Start OTA ******************************/ + + if( xStatus == pdPASS ) + { + /* Send start event to OTA Agent.*/ + eventMsg.eventId = OtaAgentEventStart; + OTA_SignalEvent( &eventMsg ); + } + + /****************************** Loop and display OTA statistics ******************************/ + + if( xStatus == pdPASS ) + { + while( ( state = OTA_GetState() ) != OtaAgentStateStopped ) + { + /* Get OTA statistics for currently executing job. */ + if( state != OtaAgentStateSuspended ) + { + OTA_GetStatistics( &otaStatistics ); + + LogInfo( ( " Received: %u Queued: %u Processed: %u Dropped: %u", + otaStatistics.otaPacketsReceived, + otaStatistics.otaPacketsQueued, + otaStatistics.otaPacketsProcessed, + otaStatistics.otaPacketsDropped ) ); + } + + vTaskDelay( pdMS_TO_TICKS(otaexampleTASK_DELAY_MS) ); + } + } + + /** + * Remvove callback for receiving messages intended for OTA agent from broker, + * for which the topic has not been subscribed for. + */ + removeSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext, + OTA_DEFAULT_TOPIC_FILTER, + OTA_DEFAULT_TOPIC_FILTER_LENGTH ); + + return xStatus; +} + +/** + * @brief Entry point of Ota demo task. + * + * This example initializes the OTA library to enable OTA updates via the + * MQTT broker. It simply connects to the MQTT broker with the users + * credentials and spins in an indefinite loop to allow MQTT messages to be + * forwarded to the OTA agent for possible processing. The OTA agent does all + * of the real work; checking to see if the message topic is one destined for + * the OTA agent. If not, it is simply ignored. + * + */ +static void vOtaDemoTask( void* pvParam ) +{ + /* Return error status. */ + BaseType_t xReturnStatus = pdPASS; + + /* Flag for MQTT init status. */ + bool mqttInitialized = false; + + ( void )pvParam; + + LogInfo( ( "OTA over MQTT demo, Application version %u.%u.%u", + appFirmwareVersion.u.x.major, + appFirmwareVersion.u.x.minor, + appFirmwareVersion.u.x.build ) ); + + /* Initialize semaphore for buffer operations. */ + xBufferSemaphore = xSemaphoreCreateMutex(); + + if( xBufferSemaphore == NULL ) + { + LogError( ( "Failed to initialize buffer semaphore." ) ); + xReturnStatus = pdFAIL; + } + + /****************************** Init MQTT ******************************/ + + if(xReturnStatus == pdPASS ) + { + /* Create the TCP connection to the broker, then the MQTT connection to the + * same. */ + prvConnectToMQTTBroker(); + } + + /****************************** Create MQTT Agent Task. ******************************/ + + if(xReturnStatus == pdPASS ) + { + if( xTaskCreate( prvMQTTAgentTask, + "MQTT Agent Task", + MQTT_AGENT_TASK_STACK_SIZE, + NULL, + MQTT_AGENT_TASK_PRIORITY, + NULL ) != pdPASS ) + { + xReturnStatus = pdFAIL; + LogError( ( "Failed to create MQTT agent task:" ) ); + } + } + + /****************************** Start OTA Demo. ******************************/ + + if(xReturnStatus == pdPASS) + { + /* Start OTA demo. The function returns only if OTA completes successfully and a + * shutdown of OTA is triggered for a manual restart of the device.*/ + if( prvRunOTADemo() != pdPASS ) + { + xReturnStatus = pdFAIL; + } + } + + /****************************** Cleanup ******************************/ + + if( mqttInitialized ) + { + prvDisconnectFromMQTTBroker(); + } + + if( xBufferSemaphore != NULL ) + { + /* Cleanup semaphore created for buffer operations. */ + vSemaphoreDelete( xBufferSemaphore ); + } +} + +/* + * @brief Create the task that demonstrates the Ota demo. + */ +void vStartOtaDemo(void) +{ + /* + * vOtaDemoTask() connects to the MQTT broker, creates the + * MQTT Agent task and calls the Ota demo loop prvRunOTADemo() + * which creates the OTA Agent task. + */ + + xTaskCreate(vOtaDemoTask, /* Function that implements the task. */ + "OTA Demo Task", /* Text name for the task - only used for debugging. */ + democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ + NULL, /* Optional - task parameter - not used in this case. */ + tskIDLE_PRIORITY + 1, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ + NULL); /* Optional - used to pass out a handle to the created task. */ +} diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSConfig.h new file mode 100644 index 000000000..da40f83a8 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSConfig.h @@ -0,0 +1,210 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- +* Application specific definitions. +* +* These definitions should be adjusted for your particular hardware and +* application requirements. +* +* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE +* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. +* http://www.freertos.org/a00110.html +* +* The bottom of this file contains some constants specific to running the UDP +* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than +* the demo) are contained in FreeRTOSIPConfig.h. +*----------------------------------------------------------*/ +#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 + +/* This demo makes use of one or more example stats formatting functions. These + * format the raw data provided by the uxTaskGetSystemState() function in to human + * readable ASCII form. See the notes in the implementation of vTaskList() within + * FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS + * is set to 2 so the formatting functions are included without the stdio.h being + * included in tasks.c. That is because this project defines its own sprintf() + * functions. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Assert call defined for debug builds. */ +#ifdef _DEBUG + extern void vAssertCalled( const char * pcFile, + uint32_t ulLine ); + #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ ) +#endif /* _DEBUG */ + + + +/* Application specific definitions follow. **********************************/ + +/* 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 */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSIPConfig.h new file mode 100644 index 000000000..8fc154192 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/FreeRTOSIPConfig.h @@ -0,0 +1,310 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 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: + * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ +#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) + +/* ipconfigRAND32() is called by the IP stack to generate random numbers for + * things such as a DHCP transaction number or initial sequence number. Random + * number generation is performed via this macro to allow applications to use their + * own random number generation method. For example, it might be possible to + * generate a random number by sampling noise on an analogue input. */ +extern UBaseType_t uxRand(); +#define ipconfigRAND32() uxRand() + +/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the + * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK + * is not set to 1 then the network event hook will never be called. See + * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml + */ +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 + +/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but + * a network buffer cannot be obtained then the calling task is held in the Blocked + * state (so other tasks can continue to executed) until either a network buffer + * becomes available or the send block time expires. If the send block time expires + * then the send operation is aborted. The maximum allowable send block time is + * capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the + * maximum allowable send block time prevents 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 */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj new file mode 100644 index 000000000..3634d8b61 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj @@ -0,0 +1,669 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid> + <ProjectName>RTOSDemo</ProjectName> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName> + <HeaderFileName> + </HeaderFileName> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging;..\..\..\Common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls;..\..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\..\Source\mbedtls_utils;..\..\..\..\ThirdParty\mbedtls\include;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Ota_Over_Mqtt_Demo;..\..\..\..\..\FreeRTOS-Plus\Demo\Common\coreMQTT_Agent_Interface\include;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\include;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\subscription-manager;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\portable\os;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\Ota_PAL\Win32;..\..\..\..\..\FreeRTOS-Plus\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\Ota_PAL\Win32\Code_Signature_Verification;..\..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreMQTT-Agent\source\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level4</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <AdditionalOptions>/wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions)</AdditionalOptions> + <BrowseInformation>true</BrowseInformation> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <ExceptionHandling>false</ExceptionHandling> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0c09</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/RTOSDemo.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalDependencies>wpcap.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\Common\WinPCap</AdditionalLibraryDirectories> + <Profile>false</Profile> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/WIN32.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName> + <HeaderFileName> + </HeaderFileName> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\..\..\Source\include;..\..\..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0c09</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/RTOSDemo.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories> + <AdditionalDependencies>wpcap.lib;Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/WIN32.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\event_groups.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\list.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\queue.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\stream_buffer.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\tasks.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\timers.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent_command_functions.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder_close_container_checked.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborerrorstrings.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser_dup_string.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty_stdio.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborvalidation.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_base64.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_cbor.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_http.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_interface.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_mqtt.c" /> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_freertos_port.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.c" /> + <ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.c" /> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.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\coreMQTT\source\core_mqtt.c" /> + <ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c" /> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aes.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aesni.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\arc4.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aria.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1parse.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1write.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\base64.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\bignum.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\blowfish.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\camellia.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ccm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\certs.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chacha20.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chachapoly.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher_wrap.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cmac.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ctr_drbg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\debug.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\des.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\dhm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdh.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdsa.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecjpake.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp_curves.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy_poll.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\error.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\gcm.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\havege.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hkdf.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hmac_drbg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md2.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md4.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md5.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\memory_buffer_alloc.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\net_sockets.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\nist_kw.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\oid.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\padlock.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pem.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs11.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs12.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs5.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkparse.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkwrite.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk_wrap.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform_util.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\poly1305.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ripemd160.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa_internal.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha1.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha256.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha512.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cache.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ciphersuites.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cli.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cookie.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_msg.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_srv.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ticket.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_tls.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\threading.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\timing.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version_features.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_crt.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_csr.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_create.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crl.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crt.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_csr.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\xtea.c"> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel> + <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Demo\Common\Logging\windows\Logging_WinSim.c" /> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_agent_message.c" /> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_command_pool.c" /> + <ClCompile Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification_mbedtls.c" /> + <ClCompile Include="..\Common\Ota_PAL\Win32\ota_pal.c" /> + <ClCompile Include="..\Common\subscription-manager\subscription_manager.c" /> + <ClCompile Include="DemoTasks\OtaOverMqttDemoExample.c" /> + <ClCompile Include="main.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\event_groups.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\FreeRTOS.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\portable.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\projdefs.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\queue.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\semphr.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\task.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\timers.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DNS.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP_Private.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Sockets.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Stream_Buffer.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_WIN.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_UDP_IP.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_levels.h" /> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_stack.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_command_functions.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_message_interface.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cbor.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborinternal_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborjson.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\compilersupport_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\tinycbor-version.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\utf8_p.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_appversion32.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_base64_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_cbor_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_config_defaults.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_interface_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_os_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_platform_interface.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_private.h" /> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.h" /> + <ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h" /> + <ClInclude Include="..\..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_errno_TCP.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\threading_alt.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.h" /> + <ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" /> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.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\include\core_mqtt.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aes.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aesni.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\arc4.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aria.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1write.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\base64.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bignum.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\blowfish.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bn_mul.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\camellia.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ccm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\certs.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chacha20.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chachapoly.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\check_config.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cmac.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\compat-1.3.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\config.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ctr_drbg.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\debug.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\des.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\dhm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdh.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdsa.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecjpake.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy_poll.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\error.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\gcm.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\havege.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hkdf.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hmac_drbg.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md2.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md4.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md5.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\memory_buffer_alloc.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net_sockets.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\nist_kw.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\oid.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\padlock.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pem.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs11.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs12.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs5.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_time.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_util.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\poly1305.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\psa_util.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ripemd160.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha1.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha256.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha512.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cache.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ciphersuites.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cookie.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_internal.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ticket.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\threading.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\timing.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\version.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crl.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crt.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_csr.h" /> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\xtea.h" /> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_agent_message.h" /> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_command_pool.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\aws_ota_codesigner_certificate.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification.h" /> + <ClInclude Include="..\Common\Ota_PAL\Win32\ota_pal.h" /> + <ClInclude Include="..\Common\subscription-manager\subscription_manager.h" /> + <ClInclude Include="core_pkcs11_config.h" /> + <ClInclude Include="mbedtls_config.h" /> + <ClInclude Include="demo_config.h" /> + <ClInclude Include="FreeRTOSConfig.h" /> + <ClInclude Include="FreeRTOSIPConfig.h" /> + <ClInclude Include="core_mqtt_config.h" /> + <ClInclude Include="ota_config.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj.filters new file mode 100644 index 000000000..b62302855 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/WIN32.vcxproj.filters @@ -0,0 +1,986 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="FreeRTOS"> + <UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS\Source"> + <UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier> + <Extensions>*.c</Extensions> + </Filter> + <Filter Include="FreeRTOS\Source\Portable"> + <UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+"> + <UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS\Source\include"> + <UniqueIdentifier>{d2dcd641-8d91-492b-852f-5563ffadaec6}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP"> + <UniqueIdentifier>{8672fa26-b119-481f-8b8d-086419c01a3e}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP\portable"> + <UniqueIdentifier>{4570be11-ec96-4b55-ac58-24b50ada980a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS+TCP\include"> + <UniqueIdentifier>{5d93ed51-023a-41ad-9243-8d230165d34b}</UniqueIdentifier> + </Filter> + <Filter Include="DemoTasks"> + <UniqueIdentifier>{b71e974a-9f28-4815-972b-d930ba8a34d0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries"> + <UniqueIdentifier>{60717407-397f-4ea5-8492-3314acdd25f0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard"> + <UniqueIdentifier>{8a90222f-d723-4b4e-8e6e-c57afaf7fa92}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT"> + <UniqueIdentifier>{2d17d5e6-ed70-4e42-9693-f7a63baf4948}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include"> + <UniqueIdentifier>{6ad56e6d-c330-4830-8f4b-c75b05dfa866}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform"> + <UniqueIdentifier>{84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls"> + <UniqueIdentifier>{7bedd2e3-adbb-4c95-9632-445132b459ce}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls\include"> + <UniqueIdentifier>{07a14673-4d02-4780-a099-6b8c654dff91}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\mbedtls\library"> + <UniqueIdentifier>{e875c5e3-40a2-4408-941e-5e1a951cc663}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls"> + <UniqueIdentifier>{8a0aa896-6b3a-49b3-997e-681f0d1949ae}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport"> + <UniqueIdentifier>{c5a01679-3e7a-4320-97ac-ee5b872c1650}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include"> + <UniqueIdentifier>{c992824d-4198-46b2-8d59-5f99ab9946ab}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\transport"> + <UniqueIdentifier>{6a35782c-bc09-42d5-a850-98bcb668a4dc}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON"> + <UniqueIdentifier>{20aee693-d2dc-480e-ae21-0db2156e54ac}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS"> + <UniqueIdentifier>{0dacb84e-5cc3-4eed-8fb1-68b6e4741f77}</UniqueIdentifier> + </Filter> + <Filter Include="Config"> + <UniqueIdentifier>{d286fe5f-3c24-4a2f-881c-4b458623648d}</UniqueIdentifier> + </Filter> + <Filter Include="Logging"> + <UniqueIdentifier>{c8b7bd64-7a0e-458b-bcaa-8081806e4508}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include"> + <UniqueIdentifier>{6c6bc472-3f73-42c1-83e0-ffe6cae93393}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm"> + <UniqueIdentifier>{fcf93295-15e2-4a84-a5e9-b3c162e9f061}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include"> + <UniqueIdentifier>{7de8717e-b494-4eba-ba10-bc8252d9876a}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota"> + <UniqueIdentifier>{3cce55b5-995f-476c-a3a5-9c659a977c89}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include"> + <UniqueIdentifier>{d6ca6595-6585-4fd8-b0dd-224128fbd230}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent"> + <UniqueIdentifier>{044f1490-9d76-41d8-9887-94f5e89cab11}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include"> + <UniqueIdentifier>{28ef5930-f7c7-44f3-9189-749dcdf13cdd}</UniqueIdentifier> + </Filter> + <Filter Include="subscription-manager"> + <UniqueIdentifier>{0025af31-a87a-438e-86fd-8048c9f98025}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable"> + <UniqueIdentifier>{e7b017ae-316c-4d8b-b427-5df150109d0f}</UniqueIdentifier> + </Filter> + <Filter Include="otapal"> + <UniqueIdentifier>{0d8ed7df-8ac2-4ac0-ba27-ca59624bf363}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\tinycbor"> + <UniqueIdentifier>{b43eb5ed-8c56-41eb-a67a-4ce41403629e}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\tinycbor\include"> + <UniqueIdentifier>{4650e6af-01d5-46c3-9674-8554dab982ac}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface"> + <UniqueIdentifier>{e3a23704-31ed-4869-b74e-6d09f842b336}</UniqueIdentifier> + </Filter> + <Filter Include="FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include"> + <UniqueIdentifier>{b5277e13-3a7f-46ab-a73d-7a8aa2831f98}</UniqueIdentifier> + </Filter> + <Filter Include="otapal\code_signature_verification"> + <UniqueIdentifier>{920f406b-9c90-4ea6-8a0b-6e328d6ff095}</UniqueIdentifier> + </Filter> + <Filter Include="otapal\code_signature_verification\include"> + <UniqueIdentifier>{9d7ce275-011a-4bdc-bba5-ad569f629872}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c"> + <Filter>FreeRTOS\Source\Portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\timers.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\list.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\queue.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\tasks.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_DNS.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_ARP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\event_groups.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c"> + <Filter>FreeRTOS\Source\Portable</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c"> + <Filter>FreeRTOS+\FreeRTOS+TCP</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\..\FreeRTOS\Source\stream_buffer.c"> + <Filter>FreeRTOS\Source</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_freertos_port.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aes.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aesni.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\arc4.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\aria.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1parse.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\asn1write.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\base64.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\bignum.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\blowfish.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\camellia.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ccm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\certs.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chacha20.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\chachapoly.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cipher_wrap.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\cmac.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ctr_drbg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\debug.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\des.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\dhm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdh.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecdsa.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecjpake.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ecp_curves.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\entropy_poll.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\error.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\gcm.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\havege.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hkdf.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\hmac_drbg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md2.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md4.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\md5.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\memory_buffer_alloc.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\net_sockets.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\nist_kw.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\oid.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\padlock.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pem.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs11.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs12.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkcs5.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkparse.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pkwrite.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\pk_wrap.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\platform_util.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\poly1305.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ripemd160.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\rsa_internal.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha1.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha256.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\sha512.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cache.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ciphersuites.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cli.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_cookie.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_msg.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_srv.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_ticket.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\ssl_tls.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\threading.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\timing.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\version_features.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_crt.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509write_csr.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_create.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crl.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_crt.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\x509_csr.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\ThirdParty\mbedtls\library\xtea.c"> + <Filter>FreeRTOS+\mbedtls\library</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON</Filter> + </ClCompile> + <ClCompile Include="main.c" /> + <ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Demo\Common\Logging\windows\Logging_WinSim.c"> + <Filter>Logging</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT</Filter> + </ClCompile> + <ClCompile Include="DemoTasks\OtaOverMqttDemoExample.c"> + <Filter>DemoTasks</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_base64.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_cbor.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_http.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_interface.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\ota_mqtt.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter> + </ClCompile> + <ClCompile Include="..\Common\Ota_PAL\Win32\ota_pal.c"> + <Filter>otapal</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborencoder_close_container_checked.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborerrorstrings.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborparser_dup_string.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborpretty_stdio.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborvalidation.c"> + <Filter>FreeRTOS+\tinycbor</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_agent_message.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Common\coreMQTT_Agent_Interface\freertos_command_pool.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClCompile> + <ClCompile Include="..\Common\subscription-manager\subscription_manager.c"> + <Filter>subscription-manager</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter> + </ClCompile> + <ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\core_mqtt_agent_command_functions.c"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent</Filter> + </ClCompile> + <ClCompile Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification_mbedtls.c"> + <Filter>otapal\code_signature_verification</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DNS.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Sockets.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_UDP_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\timers.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\event_groups.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\FreeRTOS.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\queue.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\semphr.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\task.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP_Private.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_ARP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_DHCP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_IP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_TCP_WIN.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOSIPConfigDefaults.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_Stream_Buffer.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\portable.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS\Source\include\projdefs.h"> + <Filter>FreeRTOS\Source\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\mbedtls_error.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\mbedtls_freertos\threading_alt.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\sockets_wrapper.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls\using_mbedtls.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aes.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aesni.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\arc4.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\aria.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\asn1write.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\base64.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bignum.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\blowfish.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\bn_mul.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\camellia.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ccm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\certs.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chacha20.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\chachapoly.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\check_config.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cipher_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\cmac.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\compat-1.3.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\config.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ctr_drbg.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\debug.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\des.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\dhm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdh.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecdsa.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecjpake.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ecp_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\entropy_poll.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\error.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\gcm.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\havege.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hkdf.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\hmac_drbg.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md2.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md4.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md5.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\md_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\memory_buffer_alloc.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\net_sockets.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\nist_kw.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\oid.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\padlock.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pem.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs11.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs12.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pkcs5.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\pk_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_time.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\platform_util.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\poly1305.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\psa_util.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ripemd160.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\rsa_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha1.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha256.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\sha512.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cache.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ciphersuites.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_cookie.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_internal.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\ssl_ticket.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\threading.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\timing.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\version.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crl.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_crt.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\x509_csr.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\ThirdParty\mbedtls\include\mbedtls\xtea.h"> + <Filter>FreeRTOS+\mbedtls\include</Filter> + </ClInclude> + <ClInclude Include="core_mqtt_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="FreeRTOSConfig.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="demo_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="FreeRTOSIPConfig.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_levels.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\Utilities\logging\logging_stack.h"> + <Filter>Logging</Filter> + </ClInclude> + <ClInclude Include="mbedtls_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\FreeRTOS-Plus-TCP\include\FreeRTOS_errno_TCP.h"> + <Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_appversion32.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_base64_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_cbor_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_config_defaults.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_http_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_interface_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_mqtt_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_os_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_platform_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\include\ota_private.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include</Filter> + </ClInclude> + <ClInclude Include="ota_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\portable\os\ota_os_freertos.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\ota_pal.h"> + <Filter>otapal</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cbor.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborinternal_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\cborjson.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\compilersupport_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\tinycbor-version.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\AWS\ota\source\dependency\3rdparty\tinycbor\src\utf8_p.h"> + <Filter>FreeRTOS+\tinycbor\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_agent_message.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Common\coreMQTT_Agent_Interface\include\freertos_command_pool.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\subscription-manager\subscription_manager.h"> + <Filter>subscription-manager</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\code_signature_verification.h"> + <Filter>otapal\code_signature_verification\include</Filter> + </ClInclude> + <ClInclude Include="core_pkcs11_config.h"> + <Filter>Config</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_command_functions.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include\core_mqtt_agent_message_interface.h"> + <Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include</Filter> + </ClInclude> + <ClInclude Include="..\Common\Ota_PAL\Win32\Code_Signature_Verification\aws_ota_codesigner_certificate.h"> + <Filter>otapal\code_signature_verification\include</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_mqtt_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_mqtt_config.h new file mode 100644 index 000000000..f4d8df3cc --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_mqtt_config.h @@ -0,0 +1,109 @@ +/* + * FreeRTOS V202012.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 CORE_MQTT_CONFIG_H +#define CORE_MQTT_CONFIG_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 MQTT. + * 3. Include the header file "logging_stack.h", if logging is enabled for MQTT. + */ + +#include "logging_levels.h" + +/* Logging configuration for the MQTT library. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "MQTT" +#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 ****************/ + +/** + * @brief The maximum number of MQTT PUBLISH messages that may be pending + * acknowledgement at any time. + * + * QoS 1 and 2 MQTT PUBLISHes require acknowledgment from the server before + * they can be completed. While they are awaiting the acknowledgment, the + * client must maintain information about their state. The value of this + * macro sets the limit on how many simultaneous PUBLISH states an MQTT + * context maintains. + */ +#define MQTT_STATE_ARRAY_MAX_COUNT 10U + + /*********************** coreMQTT Agent Configurations **********************/ + /** + * @brief The maximum number of pending acknowledgments to track for a single + * connection. + * + * @note The MQTT agent tracks MQTT commands (such as PUBLISH and SUBSCRIBE) th + * at are still waiting to be acknowledged. MQTT_AGENT_MAX_OUTSTANDING_ACKS set + * the maximum number of acknowledgments that can be outstanding at any one time. + * The higher this number is the greater the agent's RAM consumption will be. + */ +#define MQTT_AGENT_MAX_OUTSTANDING_ACKS ( 20U ) + + /** + * @brief Time in MS that the MQTT agent task will wait in the Blocked state (so + * not using any CPU time) for a command to arrive in its command queue before + * exiting the blocked state so it can call MQTT_ProcessLoop(). + * + * @note It is important MQTT_ProcessLoop() is called often if there is known + * MQTT traffic, but calling it too often can take processing time away from + * lower priority tasks and waste CPU time and power. + */ +#define MQTT_AGENT_MAX_EVENT_QUEUE_WAIT_TIME ( 1000 ) + + /** + * @brief The number of command structures to allocate in the pool + * for the agent. + */ +#define MQTT_COMMAND_CONTEXTS_POOL_SIZE 10 + + +#endif /* ifndef CORE_MQTT_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_pkcs11_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_pkcs11_config.h new file mode 100644 index 000000000..54906f452 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/core_pkcs11_config.h @@ -0,0 +1,187 @@ +/* + * FreeRTOS V202012.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" + +/** + * @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 32 + +/** + * @brief Maximum number of token objects that can be stored + * by the PKCS #11 module. + */ +#define pkcs11configMAX_NUM_OBJECTS 6 + +/** + * @brief Maximum number of sessions that can be stored + * by the PKCS #11 module. + */ +#define pkcs11configMAX_SESSIONS 10 + +/** + * @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 0 + +/** + * @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 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 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_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/demo_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/demo_config.h new file mode 100644 index 000000000..2ced794b0 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/demo_config.h @@ -0,0 +1,409 @@ +/* + * FreeRTOS V202012.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef DEMO_CONFIG_H +#define DEMO_CONFIG_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 DEMO. + * 3. Include the header file "logging_stack.h", if logging is enabled for DEMO. + */ + +#include "logging_levels.h" + +/* Logging configuration for the Demo. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "OTADemo" +#endif + +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_DEBUG +#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 ****************/ + +/** + * @brief The version for the firmware which is running. OTA agent uses this + * version number to perform anti-rollback validation. The firmware version for the + * download image should be higher than the current version, otherwise the new image is + * rejected in self test phase. + */ +#define APP_VERSION_MAJOR 0 +#define APP_VERSION_MINOR 9 +#define APP_VERSION_BUILD 2 + +/** + * @brief The MQTT client identifier used in this example. Each client identifier + * must be unique so edit as required to ensure no two clients connecting to the + * same broker use the same client identifier. + * + *!!! Please note a #defined constant is used for convenience of demonstration + *!!! only. Production devices can use something unique to the device that can + *!!! be read by software, such as a production serial number, instead of a + *!!! hard coded constant. + * + */ + +/** + * @brief Endpoint of the MQTT broker to connect to. + * + * This demo application can be run with any MQTT broker, although it is + * recommended to use one that supports mutual authentication. If mutual + * authentication is not used, then #democonfigUSE_TLS should be set to 0. + * + * For AWS IoT MQTT broker, this is the Thing's REST API Endpoint. + * + * @note Your AWS IoT Core endpoint can be found in the AWS IoT console under + * Settings/Custom Endpoint, or using the describe-endpoint REST API (with + * AWS CLI command line tool). + * + */ + +/** + * @brief The port to use for the demo. + * + * In general, port 8883 is for secured MQTT connections, and port 1883 if not + * using TLS. + * + * @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol + * name. Using ALPN with this demo would require additional changes, including + * setting the `pAlpnProtos` member of the `NetworkCredentials_t` struct before + * forming the TLS connection. When using port 8883, ALPN is not required. + * + * #define democonfigMQTT_BROKER_PORT ( insert here. ) + */ +#define democonfigMQTT_BROKER_PORT ( 8883 ) + +/** + * @brief Server's root CA certificate. + * + * For AWS IoT MQTT broker, this certificate is used to identify the AWS IoT + * server and is publicly available. Refer to the AWS documentation available + * in the link below. + * https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs + * + * @note This certificate should be PEM-encoded. + * + * @note If you would like to setup an MQTT broker for running this demo, + * please see `mqtt_broker_setup.txt`. + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n"\ + * "...base64 data...\n"\ + * "-----END CERTIFICATE-----\n" + * + * #define democonfigROOT_CA_PEM "...insert here..." + */ + +/** + * @brief Client certificate. + * + * For AWS IoT MQTT broker, refer to the AWS documentation below for details + * regarding client authentication. + * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html + * + * @note This certificate should be PEM-encoded. + * + * Must include the PEM header and footer: + * "-----BEGIN CERTIFICATE-----\n"\ + * "...base64 data...\n"\ + * "-----END CERTIFICATE-----\n" + * + * #define democonfigCLIENT_CERTIFICATE_PEM "...insert here..." + */ + +/** + * @brief Client's private key. + * + *!!! Please note pasting a key into the header file in this manner is for + *!!! convenience of demonstration only and should not be done in production. + *!!! Never paste a production private key here!. Production devices should + *!!! store keys securely, such as within a secure element. Additionally, + *!!! we provide the corePKCS library that further enhances security by + *!!! enabling securely stored keys to be used without exposing them to + *!!! software. + * + * For AWS IoT MQTT broker, refer to the AWS documentation below for details + * regarding clientauthentication. + * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html + * + * @note This private key should be PEM-encoded. + * + * Must include the PEM header and footer: + * "-----BEGIN RSA PRIVATE KEY-----\n"\ + * "...base64 data...\n"\ + * "-----END RSA PRIVATE KEY-----\n" + * + * #define democonfigCLIENT_PRIVATE_KEY_PEM "...insert here..." + */ + +/** + * @brief An option to disable Server Name Indication. + * + * @note When using a local Mosquitto server setup, SNI needs to be disabled + * for an MQTT broker that only has an IP address but no hostname. However, + * SNI should be enabled whenever possible. + */ +#define democonfigDISABLE_SNI ( pdFALSE ) + +/** + * @brief Configuration that indicates if the demo connection is made to the AWS IoT Core MQTT broker. + * + * If username/password based authentication is used, the demo will use appropriate TLS ALPN and + * SNI configurations as required for the Custom Authentication feature of AWS IoT. + * For more information, refer to the following documentation: + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html#custom-auth-mqtt + * + * #define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 ) + */ +#define democonfigUSE_AWS_IOT_CORE_BROKER ( 1 ) + +/** + * @brief The username value for authenticating client to the MQTT broker when + * username/password based client authentication is used. + * + * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for + * details regarding client authentication with a username and password. + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html + * An authorizer setup needs to be done, as mentioned in the above link, to use + * username/password based client authentication. + * + * #define democonfigCLIENT_USERNAME "...insert here..." + */ + +/** + * @brief The password value for authenticating client to the MQTT broker when + * username/password based client authentication is used. + * + * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for + * details regarding client authentication with a username and password. + * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html + * An authorizer setup needs to be done, as mentioned in the above link, to use + * username/password based client authentication. + * + * #define democonfigCLIENT_PASSWORD "...insert here..." + */ + +/** + * @brief The name of the operating system that the application is running on. + * The current value is given as an example. Please update for your specific + * operating system. + */ +#define democonfigOS_NAME "FreeRTOS" + +/** + * @brief The version of the operating system that the application is running + * on. The current value is given as an example. Please update for your specific + * operating system version. + */ +#define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER + +/** + * @brief The name of the hardware platform the application is running on. The + * current value is given as an example. Please update for your specific + * hardware platform. + */ +#define democonfigHARDWARE_PLATFORM_NAME "WinSim" + +/** + * @brief The name of the MQTT library used and its version, following an "@" + * symbol. + */ +#define democonfigMQTT_LIB "core-mqtt@1.0.0" + +/** + * @brief Whether to use mutual authentication. If this macro is not set to 1 + * or not defined, then plaintext TCP will be used instead of TLS over TCP. + */ +#define democonfigUSE_TLS 1 + +/** + * @brief Set the stack size of the main demo task. + * + * In the Windows port, this stack only holds a structure. The actual + * stack is created by an operating system thread. + */ +#define democonfigDEMO_STACKSIZE configMINIMAL_STACK_SIZE + +/********************************************************************************** +* Error checks and derived values only below here - do not edit below here. -----* +**********************************************************************************/ + + +/* Compile time error for some undefined configs, and provide default values + * for others. */ +#ifndef democonfigMQTT_BROKER_ENDPOINT + #error "Please define democonfigMQTT_BROKER_ENDPOINT in demo_config.h." +#endif + +#ifndef democonfigCLIENT_IDENTIFIER + +/** + * @brief The MQTT client identifier used in this example. Each client identifier + * must be unique so edit as required to ensure no two clients connecting to the + * same broker use the same client identifier. Using a #define is for convenience + * of demonstration only - production devices should use something unique to the + * device that can be read from software - such as a production serial number. + */ + #error "Please define democonfigCLIENT_IDENTIFIER in demo_config.h to something unique for this device." +#endif + + +#if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) + #ifndef democonfigROOT_CA_PEM + #error "Please define Root CA certificate of the MQTT broker(democonfigROOT_CA_PEM) in demo_config.h." + #endif + +/* If no username is defined, then a client certificate/key is required. */ + #ifndef democonfigCLIENT_USERNAME + +/* + *!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for + *!!! convenience of demonstration only. Production devices should + *!!! store keys securely, such as within a secure element. + */ + + #ifndef democonfigCLIENT_CERTIFICATE_PEM + #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." + #endif + #ifndef democonfigCLIENT_PRIVATE_KEY_PEM + #error "Please define client private key(democonfigCLIENT_PRIVATE_KEY_PEM) in demo_config.h." + #endif + #else + +/* If a username is defined, a client password also would need to be defined for + * client authentication. */ + #ifndef democonfigCLIENT_PASSWORD + #error "Please define client password(democonfigCLIENT_PASSWORD) in demo_config.h for client authentication based on username/password." + #endif + +/* AWS IoT MQTT broker port needs to be 443 for client authentication based on + * username/password. */ + #if defined( democonfigUSE_AWS_IOT_CORE_BROKER ) && democonfigMQTT_BROKER_PORT != 443 + #error "Broker port(democonfigMQTT_BROKER_PORT) should be defined as 443 in demo_config.h for client authentication based on username/password in AWS IoT Core." + #endif + #endif /* ifndef democonfigCLIENT_USERNAME */ + + #ifndef democonfigMQTT_BROKER_PORT + #define democonfigMQTT_BROKER_PORT ( 8883 ) + #endif +#else /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */ + #ifndef democonfigMQTT_BROKER_PORT + #define democonfigMQTT_BROKER_PORT ( 1883 ) + #endif +#endif /* if defined( democonfigUSE_TLS ) && ( democonfigUSE_TLS == 1 ) */ + +/** + * @brief ALPN (Application-Layer Protocol Negotiation) protocol name for AWS IoT MQTT. + * + * This will be used if democonfigMQTT_BROKER_PORT is configured as 443 for the AWS IoT MQTT broker. + * Please see more details about the ALPN protocol for AWS IoT MQTT endpoint + * in the link below. + * https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/ + */ +#define AWS_IOT_MQTT_ALPN "\x0ex-amzn-mqtt-ca" + +/** + * @brief This is the ALPN (Application-Layer Protocol Negotiation) string + * required by AWS IoT for password-based authentication using TCP port 443. + */ +#define AWS_IOT_CUSTOM_AUTH_ALPN "\x04mqtt" + +/** + * Provide default values for undefined configuration settings. + */ +#ifndef democonfigOS_NAME + #define democonfigOS_NAME "FreeRTOS" +#endif + +#ifndef democonfigOS_VERSION + #define democonfigOS_VERSION tskKERNEL_VERSION_NUMBER +#endif + +#ifndef democonfigHARDWARE_PLATFORM_NAME + #define democonfigHARDWARE_PLATFORM_NAME "WinSim" +#endif + +#ifndef democonfigMQTT_LIB + #define democonfigMQTT_LIB "core-mqtt@1.0.0" +#endif + +/** + * @brief The MQTT metrics string expected by AWS IoT. + */ +#define AWS_IOT_METRICS_STRING \ + "?SDK=" democonfigOS_NAME "&Version=" democonfigOS_VERSION \ + "&Platform=" democonfigHARDWARE_PLATFORM_NAME "&MQTTLib=" democonfigMQTT_LIB + +/** + * @brief The length of the MQTT metrics string expected by AWS IoT. + */ +#define AWS_IOT_METRICS_STRING_LENGTH ( ( uint16_t ) ( sizeof( AWS_IOT_METRICS_STRING ) - 1 ) ) + +#ifdef democonfigCLIENT_USERNAME + +/** + * @brief Append the username with the metrics string if #democonfigCLIENT_USERNAME is defined. + * + * This is to support both metrics reporting and username/password based client + * authentication by AWS IoT. + */ + #define CLIENT_USERNAME_WITH_METRICS democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING +#endif + +/** + * @brief Length of client identifier. + */ +#define democonfigCLIENT_IDENTIFIER_LENGTH ( ( uint16_t ) ( sizeof( democonfigCLIENT_IDENTIFIER ) - 1 ) ) + +/** + * @brief Length of MQTT server host name. + */ +#define democonfigBROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( democonfigMQTT_BROKER_ENDPOINT ) - 1 ) ) + + +#endif /* DEMO_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/main.c b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/main.c new file mode 100644 index 000000000..4b89797fe --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/main.c @@ -0,0 +1,376 @@ +/* + * FreeRTOS V202012.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 https://www.FreeRTOS.org/coremqtt for configuration and usage instructions. + ***/ + +/* Standard includes. */ +#include <stdio.h> +#include <time.h> + +/* Visual studio intrinsics used so the __debugbreak() function is available + * should an assert get hit. */ +#include <intrin.h> + +/* FreeRTOS includes. */ +#include <FreeRTOS.h> +#include "task.h" + +/* TCP/IP stack includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* Demo logging includes. */ +#include "logging.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + + +/* + * Prototypes for the demos that can be started from this project. Note the + * Ota demo is not actually started until the network is already, which is + * indicated by vApplicationIPNetworkEventHook() executing - hence + * vStartOtaDemo() is called from inside vApplicationIPNetworkEventHook(). + */ +extern void vStartOtaDemo( 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(); + + /* 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 ); + + /* Start the RTOS scheduler. */ + vTaskStartScheduler(); + + /* If all is well, the scheduler will now be running, and the following + * 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). */ + for( ; ; ) + { + __debugbreak(); + } +} +/*-----------------------------------------------------------*/ + +/* 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" ) ); + vStartOtaDemo(); + 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; + + 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 ); + LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) ); +} +/*-----------------------------------------------------------*/ + +#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. + * The macros ipconfigRAND32() and configRAND32() are not in use + * anymore in FreeRTOS+TCP. + * + * 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; +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/mbedtls_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/mbedtls_config.h new file mode 100644 index 000000000..5f24aa1de --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/mbedtls_config.h @@ -0,0 +1,134 @@ +/* + * FreeRTOS V202012.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 +#define MBEDTLS_X509_CREATE_C +#define MBEDTLS_PK_WRITE_C +#define MBEDTLS_X509_CSR_WRITE_C + +/* 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_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 ); + +/* 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_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_config.h b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_config.h new file mode 100644 index 000000000..3aea2ee86 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_config.h @@ -0,0 +1,200 @@ +/* + * FreeRTOS V202012.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 ota_config.h + * @brief OTA user configurable settings. + */ + +#ifndef OTA_CONFIG_H_ +#define OTA_CONFIG_H_ + +/**************************************************/ +/******* DO NOT CHANGE the following order ********/ +/**************************************************/ + +/* Logging related header files are required to be included in the following order: + * 1. Include the header file "logging_levels.h". + * 2. Define LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL. + * 3. Include the header file "logging_stack.h". + */ + +/* Include header that defines log levels. */ +#include "logging_levels.h" + +/* Configure name and log level for the OTA library. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "OTA" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#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 ****************/ + +/** + * @brief Log base 2 of the size of the file data block message (excluding the header). + * + * 10 bits yields a data block size of 1KB. + */ +#define otaconfigLOG2_FILE_BLOCK_SIZE 11UL + +/** + * @brief Size of the file data block message (excluding the header). + * + */ +#define otaconfigFILE_BLOCK_SIZE ( 1UL << otaconfigLOG2_FILE_BLOCK_SIZE ) + +/** + * @brief Milliseconds to wait for the self test phase to succeed before we force reset. + */ +#define otaconfigSELF_TEST_RESPONSE_WAIT_MS 16000U + +/** + * @brief Milliseconds to wait before requesting data blocks from the OTA service if nothing is happening. + * + * The wait timer is reset whenever a data block is received from the OTA service so we will only send + * the request message after being idle for this amount of time. + */ +#define otaconfigFILE_REQUEST_WAIT_MS 10000U + +/** + * @brief The maximum allowed length of the thing name used by the OTA agent. + * + * AWS IoT requires Thing names to be unique for each device that connects to the broker. + * Likewise, the OTA agent requires the developer to construct and pass in the Thing name when + * initializing the OTA agent. The agent uses this size to allocate static storage for the + * Thing name used in all OTA base topics. Namely $aws/things/<thingName> + */ +#define otaconfigMAX_THINGNAME_LEN 128U + +/** + * @brief The maximum number of data blocks requested from OTA streaming service. + * + * This configuration parameter is sent with data requests and represents the maximum number of + * data blocks the service will send in response. The maximum limit for this must be calculated + * from the maximum data response limit (128 KB from service) divided by the block size. + * For example if block size is set as 1 KB then the maximum number of data blocks that we can + * request is 128/1 = 128 blocks. Configure this parameter to this maximum limit or lower based on + * how many data blocks response is expected for each data requests. + * Please note that this must be set larger than zero. + * + */ +#define otaconfigMAX_NUM_BLOCKS_REQUEST 4U + +/** + * @brief The maximum number of requests allowed to send without a response before we abort. + * + * This configuration parameter sets the maximum number of times the requests are made over + * the selected communication channel before aborting and returning error. + * + */ +#define otaconfigMAX_NUM_REQUEST_MOMENTUM 32U + +/** + * @brief The number of data buffers reserved by the OTA agent. + * + * This configurations parameter sets the maximum number of static data buffers used by + * the OTA agent for job and file data blocks received. + */ +#define otaconfigMAX_NUM_OTA_DATA_BUFFERS 5U + +/** + * @brief How frequently the device will report its OTA progress to the cloud. + * + * Device will update the job status with the number of blocks it has received every certain + * number of blocks it receives. For example, 25 means device will update job status every 25 blocks + * it receives. + */ +#define otaconfigOTA_UPDATE_STATUS_FREQUENCY 25U + + + +/** + * @brief Allow update to same or lower version. + * + * Set this to 1 to allow downgrade or same version update.This configurations parameter + * disables version check and allows update to a same or lower version.This is provided for + * testing purpose and it is recommended to always update to higher version and keep this + * configuration disabled. + */ +#define otaconfigAllowDowngrade 0U + +/** + * @brief The protocol selected for OTA control operations. + * + * This configurations parameter sets the default protocol for all the OTA control + * operations like requesting OTA job, updating the job status etc. + * + * Note - Only MQTT is supported at this time for control operations. + */ +#define configENABLED_CONTROL_PROTOCOL ( OTA_CONTROL_OVER_MQTT ) + +/** + * @brief The protocol selected for OTA data operations. + * + * This configurations parameter sets the protocols selected for the data operations + * like requesting file blocks from the service. + * + * Note - Both MQTT and HTTP is supported for data transfer from service. This configuration parameter + * can be set to following - + * Enable data over MQTT - ( OTA_DATA_OVER_MQTT ) + * Enable data over HTTP - ( OTA_DATA_OVER_HTTP) + * + * Note - Please check the OTA over HTTP demo which has the HTTP data trasnfer functionality and + * and this configuration is set to OTA_DATA_OVER_HTTP. + */ +#define configENABLED_DATA_PROTOCOLS ( OTA_DATA_OVER_MQTT ) + +/** + * @brief The preferred protocol selected for OTA data operations. + * + * Primary data protocol will be the protocol used for downloading file if more than + * one protocol is selected while creating OTA job. Default primary data protocol is MQTT + * and following update here to switch to HTTP as primary. + * + * Note - use OTA_DATA_OVER_HTTP for HTTP as primary data protocol. + */ + +#define configOTA_PRIMARY_DATA_PROTOCOL ( OTA_DATA_OVER_MQTT ) + +#endif /* OTA_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_over_mqtt_demo.sln b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_over_mqtt_demo.sln new file mode 100644 index 000000000..dcfc1fe09 --- /dev/null +++ b/FreeRTOS-Plus/Demo/AWS/Ota_Windows_Simulator/Ota_Over_Mqtt_Demo/ota_over_mqtt_demo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29215.179 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4} + EndGlobalSection + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi + EndGlobalSection +EndGlobal diff --git a/FreeRTOS-Plus/Source/AWS/ota b/FreeRTOS-Plus/Source/AWS/ota new file mode 160000 +Subproject 826b4b40fdbd5f7746df48a650c18d0556aae41 |