From 957fb26dbe68627d2d0fd7bdd242bddd347de175 Mon Sep 17 00:00:00 2001 From: andysun2015 Date: Wed, 10 Nov 2021 11:38:44 +0800 Subject: Add cellular library submodule path and demo (#695) * [Cellular] Add cellulr lib submodule and demo app * [Cellular] Fix memory violation in transport layer and add using LoggingPrintf * Update FreeRTOS Cellular Interface * Change the mbedtls usage in FreeRTOS-Plus * [Cellular] Fix missing spell * [Cellular] Add manifest.yml * Fix missing spell * Update manifest.yml * [Cellular] Add integration test * Modify the demo log level to LOG_INFO * Update cellular interface * The modification of the folder structure for cellular library * Rename the naming of demo * Adjust the location of using_mbedtls and socket_wrapper * Adjust project setting for relocating using_mbedtls and socket_wrapper * Turn off PSM mode * Add start marker for CI validation. * The modification for mbedtls platform send/recv function for cellular * Change the project file due to the changes of mbedtls platform send/recv function for cellular * Fix missing newline and remove unused file * Add missing configuration. * Make cellular and freertos tcp plus use the same transport implementation * Add comment for the macro MBEDTLS_SSL_SEND and MBEDTLS_SSL_RECV * Make changes from the github comment. --- .gitmodules | 3 + .../Device_Defender_Demo/WIN32.vcxproj | 1257 ++--- .../Device_Defender_Demo/WIN32.vcxproj.filters | 1641 +++---- .../Device_Defender_Demo/mbedtls_config.h | 5 + .../Device_Shadow_Demo/WIN32.vcxproj | 13 +- .../Device_Shadow_Demo/WIN32.vcxproj.filters | 35 +- .../Device_Shadow_Demo/mbedtls_config.h | 5 + .../Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj | 13 +- .../Jobs_Demo/WIN32.vcxproj.filters | 36 +- .../Jobs_Demo/mbedtls_config.h | 5 + .../Ota_Over_Http_Demo/WIN32.vcxproj | 1353 +++--- .../Ota_Over_Http_Demo/WIN32.vcxproj.filters | 2057 +++++---- .../Ota_Over_Http_Demo/mbedtls_config.h | 5 + .../Ota_Over_Mqtt_Demo/WIN32.vcxproj | 1337 +++--- .../Ota_Over_Mqtt_Demo/WIN32.vcxproj.filters | 1973 ++++---- .../Ota_Over_Mqtt_Demo/mbedtls_config.h | 5 + .../Common/cellular_platform.c | 233 + .../Common/cellular_platform.h | 169 + .../Common/cellular_setup.c | 217 + .../Common/comm_if_windows.c | 912 ++++ .../Common/main.c | 346 ++ .../DemoTasks/MutualAuthMQTTExample.c | 1074 +++++ .../FreeRTOSConfig.h | 210 + .../FreeRTOSIPConfig.h | 310 ++ .../MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj | 644 +++ .../WIN32.vcxproj.filters | 895 ++++ .../cellular_config.h | 69 + .../core_mqtt_config.h | 80 + .../MQTT_Mutual_Auth_Demo_with_BG96/demo_config.h | 273 ++ .../mbedtls_config.h | 137 + .../mqtt_mutual_auth_demo_with_bg96.sln | 25 + .../DemoTasks/MutualAuthMQTTExample.c | 1074 +++++ .../FreeRTOSConfig.h | 210 + .../FreeRTOSIPConfig.h | 310 ++ .../WIN32.vcxproj | 644 +++ .../WIN32.vcxproj.filters | 897 ++++ .../cellular_config.h | 76 + .../core_mqtt_config.h | 80 + .../demo_config.h | 273 ++ .../mbedtls_config.h | 137 + .../mqtt_mutual_auth_demo_with_hl7802.sln | 25 + .../DemoTasks/MutualAuthMQTTExample.c | 1074 +++++ .../FreeRTOSConfig.h | 210 + .../FreeRTOSIPConfig.h | 310 ++ .../WIN32.vcxproj | 644 +++ .../WIN32.vcxproj.filters | 895 ++++ .../cellular_config.h | 113 + .../core_mqtt_config.h | 80 + .../demo_config.h | 273 ++ .../mbedtls_config.h | 137 + .../mqtt_mutual_auth_demo_with_sara_r4.sln | 25 + .../HTTP_Mutual_Auth/WIN32.vcxproj | 1229 ++--- .../HTTP_Mutual_Auth/WIN32.vcxproj.filters | 1541 ++++--- .../HTTP_Mutual_Auth/mbedtls_config.h | 5 + .../HTTP_Plaintext/WIN32.vcxproj | 10 +- .../HTTP_Plaintext/WIN32.vcxproj.filters | 24 +- .../HTTP_S3_Download/WIN32.vcxproj | 1229 ++--- .../HTTP_S3_Download/WIN32.vcxproj.filters | 1541 ++++--- .../HTTP_S3_Download/mbedtls_config.h | 5 + .../HTTP_S3_Download_Multithreaded/WIN32.vcxproj | 1229 ++--- .../WIN32.vcxproj.filters | 1541 ++++--- .../mbedtls_config.h | 5 + .../HTTP_S3_Upload/WIN32.vcxproj | 1229 ++--- .../HTTP_S3_Upload/WIN32.vcxproj.filters | 1541 ++++--- .../HTTP_S3_Upload/mbedtls_config.h | 5 + .../MQTT_Basic_TLS/WIN32.vcxproj | 1229 ++--- .../MQTT_Basic_TLS/WIN32.vcxproj.filters | 1545 ++++--- .../MQTT_Basic_TLS/mbedtls_config.h | 5 + .../MQTT_Keep_Alive/WIN32.vcxproj | 10 +- .../MQTT_Keep_Alive/WIN32.vcxproj.filters | 24 +- .../MQTT_Multitask/WIN32.vcxproj | 1257 ++--- .../MQTT_Multitask/WIN32.vcxproj.filters | 1657 +++---- .../MQTT_Multitask/mbedtls_config.h | 5 + .../MQTT_Mutual_Auth/WIN32.vcxproj | 1229 ++--- .../MQTT_Mutual_Auth/WIN32.vcxproj.filters | 1543 ++++--- .../MQTT_Mutual_Auth/mbedtls_config.h | 5 + .../MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj | 10 +- .../MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj.filters | 16 +- .../MQTT_Plain_Text/WIN32.vcxproj | 10 +- .../MQTT_Plain_Text/WIN32.vcxproj.filters | 16 +- .../WIN32.vcxproj | 11 +- .../WIN32.vcxproj.filters | 30 +- .../mbedtls_config.h | 5 + .../Demo/coreSNTP_Windows_Simulator/WIN32.vcxproj | 1 + .../freertos_plus_tcp/sockets_wrapper.c | 173 - .../freertos_plus_tcp/sockets_wrapper.h | 104 - .../using_mbedtls/using_mbedtls.c | 847 ---- .../using_mbedtls/using_mbedtls.h | 218 - .../using_mbedtls_pkcs11/using_mbedtls_pkcs11.c | 1011 ---- .../using_mbedtls_pkcs11/using_mbedtls_pkcs11.h | 231 - .../using_plaintext/using_plaintext.c | 199 - .../using_plaintext/using_plaintext.h | 152 - .../using_wolfSSL/using_wolfSSL.c | 536 --- .../using_wolfSSL/using_wolfSSL.h | 199 - .../sockets_wrapper/cellular/sockets_wrapper.c | 931 ++++ .../sockets_wrapper/cellular/sockets_wrapper.h | 136 + .../freertos_plus_tcp/sockets_wrapper.c | 173 + .../freertos_plus_tcp/sockets_wrapper.h | 104 + .../using_mbedtls/using_mbedtls/using_mbedtls.c | 851 ++++ .../using_mbedtls/using_mbedtls/using_mbedtls.h | 218 + .../using_mbedtls_pkcs11/using_mbedtls_pkcs11.c | 1011 ++++ .../using_mbedtls_pkcs11/using_mbedtls_pkcs11.h | 231 + .../using_plaintext/using_plaintext.c | 199 + .../using_plaintext/using_plaintext.h | 152 + .../using_mbedtls/using_wolfSSL/using_wolfSSL.c | 536 +++ .../using_mbedtls/using_wolfSSL/using_wolfSSL.h | 199 + FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface | 1 + .../mbedtls_bio_freertos_cellular.c | 96 + .../mbedtls_bio_freertos_plus_tcp.c | 136 + .../mbedtls_freertos/mbedtls_freertos_port.c | 101 - .../Integration/Config/FreeRTOSConfig.h | 209 + .../Integration/Config/FreeRTOSIPConfig.h | 309 ++ .../FreeRTOS-Cellular-Interface-Integration.sln | 23 + .../Test_Cases/freertos_tcp_test_access_declare.h | 44 + .../freertos_tcp_test_access_dns_define.h | 48 + .../freertos_tcp_test_access_tcp_define.h | 53 + .../Test_code/Test_Cases/test_freertos_tcp.c | 369 ++ .../Test_code/Test_Runner/test_runner.c | 108 + .../Test_code/Test_Runner/test_runner.h | 77 + .../Test_code/Test_Runner/test_runner_config.h | 76 + .../Integration/Test_code/test_cellular_api.c | 2819 +++++++++++ .../Integration/Test_code/test_config.h | 84 + .../Integration/WIN32.vcxproj | 1755 +++++++ .../Integration/WIN32.vcxproj.filters | 4873 ++++++++++++++++++++ .../Integration/WIN32.vcxproj.user | 4 + .../Integration/WinPCap/Packet32.h | 398 ++ .../Integration/WinPCap/PacketData.h | 270 ++ .../Integration/WinPCap/Win32-Extensions.h | 127 + .../Integration/WinPCap/arch.c | 338 ++ .../Integration/WinPCap/bittypes.h | 137 + .../Integration/WinPCap/ip6_misc.h | 165 + .../Integration/WinPCap/netif.h | 52 + .../Integration/WinPCap/pcap-bpf.h | 47 + .../Integration/WinPCap/pcap-namedb.h | 42 + .../Integration/WinPCap/pcap-stdinc.h | 93 + .../Integration/WinPCap/pcap.h | 45 + .../Integration/WinPCap/pcap/bluetooth.h | 48 + .../Integration/WinPCap/pcap/bpf.h | 934 ++++ .../Integration/WinPCap/pcap/namedb.h | 89 + .../Integration/WinPCap/pcap/pcap.h | 407 ++ .../Integration/WinPCap/pcap/sll.h | 129 + .../Integration/WinPCap/pcap/usb.h | 90 + .../Integration/WinPCap/pcap/vlan.h | 46 + .../Integration/WinPCap/remote-ext.h | 472 ++ .../Integration/WinPCap/wpcap.lib | Bin 0 -> 19320 bytes .../Integration/cellular_config.h | 68 + .../Integration/cellular_platform.c | 233 + .../Integration/cellular_platform.h | 160 + .../Integration/comm_if_windows.c | 1028 +++++ .../FreeRTOS-Cellular-Interface/Integration/main.c | 326 ++ lexicon.txt | 97 + manifest.yml | 7 + 152 files changed, 49590 insertions(+), 18420 deletions(-) create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_setup.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/main.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/DemoTasks/MutualAuthMQTTExample.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSIPConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj.filters create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/cellular_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/core_mqtt_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/demo_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mbedtls_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mqtt_mutual_auth_demo_with_bg96.sln create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/DemoTasks/MutualAuthMQTTExample.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSIPConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj.filters create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/cellular_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/core_mqtt_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/demo_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mbedtls_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mqtt_mutual_auth_demo_with_hl7802.sln create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/DemoTasks/MutualAuthMQTTExample.c create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSIPConfig.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj.filters create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/cellular_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/core_mqtt_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/demo_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mbedtls_config.h create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mqtt_mutual_auth_demo_with_sara_r4.sln delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.c delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.c delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.c delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.c delete mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.h create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.c create mode 100644 FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.h create mode 160000 FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface create mode 100644 FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_cellular.c create mode 100644 FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_plus_tcp.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSConfig.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/FreeRTOS-Cellular-Interface-Integration.sln create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_declare.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_dns_define.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_tcp_define.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/test_freertos_tcp.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner_config.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_cellular_api.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_config.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.filters create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.user create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Packet32.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/PacketData.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Win32-Extensions.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/arch.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/bittypes.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/ip6_misc.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/netif.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-bpf.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-namedb.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-stdinc.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bluetooth.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bpf.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/namedb.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/pcap.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/sll.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/usb.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/vlan.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/remote-ext.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/wpcap.lib create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_config.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.h create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/comm_if_windows.c create mode 100644 FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c diff --git a/.gitmodules b/.gitmodules index 8142dd039..5bf2eae42 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,6 @@ [submodule "FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos"] path = FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos url = https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos +[submodule "FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface"] + path = FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface + url = https://github.com/FreeRTOS/Lab-Project-FreeRTOS-Cellular-Library.git diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj index 1a912ff25..0afbd65e9 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj @@ -1,628 +1,629 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\..\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\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\FreeRTOS-Plus-TCP\tools\tcp_utilities\include;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\..\Source\mbedtls_utils;..\..\..\..\ThirdParty\mbedtls\include;..\..\..\..\Source\AWS\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\FreeRTOS-Plus-TCP\tools\tcp_utilities\include;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj.filters index 38d76ad64..a6fc10f78 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/WIN32.vcxproj.filters @@ -1,819 +1,822 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {20aee693-d2dc-480e-ae21-0db2156e54ac} - - - {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} - - - {21d4cf41-bbdc-46af-8508-1193e3b6595a} - - - {ca4314cd-3b61-4dd8-b5ab-dbc3f1ed004e} - - - {9f1aaf81-1839-4673-b7e3-1501dd0edd02} - - - {35c65887-47a1-496f-b632-8082be580456} - - - {974934dc-7cd5-40f6-b449-3b932adf89ab} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {40de67d3-3815-46f9-a581-c1a01dbacc92} - - - {2bef4675-f45b-4988-9db3-4ddbf60406ac} - - - {ced49869-3746-4f73-ba8d-4513320e5e9b} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON - - - - DemoTasks - - - - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender - - - FreeRTOS+\FreeRTOS+TCP\tcp_utilities - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender\include - - - Config - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS+TCP\tcp_utilities\include - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {20aee693-d2dc-480e-ae21-0db2156e54ac} + + + {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} + + + {21d4cf41-bbdc-46af-8508-1193e3b6595a} + + + {ca4314cd-3b61-4dd8-b5ab-dbc3f1ed004e} + + + {9f1aaf81-1839-4673-b7e3-1501dd0edd02} + + + {35c65887-47a1-496f-b632-8082be580456} + + + {974934dc-7cd5-40f6-b449-3b932adf89ab} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {40de67d3-3815-46f9-a581-c1a01dbacc92} + + + {2bef4675-f45b-4988-9db3-4ddbf60406ac} + + + {ced49869-3746-4f73-ba8d-4513320e5e9b} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON + + + + DemoTasks + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender + + + FreeRTOS+\FreeRTOS+TCP\tcp_utilities + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\device-defender\include + + + Config + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS+TCP\tcp_utilities\include + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/mbedtls_config.h b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Device_Defender_Windows_Simulator/Device_Defender_Demo/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj index 13e7e97f1..a478db229 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\..\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\device-shadow\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\Mqtt_Demo_Helpers;.;%(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\sockets_wrapper\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\..\Source\mbedtls_utils;..\..\..\..\ThirdParty\mbedtls\include;..\..\..\..\Source\AWS\device-shadow\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\Mqtt_Demo_Helpers;.;%(AdditionalIncludeDirectories) MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -157,11 +157,12 @@ + + + - - @@ -516,14 +517,14 @@ + + - - @@ -618,4 +619,4 @@ - + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj.filters index ca348d5ff..e9e94c5ff 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/WIN32.vcxproj.filters @@ -158,12 +158,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - FreeRTOS+\mbedtls\library @@ -421,6 +415,18 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + @@ -510,12 +516,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\mbedtls\include @@ -796,5 +796,14 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + - + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/mbedtls_config.h b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj index 4d504a6ba..43428d202 100755 --- a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\..\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;..\..\Mqtt_Demo_Helpers;.;%(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\sockets_wrapper\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\..\Source\mbedtls_utils;..\..\..\..\ThirdParty\mbedtls\include;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\Mqtt_Demo_Helpers;.;%(AdditionalIncludeDirectories) MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -157,11 +157,12 @@ + + + - - @@ -516,13 +517,13 @@ + + - - @@ -618,4 +619,4 @@ - + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj.filters index ba9e47a46..b7b910167 100644 --- a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/WIN32.vcxproj.filters @@ -157,12 +157,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - FreeRTOS+\mbedtls\library @@ -423,6 +417,18 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + @@ -512,12 +518,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\mbedtls\include @@ -795,5 +795,15 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + - + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/mbedtls_config.h b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Jobs_Windows_Simulator/Jobs_Demo/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, 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 index 77faac78b..10f04b9c1 100644 --- 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 @@ -1,677 +1,678 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\..\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;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\HTTP_Utils;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\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;..\..\..\..\..\FreeRTOS-Plus\Demo\AWS\Ota_Windows_Simulator\Common\HTTP_Utils;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 index 5750ebe40..d253ed9a4 100644 --- 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 @@ -1,1025 +1,1034 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {20aee693-d2dc-480e-ae21-0db2156e54ac} - - - {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} - - - {d286fe5f-3c24-4a2f-881c-4b458623648d} - - - {c8b7bd64-7a0e-458b-bcaa-8081806e4508} - - - {6c6bc472-3f73-42c1-83e0-ffe6cae93393} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {7de8717e-b494-4eba-ba10-bc8252d9876a} - - - {3cce55b5-995f-476c-a3a5-9c659a977c89} - - - {d6ca6595-6585-4fd8-b0dd-224128fbd230} - - - {044f1490-9d76-41d8-9887-94f5e89cab11} - - - {28ef5930-f7c7-44f3-9189-749dcdf13cdd} - - - {0025af31-a87a-438e-86fd-8048c9f98025} - - - {e7b017ae-316c-4d8b-b427-5df150109d0f} - - - {0d8ed7df-8ac2-4ac0-ba27-ca59624bf363} - - - {b43eb5ed-8c56-41eb-a67a-4ce41403629e} - - - {4650e6af-01d5-46c3-9674-8554dab982ac} - - - {e3a23704-31ed-4869-b74e-6d09f842b336} - - - {b5277e13-3a7f-46ab-a73d-7a8aa2831f98} - - - {6886c3ff-2cf3-4391-827f-6032c74396e7} - - - {479f3dc4-b697-4e74-be3e-60c8f84a1e30} - - - {f076f8c1-267c-445c-8b4e-432cac57c90e} - - - {407f38e3-f238-4922-9442-ac843d507077} - - - {d0d4cb81-9ea9-4235-b30c-c112777f0eda} - - - {48067e94-989e-4056-a173-39b35e17a13f} - - - {8f0251d7-49ee-43d9-93a9-acedfe4f7152} - - - {cc758a0a-4533-4cb6-8854-43f3e7f632ca} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON - - - - Logging - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable - - - otapal - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - subscription-manager - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - FreeRTOS+\httpparser - - - otapal\code_signature_verification - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - http-utils - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - Config - - - Config - - - Config - - - Config - - - Logging - - - Logging - - - Logging - - - Config - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable - - - otapal - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - subscription-manager - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - Config - - - FreeRTOS+\httpparser\include - - - otapal\code_signature_verification\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - http-utils\include - - - otapal\code_signature_verification\include - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {20aee693-d2dc-480e-ae21-0db2156e54ac} + + + {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} + + + {d286fe5f-3c24-4a2f-881c-4b458623648d} + + + {c8b7bd64-7a0e-458b-bcaa-8081806e4508} + + + {6c6bc472-3f73-42c1-83e0-ffe6cae93393} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {7de8717e-b494-4eba-ba10-bc8252d9876a} + + + {3cce55b5-995f-476c-a3a5-9c659a977c89} + + + {d6ca6595-6585-4fd8-b0dd-224128fbd230} + + + {044f1490-9d76-41d8-9887-94f5e89cab11} + + + {28ef5930-f7c7-44f3-9189-749dcdf13cdd} + + + {0025af31-a87a-438e-86fd-8048c9f98025} + + + {e7b017ae-316c-4d8b-b427-5df150109d0f} + + + {0d8ed7df-8ac2-4ac0-ba27-ca59624bf363} + + + {b43eb5ed-8c56-41eb-a67a-4ce41403629e} + + + {4650e6af-01d5-46c3-9674-8554dab982ac} + + + {e3a23704-31ed-4869-b74e-6d09f842b336} + + + {b5277e13-3a7f-46ab-a73d-7a8aa2831f98} + + + {6886c3ff-2cf3-4391-827f-6032c74396e7} + + + {479f3dc4-b697-4e74-be3e-60c8f84a1e30} + + + {f076f8c1-267c-445c-8b4e-432cac57c90e} + + + {407f38e3-f238-4922-9442-ac843d507077} + + + {d0d4cb81-9ea9-4235-b30c-c112777f0eda} + + + {48067e94-989e-4056-a173-39b35e17a13f} + + + {8f0251d7-49ee-43d9-93a9-acedfe4f7152} + + + {cc758a0a-4533-4cb6-8854-43f3e7f632ca} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON + + + + Logging + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable + + + otapal + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + subscription-manager + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + FreeRTOS+\httpparser + + + otapal\code_signature_verification + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + http-utils + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + Config + + + Config + + + Config + + + Config + + + Logging + + + Logging + + + Logging + + + Config + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable + + + otapal + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + subscription-manager + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + Config + + + FreeRTOS+\httpparser\include + + + otapal\code_signature_verification\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + http-utils\include + + + otapal\code_signature_verification\include + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + \ No newline at end of file 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 index 3f2c41341..bd4bbef57 100644 --- 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 @@ -124,6 +124,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, 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 index 81a168340..747c1fd4d 100644 --- 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 @@ -1,669 +1,670 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\..\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) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\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) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 index ba611b6e7..f4101c667 100644 --- 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 @@ -1,983 +1,992 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {20aee693-d2dc-480e-ae21-0db2156e54ac} - - - {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} - - - {d286fe5f-3c24-4a2f-881c-4b458623648d} - - - {c8b7bd64-7a0e-458b-bcaa-8081806e4508} - - - {6c6bc472-3f73-42c1-83e0-ffe6cae93393} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {7de8717e-b494-4eba-ba10-bc8252d9876a} - - - {3cce55b5-995f-476c-a3a5-9c659a977c89} - - - {d6ca6595-6585-4fd8-b0dd-224128fbd230} - - - {044f1490-9d76-41d8-9887-94f5e89cab11} - - - {28ef5930-f7c7-44f3-9189-749dcdf13cdd} - - - {0025af31-a87a-438e-86fd-8048c9f98025} - - - {e7b017ae-316c-4d8b-b427-5df150109d0f} - - - {0d8ed7df-8ac2-4ac0-ba27-ca59624bf363} - - - {b43eb5ed-8c56-41eb-a67a-4ce41403629e} - - - {4650e6af-01d5-46c3-9674-8554dab982ac} - - - {e3a23704-31ed-4869-b74e-6d09f842b336} - - - {b5277e13-3a7f-46ab-a73d-7a8aa2831f98} - - - {920f406b-9c90-4ea6-8a0b-6e328d6ff095} - - - {9d7ce275-011a-4bdc-bba5-ad569f629872} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON - - - - Logging - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable - - - otapal - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\tinycbor - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - subscription-manager - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - otapal\code_signature_verification - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - Config - - - Config - - - Config - - - Config - - - Logging - - - Logging - - - Logging - - - Config - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable - - - otapal - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\tinycbor\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - subscription-manager - - - otapal\code_signature_verification\include - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - otapal\code_signature_verification\include - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {20aee693-d2dc-480e-ae21-0db2156e54ac} + + + {0dacb84e-5cc3-4eed-8fb1-68b6e4741f77} + + + {d286fe5f-3c24-4a2f-881c-4b458623648d} + + + {c8b7bd64-7a0e-458b-bcaa-8081806e4508} + + + {6c6bc472-3f73-42c1-83e0-ffe6cae93393} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {7de8717e-b494-4eba-ba10-bc8252d9876a} + + + {3cce55b5-995f-476c-a3a5-9c659a977c89} + + + {d6ca6595-6585-4fd8-b0dd-224128fbd230} + + + {044f1490-9d76-41d8-9887-94f5e89cab11} + + + {28ef5930-f7c7-44f3-9189-749dcdf13cdd} + + + {0025af31-a87a-438e-86fd-8048c9f98025} + + + {e7b017ae-316c-4d8b-b427-5df150109d0f} + + + {0d8ed7df-8ac2-4ac0-ba27-ca59624bf363} + + + {b43eb5ed-8c56-41eb-a67a-4ce41403629e} + + + {4650e6af-01d5-46c3-9674-8554dab982ac} + + + {e3a23704-31ed-4869-b74e-6d09f842b336} + + + {b5277e13-3a7f-46ab-a73d-7a8aa2831f98} + + + {920f406b-9c90-4ea6-8a0b-6e328d6ff095} + + + {9d7ce275-011a-4bdc-bba5-ad569f629872} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON + + + + Logging + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable + + + otapal + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\tinycbor + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + subscription-manager + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + otapal\code_signature_verification + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + Config + + + Config + + + Config + + + Config + + + Logging + + + Logging + + + Logging + + + Config + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreJSON\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\include + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\AWS\ota\portable + + + otapal + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\tinycbor\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + subscription-manager + + + otapal\code_signature_verification\include + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + otapal\code_signature_verification\include + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + \ No newline at end of file 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 index 3f2c41341..bd4bbef57 100644 --- 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 @@ -124,6 +124,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.c new file mode 100644 index 000000000..ba1d04b20 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.c @@ -0,0 +1,233 @@ +/* + * FreeRTOS V202107.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 + */ + +#include + +#include "cellular_platform.h" + +/*-----------------------------------------------------------*/ + +typedef QueueHandle_t SemaphoreHandle_t; + +typedef struct threadInfo +{ + void * pArgument; /**< @brief Argument to `threadRoutine`. */ + void ( * threadRoutine )( void * ); /**< @brief Thread function to run. */ +} threadInfo_t; + +/*-----------------------------------------------------------*/ + +/** + * @brief Sends provided buffer to network using transport send. + * + * @param[in] pArgument Argument passed to threadRoutine function. + * + */ +static void prvThreadRoutineWrapper( void * pArgument ); + +/** + * @brief Lock mutex with timeout. + * + * @param[in] pMutex Mutex to lock. + * @param[in] timeout Timeout value to lock mutex. + * + * @return true if mutex is locked successfully. Otherwise false. + */ +static bool prIotMutexTimedLock( PlatformMutex_t * pMutex, + TickType_t timeout ); + +/*-----------------------------------------------------------*/ + +static void prvThreadRoutineWrapper( void * pArgument ) +{ + threadInfo_t * pThreadInfo = ( threadInfo_t * ) pArgument; + + /* Run the thread routine. */ + pThreadInfo->threadRoutine( pThreadInfo->pArgument ); + Platform_Free( pThreadInfo ); + + vTaskDelete( NULL ); +} + +/*-----------------------------------------------------------*/ + +static bool prIotMutexTimedLock( PlatformMutex_t * pMutex, + TickType_t timeout ) +{ + BaseType_t lockResult = pdTRUE; + + configASSERT( pMutex != NULL ); + + LogDebug( ( "Locking mutex %p.", pMutex ) ); + + /* Call the correct FreeRTOS mutex take function based on mutex type. */ + if( pMutex->recursive == pdTRUE ) + { + lockResult = xSemaphoreTakeRecursive( ( SemaphoreHandle_t ) &pMutex->xMutex, timeout ); + } + else + { + lockResult = xSemaphoreTake( ( SemaphoreHandle_t ) &pMutex->xMutex, timeout ); + } + + return( lockResult == pdTRUE ); +} + +/*-----------------------------------------------------------*/ + +bool Platform_CreateDetachedThread( void ( * threadRoutine )( void * ), + void * pArgument, + int32_t priority, + size_t stackSize ) +{ + bool status = true; + threadInfo_t * pThreadInfo = NULL; + + configASSERT( threadRoutine != NULL ); + + LogDebug( ( "Creating new thread." ) ); + + pThreadInfo = Platform_Malloc( sizeof( threadInfo_t ) ); + + if( pThreadInfo == NULL ) + { + LogDebug( ( "Unable to allocate memory for threadRoutine %p.", threadRoutine ) ); + status = false; + } + + /* Create the FreeRTOS task that will run the thread. */ + if( status == true ) + { + pThreadInfo->threadRoutine = threadRoutine; + pThreadInfo->pArgument = pArgument; + + if( xTaskCreate( prvThreadRoutineWrapper, + "Cellular_Thread", + ( configSTACK_DEPTH_TYPE ) stackSize, + pThreadInfo, + priority, + NULL ) != pdPASS ) + { + /* Task creation failed. */ + LogWarn( ( "Failed to create thread." ) ); + Platform_Free( pThreadInfo ); + status = false; + } + else + { + LogDebug( ( "New thread created." ) ); + } + } + + return status; +} + +/*-----------------------------------------------------------*/ + +bool PlatformMutex_Create( PlatformMutex_t * pNewMutex, + bool recursive ) +{ + SemaphoreHandle_t xSemaphore = NULL; + bool retMutexCreate = false; + + configASSERT( pNewMutex != NULL ); + + LogDebug( ( "Creating new mutex %p.", pNewMutex ) ); + + if( recursive == true ) + { + xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &pNewMutex->xMutex ); + } + else + { + xSemaphore = xSemaphoreCreateMutexStatic( &pNewMutex->xMutex ); + } + + /* Remember the type of mutex. */ + if( recursive == true ) + { + pNewMutex->recursive = pdTRUE; + } + else + { + pNewMutex->recursive = pdFALSE; + } + + /* Check the handle value returned by the mutex create function. */ + if( xSemaphore == NULL ) + { + retMutexCreate = false; + } + else + { + retMutexCreate = true; + } + + return retMutexCreate; +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Destroy( PlatformMutex_t * pMutex ) +{ + configASSERT( pMutex != NULL ); + + vSemaphoreDelete( ( SemaphoreHandle_t ) &pMutex->xMutex ); +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Lock( PlatformMutex_t * pMutex ) +{ + prIotMutexTimedLock( pMutex, portMAX_DELAY ); +} + +/*-----------------------------------------------------------*/ + +bool PlatformMutex_TryLock( PlatformMutex_t * pMutex ) +{ + return prIotMutexTimedLock( pMutex, 0 ); +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Unlock( PlatformMutex_t * pMutex ) +{ + configASSERT( pMutex != NULL ); + + LogDebug( ( "Unlocking mutex %p.", pMutex ) ); + + /* Call the correct FreeRTOS mutex unlock function based on mutex type. */ + if( pMutex->recursive == pdTRUE ) + { + ( void ) xSemaphoreGiveRecursive( ( SemaphoreHandle_t ) &pMutex->xMutex ); + } + else + { + ( void ) xSemaphoreGive( ( SemaphoreHandle_t ) &pMutex->xMutex ); + } +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.h new file mode 100644 index 000000000..76ad7b1c0 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_platform.h @@ -0,0 +1,169 @@ +/* + * FreeRTOS V202107.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 __CELLULAR_PLATFORM_H__ +#define __CELLULAR_PLATFORM_H__ + +#include "FreeRTOS.h" +#include "queue.h" +#include "semphr.h" +#include "event_groups.h" + +#include +#include + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library log configuration. + * + * Cellular library use CellularLogLevel macro for logging. + * The prototye of these logging function is similar with printf with return type ignored. + * + */ + +#include "logging_levels.h" +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "CELLULAR" +#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 + +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_ERROR +#endif +#include "logging_stack.h" + + + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform thread API and configuration. + * + * Cellular library create a detached thread by this API. + * The threadRoutine should be called with pArgument in the created thread. + * + * PLATFORM_THREAD_DEFAULT_STACK_SIZE and PLATFORM_THREAD_DEFAULT_PRIORITY defines + * the platform related stack size and priority. + */ + +bool Platform_CreateDetachedThread( void ( * threadRoutine )( void * ), + void * pArgument, + int32_t priority, + size_t stackSize ); + +#define PLATFORM_THREAD_DEFAULT_STACK_SIZE ( 2048U ) +#define PLATFORM_THREAD_DEFAULT_PRIORITY ( tskIDLE_PRIORITY + 5U ) + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform mutex APIs. + * + * Cellular library use platform mutex to protect resource. + * + * The IotMutex_ functions can be referenced as function prototype for + * PlatfromMutex_ prefix function in the following link. + * https://docs.aws.amazon.com/freertos/latest/lib-ref/c-sdk/platform/platform_threads_functions.html + * + */ + +typedef struct PlatformMutex +{ + StaticSemaphore_t xMutex; /**< FreeRTOS mutex. */ + BaseType_t recursive; /**< Type; used for indicating if this is reentrant or normal. */ +} PlatformMutex_t; + +bool PlatformMutex_Create( PlatformMutex_t * pNewMutex, + bool recursive ); +void PlatformMutex_Destroy( PlatformMutex_t * pMutex ); +void PlatformMutex_Lock( PlatformMutex_t * pMutex ); +bool PlatformMutex_TryLock( PlatformMutex_t * pMutex ); +void PlatformMutex_Unlock( PlatformMutex_t * pMutex ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform memory allocation APIs. + * + * Cellular library use platform memory allocation APIs to allocate memory dynamically. + * The FreeRTOS memory management document can be referenced for these APIs. + * https://www.freertos.org/a00111.html + * + */ + +#define Platform_Malloc pvPortMalloc +#define Platform_Free vPortFree + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform event group APIs. + * + * Cellular library use platform event group for process synchronization. + * + * The EventGroup functions in the following link can be referenced as function prototype. + * https://www.freertos.org/event-groups-API.html + * + */ + +#define PlatformEventGroupHandle_t EventGroupHandle_t +#define PlatformEventGroup_Delete vEventGroupDelete +#define PlatformEventGroup_ClearBits xEventGroupClearBits +#define PlatformEventGroup_Create xEventGroupCreate +#define PlatformEventGroup_GetBits xEventGroupGetBits +#define PlatformEventGroup_SetBits xEventGroupSetBits +#define PlatformEventGroup_SetBitsFromISR xEventGroupSetBitsFromISR +#define PlatformEventGroup_WaitBits xEventGroupWaitBits +#define PlatformEventGroup_EventBits EventBits_t +#define PlatformTickType TickType_t + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform delay function. + * + * Cellular library use platform delay function for waiting events. + * + * The delay functions in the following link can be referenced as function prototype. + * https://www.freertos.org/a00127.html + * + */ +#define Platform_Delay( delayMs ) vTaskDelay( pdMS_TO_TICKS( delayMs ) ) + +#endif /* __CELLULAR_PLATFORM_H__ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_setup.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_setup.c new file mode 100644 index 000000000..a9be61186 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/cellular_setup.c @@ -0,0 +1,217 @@ +/* + * FreeRTOS V202107.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 cellular_setup.c + * @brief Setup cellular connectivity for board with cellular module. + */ + +/* FreeRTOS include. */ +#include +#include "task.h" + +#include +#include +#include + +/* Demo Specific configs. */ +#include "demo_config.h" + +/* The config header is always included first. */ +#ifndef CELLULAR_DO_NOT_USE_CUSTOM_CONFIG + /* Include custom config file before other headers. */ + #include "cellular_config.h" +#endif +#include "cellular_config_defaults.h" +#include "cellular_types.h" +#include "cellular_api.h" +#include "cellular_comm_interface.h" + +/*-----------------------------------------------------------*/ + +#ifndef CELLULAR_APN + #error "CELLULAR_APN is not defined in cellular_config.h" +#endif + +#define CELLULAR_SIM_CARD_WAIT_INTERVAL_MS ( 500UL ) +#define CELLULAR_MAX_SIM_RETRY ( 5U ) + +#define CELLULAR_PDN_CONNECT_WAIT_INTERVAL_MS ( 1000UL ) + +/*-----------------------------------------------------------*/ + +/* the default Cellular comm interface in system. */ +extern CellularCommInterface_t CellularCommInterface; + +/*-----------------------------------------------------------*/ + +/* Secure socket needs application to provide the cellular handle and pdn context id. */ +/* User of secure sockets cellular should provide this variable. */ +CellularHandle_t CellularHandle = NULL; + +/* User of secure sockets cellular should provide this variable. */ +uint8_t CellularSocketPdnContextId = CELLULAR_PDN_CONTEXT_ID; + +/*-----------------------------------------------------------*/ + +bool setupCellular( void ) +{ + bool cellularRet = true; + CellularError_t cellularStatus = CELLULAR_SUCCESS; + CellularSimCardStatus_t simStatus = { 0 }; + CellularServiceStatus_t serviceStatus = { 0 }; + CellularCommInterface_t * pCommIntf = &CellularCommInterface; + uint8_t tries = 0; + CellularPdnConfig_t pdnConfig = { CELLULAR_PDN_CONTEXT_IPV4, CELLULAR_PDN_AUTH_NONE, CELLULAR_APN, "", "" }; + CellularPdnStatus_t PdnStatusBuffers = { 0 }; + char localIP[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; + uint32_t timeoutCountLimit = ( CELLULAR_PDN_CONNECT_TIMEOUT / CELLULAR_PDN_CONNECT_WAIT_INTERVAL_MS ) + 1U; + uint32_t timeoutCount = 0; + uint8_t NumStatus = 1; + CellularPsmSettings_t psmSettings = { 0 }; + + /* Initialize Cellular Comm Interface. */ + cellularStatus = Cellular_Init( &CellularHandle, pCommIntf ); + + if( cellularStatus == CELLULAR_SUCCESS ) + { + /* wait until SIM is ready */ + for( tries = 0; tries < CELLULAR_MAX_SIM_RETRY; tries++ ) + { + cellularStatus = Cellular_GetSimCardStatus( CellularHandle, &simStatus ); + + if( ( cellularStatus == CELLULAR_SUCCESS ) && + ( ( simStatus.simCardState == CELLULAR_SIM_CARD_INSERTED ) && + ( simStatus.simCardLockState == CELLULAR_SIM_CARD_READY ) ) ) + { + /* Turn of PSM because this is demo to showcase MQTT instead of PSM mode. */ + psmSettings.mode = 0; + cellularStatus = cellularStatus = Cellular_SetPsmSettings( CellularHandle, &psmSettings ); + + if( cellularStatus != CELLULAR_SUCCESS ) + { + configPRINTF( ( ">>> Cellular_SetPsmSettings failure <<<\r\n" ) ); + } + else + { + configPRINTF( ( ">>> Cellular SIM okay <<<\r\n" ) ); + } + + break; + } + else + { + configPRINTF( ( ">>> Cellular SIM card state %d, Lock State %d <<<\r\n", + simStatus.simCardState, + simStatus.simCardLockState ) ); + } + + vTaskDelay( pdMS_TO_TICKS( CELLULAR_SIM_CARD_WAIT_INTERVAL_MS ) ); + } + } + + /* Setup the PDN config. */ + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_SetPdnConfig( CellularHandle, CellularSocketPdnContextId, &pdnConfig ); + } + else + { + configPRINTF( ( ">>> Cellular SIM failure <<<\r\n" ) ); + } + + /* Rescan network. */ + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_RfOff( CellularHandle ); + } + + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_RfOn( CellularHandle ); + } + + /* Get service status. */ + if( cellularStatus == CELLULAR_SUCCESS ) + { + while( timeoutCount < timeoutCountLimit ) + { + cellularStatus = Cellular_GetServiceStatus( CellularHandle, &serviceStatus ); + + if( ( cellularStatus == CELLULAR_SUCCESS ) && + ( ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_REGISTERED_HOME ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ) ) ) + { + configPRINTF( ( ">>> Cellular module registered <<<\r\n" ) ); + break; + } + else + { + configPRINTF( ( ">>> Cellular GetServiceStatus failed %d, ps registration status %d <<<\r\n", + cellularStatus, serviceStatus.psRegistrationStatus ) ); + } + + timeoutCount++; + + if( timeoutCount >= timeoutCountLimit ) + { + cellularStatus = CELLULAR_INVALID_HANDLE; + configPRINTF( ( ">>> Cellular module can't be registered <<<\r\n" ) ); + } + + vTaskDelay( pdMS_TO_TICKS( CELLULAR_PDN_CONNECT_WAIT_INTERVAL_MS ) ); + } + } + + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_ActivatePdn( CellularHandle, CellularSocketPdnContextId ); + } + + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_GetIPAddress( CellularHandle, CellularSocketPdnContextId, localIP, sizeof( localIP ) ); + } + + if( cellularStatus == CELLULAR_SUCCESS ) + { + cellularStatus = Cellular_GetPdnStatus( CellularHandle, &PdnStatusBuffers, CellularSocketPdnContextId, &NumStatus ); + } + + if( ( cellularStatus == CELLULAR_SUCCESS ) && ( PdnStatusBuffers.state == 1 ) ) + { + configPRINTF( ( ">>> Cellular module registered, IP address %s <<<\r\n", localIP ) ); + cellularRet = true; + } + else + { + cellularRet = false; + } + + return cellularRet; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c new file mode 100644 index 000000000..748a68af2 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c @@ -0,0 +1,912 @@ +/* + * FreeRTOS V202107.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 comm_if_windows.c + * @brief Windows Simulator file for cellular comm interface + */ + +/*-----------------------------------------------------------*/ + +/* Windows include file for COM port I/O. */ +#include + +/* Platform layer includes. */ +#include "cellular_platform.h" + +/* Cellular comm interface include file. */ +#include "cellular_config.h" +#include "cellular_config_defaults.h" +#include "cellular_comm_interface.h" + +/*-----------------------------------------------------------*/ + +/* Define the COM port used as comm interface. */ +#ifndef CELLULAR_COMM_INTERFACE_PORT + #error "Define CELLULAR_COMM_INTERFACE_PORT in cellular_config.h" +#endif +#define CELLULAR_COMM_PATH "\\\\.\\"CELLULAR_COMM_INTERFACE_PORT + +/* Define the simulated UART interrupt number. */ +#define portINTERRUPT_UART ( 2UL ) + +/* Define the read write buffer size. */ +#define COMM_TX_BUFFER_SIZE ( 8192 ) +#define COMM_RX_BUFFER_SIZE ( 8192 ) + +/* Receive thread timeout in ms. */ +#define COMM_RECV_THREAD_TIMEOUT ( 5000 ) + +/* Write operation timeout in ms. */ +#define COMM_WRITE_OPERATION_TIMEOUT ( 500 ) + +/* Comm status. */ +#define CELLULAR_COMM_OPEN_BIT ( 0x01U ) + +/* Comm task event. */ +#define COMMTASK_EVT_MASK_STARTED ( 0x0001UL ) +#define COMMTASK_EVT_MASK_ABORT ( 0x0002UL ) +#define COMMTASK_EVT_MASK_ABORTED ( 0x0004UL ) +#define COMMTASK_EVT_MASK_ALL_EVENTS \ + ( COMMTASK_EVT_MASK_STARTED \ + | COMMTASK_EVT_MASK_ABORT \ + | COMMTASK_EVT_MASK_ABORTED ) +#define COMMTASK_POLLING_TIME_MS ( 1UL ) + +/* Platform thread stack size and priority. */ +#define COMM_IF_THREAD_DEFAULT_STACK_SIZE ( 2048U ) +#define COMM_IF_THREAD_DEFAULT_PRIORITY ( tskIDLE_PRIORITY + 5U ) + +/*-----------------------------------------------------------*/ + +typedef struct _cellularCommContext +{ + CellularCommInterfaceReceiveCallback_t commReceiveCallback; + HANDLE commReceiveCallbackThread; + uint8_t commStatus; + void * pUserData; + HANDLE commFileHandle; + CellularCommInterface_t * pCommInterface; + bool commTaskThreadStarted; + EventGroupHandle_t pCommTaskEvent; +} _cellularCommContext_t; + +/*-----------------------------------------------------------*/ + +/** + * @brief CellularCommInterfaceOpen_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfOpen( CellularCommInterfaceReceiveCallback_t receiveCallback, + void * pUserData, + CellularCommInterfaceHandle_t * pCommInterfaceHandle ); + +/** + * @brief CellularCommInterfaceSend_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfSend( CellularCommInterfaceHandle_t commInterfaceHandle, + const uint8_t * pData, + uint32_t dataLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataSentLength ); + +/** + * @brief CellularCommInterfaceRecv_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfReceive( CellularCommInterfaceHandle_t commInterfaceHandle, + uint8_t * pBuffer, + uint32_t bufferLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataReceivedLength ); + +/** + * @brief CellularCommInterfaceClose_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfClose( CellularCommInterfaceHandle_t commInterfaceHandle ); + +/** + * @brief Get default comm interface context. + * + * @return On success, SOCKETS_ERROR_NONE is returned. If an error occurred, error code defined + * in sockets_wrapper.h is returned. + */ +static _cellularCommContext_t * _getCellularCommContext( void ); + +/** + * @brief UART interrupt handler. + * + * @return pdTRUE if the operation is successful, otherwise + * an error code indicating the cause of the error. + */ +static uint32_t prvProcessUartInt( void ); + +/** + * @brief Set COM port timeout settings. + * + * @param[in] hComm COM handle returned by CreateFile. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t _setupCommTimeout( HANDLE hComm ); + +/** + * @brief Set COM port control settings. + * + * @param[in] hComm COM handle returned by CreateFile. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t _setupCommSettings( HANDLE hComm ); + +/** + * @brief Thread routine to generate simulated interrupt. + * + * @param[in] pUserData Pointer to _cellularCommContext_t allocated in comm interface open. + */ +static void commTaskThread( void * pUserData ); + +/** + * @brief Helper function to setup and create commTaskThread. + * + * @param[in] pCellularCommContext Cellular comm interface context allocated in open. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t setupCommTaskThread( _cellularCommContext_t * pCellularCommContext ); + +/** + * @brief Helper function to clean commTaskThread. + * + * @param[in] pCellularCommContext Cellular comm interface context allocated in open. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t cleanCommTaskThread( _cellularCommContext_t * pCellularCommContext ); + +/*-----------------------------------------------------------*/ + +CellularCommInterface_t CellularCommInterface = +{ + .open = _prvCommIntfOpen, + .send = _prvCommIntfSend, + .recv = _prvCommIntfReceive, + .close = _prvCommIntfClose +}; + +static _cellularCommContext_t _iotCellularCommContext = +{ + .commReceiveCallback = NULL, + .commReceiveCallbackThread = NULL, + .pCommInterface = &CellularCommInterface, + .commFileHandle = NULL, + .pUserData = NULL, + .commStatus = 0U, + .commTaskThreadStarted = false, + .pCommTaskEvent = NULL +}; + +/* Indicate RX event is received in comm driver. */ +static bool rxEvent = false; + +/*-----------------------------------------------------------*/ + +static _cellularCommContext_t * _getCellularCommContext( void ) +{ + return &_iotCellularCommContext; +} + +/*-----------------------------------------------------------*/ + +static uint32_t prvProcessUartInt( void ) +{ + _cellularCommContext_t * pCellularCommContext = _getCellularCommContext(); + CellularCommInterfaceError_t callbackRet = IOT_COMM_INTERFACE_FAILURE; + uint32_t retUartInt = pdTRUE; + + if( pCellularCommContext->commReceiveCallback != NULL ) + { + callbackRet = pCellularCommContext->commReceiveCallback( pCellularCommContext->pUserData, + ( CellularCommInterfaceHandle_t ) pCellularCommContext ); + } + + if( callbackRet == IOT_COMM_INTERFACE_SUCCESS ) + { + retUartInt = pdTRUE; + } + else + { + retUartInt = pdFALSE; + } + + return retUartInt; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Communication receiver thread function. + * + * @param[in] pArgument windows COM port handle. + * @return 0 if thread function exit without error. Others for error. + */ +DWORD WINAPI _CellularCommReceiveCBThreadFunc( LPVOID pArgument ) +{ + DWORD dwCommStatus = 0; + HANDLE hComm = ( HANDLE ) pArgument; + BOOL retWait = FALSE; + DWORD retValue = 0; + + if( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) + { + retValue = ERROR_INVALID_HANDLE; + } + + while( retValue == 0 ) + { + retWait = WaitCommEvent( hComm, &dwCommStatus, NULL ); + + if( ( retWait != FALSE ) && ( ( dwCommStatus & EV_RXCHAR ) != 0 ) ) + { + if( ( dwCommStatus & EV_RXCHAR ) != 0 ) + { + rxEvent = true; + } + } + else + { + if( ( GetLastError() == ERROR_INVALID_HANDLE ) || ( GetLastError() == ERROR_OPERATION_ABORTED ) ) + { + /* COM port closed. */ + LogInfo( ( "Cellular COM port %p closed", hComm ) ); + } + else + { + LogInfo( ( "Cellular receiver thread wait comm error %p %d", hComm, GetLastError() ) ); + } + + retValue = GetLastError(); + + break; + } + } + + return retValue; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _setupCommTimeout( HANDLE hComm ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + COMMTIMEOUTS xCommTimeouts = { 0 }; + BOOL Status = TRUE; + + /* Set ReadIntervalTimeout to MAXDWORD and zero values for both + * ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier to return + * immediately with the bytes that already been received. */ + xCommTimeouts.ReadIntervalTimeout = MAXDWORD; + xCommTimeouts.ReadTotalTimeoutConstant = 0; + xCommTimeouts.ReadTotalTimeoutMultiplier = 0; + xCommTimeouts.WriteTotalTimeoutConstant = COMM_WRITE_OPERATION_TIMEOUT; + xCommTimeouts.WriteTotalTimeoutMultiplier = 0; + Status = SetCommTimeouts( hComm, &xCommTimeouts ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommTimeouts fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _setupCommSettings( HANDLE hComm ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + DCB dcbSerialParams = { 0 }; + BOOL Status = TRUE; + + ( void ) memset( &dcbSerialParams, 0, sizeof( dcbSerialParams ) ); + dcbSerialParams.DCBlength = sizeof( dcbSerialParams ); + dcbSerialParams.BaudRate = CBR_115200; + dcbSerialParams.fBinary = 1; + dcbSerialParams.ByteSize = 8; + dcbSerialParams.StopBits = ONESTOPBIT; + dcbSerialParams.Parity = NOPARITY; + + dcbSerialParams.fOutxCtsFlow = FALSE; + dcbSerialParams.fOutxDsrFlow = FALSE; + dcbSerialParams.fDtrControl = DTR_CONTROL_ENABLE; + dcbSerialParams.fRtsControl = RTS_CONTROL_ENABLE; + + Status = SetCommState( hComm, &dcbSerialParams ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommState fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static void commTaskThread( void * pUserData ) +{ + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) pUserData; + EventBits_t uxBits = 0; + + /* Inform thread ready. */ + LogInfo( ( "Cellular commTaskThread started" ) ); + + if( pCellularCommContext != NULL ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, + COMMTASK_EVT_MASK_STARTED ); + } + + while( true ) + { + /* Wait for notification from eventqueue. */ + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ), + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( COMMTASK_POLLING_TIME_MS ) ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ) != 0U ) + { + LogDebug( ( "Abort received, cleaning up!" ) ); + break; + } + else + { + /* Polling the global share variable to trigger the interrupt. */ + if( rxEvent == true ) + { + rxEvent = false; + vPortGenerateSimulatedInterrupt( portINTERRUPT_UART ); + } + } + } + + /* Inform thread ready. */ + if( pCellularCommContext != NULL ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, COMMTASK_EVT_MASK_ABORTED ); + } + + LogInfo( ( "Cellular commTaskThread exit" ) ); +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t setupCommTaskThread( _cellularCommContext_t * pCellularCommContext ) +{ + BOOL Status = TRUE; + EventBits_t uxBits = 0; + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + + pCellularCommContext->pCommTaskEvent = xEventGroupCreate(); + + if( pCellularCommContext->pCommTaskEvent != NULL ) + { + /* Create the FreeRTOS thread to generate the simulated interrupt. */ + Status = Platform_CreateDetachedThread( commTaskThread, + ( void * ) pCellularCommContext, + COMM_IF_THREAD_DEFAULT_PRIORITY, + COMM_IF_THREAD_DEFAULT_STACK_SIZE ); + + if( Status != true ) + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_STARTED | ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ), + pdTRUE, + pdFALSE, + portMAX_DELAY ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_STARTED ) == COMMTASK_EVT_MASK_STARTED ) + { + pCellularCommContext->commTaskThreadStarted = true; + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + pCellularCommContext->commTaskThreadStarted = false; + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t cleanCommTaskThread( _cellularCommContext_t * pCellularCommContext ) +{ + EventBits_t uxBits = 0; + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + + /* Wait for the commTaskThreadStarted exit. */ + if( ( pCellularCommContext->commTaskThreadStarted == true ) && ( pCellularCommContext->pCommTaskEvent != NULL ) ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, + COMMTASK_EVT_MASK_ABORT ); + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ), + pdTRUE, + pdFALSE, + portMAX_DELAY ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ) != COMMTASK_EVT_MASK_ABORTED ) + { + LogDebug( ( "Cellular close wait commTaskThread fail" ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + pCellularCommContext->commTaskThreadStarted = false; + } + + /* Clean the event group. */ + if( pCellularCommContext->pCommTaskEvent != NULL ) + { + vEventGroupDelete( pCellularCommContext->pCommTaskEvent ); + pCellularCommContext->pCommTaskEvent = NULL; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfOpen( CellularCommInterfaceReceiveCallback_t receiveCallback, + void * pUserData, + CellularCommInterfaceHandle_t * pCommInterfaceHandle ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + HANDLE hComm = ( HANDLE ) INVALID_HANDLE_VALUE; + BOOL Status = TRUE; + _cellularCommContext_t * pCellularCommContext = _getCellularCommContext(); + DWORD dwRes = 0; + + if( pCellularCommContext == NULL ) + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) != 0 ) + { + LogError( ( "Cellular comm interface opened already" ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + /* Clear the context. */ + memset( pCellularCommContext, 0, sizeof( _cellularCommContext_t ) ); + pCellularCommContext->pCommInterface = &CellularCommInterface; + + /* If CreateFile fails, the return value is INVALID_HANDLE_VALUE. */ + hComm = CreateFile( TEXT( CELLULAR_COMM_PATH ), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL ); + } + + /* Comm port is just closed. Wait 1 second and retry. */ + if( ( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) && ( GetLastError() == 5 ) ) + { + vTaskDelay( pdMS_TO_TICKS( 1000UL ) ); + hComm = CreateFile( TEXT( CELLULAR_COMM_PATH ), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL ); + } + + if( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) + { + LogError( ( "Cellular open COM port fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + Status = SetupComm( hComm, COMM_TX_BUFFER_SIZE, COMM_RX_BUFFER_SIZE ); + + if( Status == FALSE ) + { + LogError( ( "Cellular setup COM port fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + commIntRet = _setupCommTimeout( hComm ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + commIntRet = _setupCommSettings( hComm ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = SetCommMask( hComm, EV_RXCHAR ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommMask fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + pCellularCommContext->commReceiveCallback = receiveCallback; + commIntRet = setupCommTaskThread( pCellularCommContext ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + vPortSetInterruptHandler( portINTERRUPT_UART, prvProcessUartInt ); + pCellularCommContext->commReceiveCallbackThread = + CreateThread( NULL, 0, _CellularCommReceiveCBThreadFunc, hComm, 0, NULL ); + + /* CreateThread return NULL for error. */ + if( pCellularCommContext->commReceiveCallbackThread == NULL ) + { + LogError( ( "Cellular CreateThread fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + pCellularCommContext->pUserData = pUserData; + pCellularCommContext->commFileHandle = hComm; + *pCommInterfaceHandle = ( CellularCommInterfaceHandle_t ) pCellularCommContext; + pCellularCommContext->commStatus |= CELLULAR_COMM_OPEN_BIT; + } + else + { + /* Comm interface open fail. Clean the data. */ + if( hComm != ( HANDLE ) INVALID_HANDLE_VALUE ) + { + ( void ) CloseHandle( hComm ); + hComm = INVALID_HANDLE_VALUE; + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + /* Wait for the commReceiveCallbackThread exit. */ + if( pCellularCommContext->commReceiveCallbackThread != NULL ) + { + dwRes = WaitForSingleObject( pCellularCommContext->commReceiveCallbackThread, COMM_RECV_THREAD_TIMEOUT ); + + if( dwRes != WAIT_OBJECT_0 ) + { + LogDebug( ( "Cellular close wait receiveCallbackThread %p fail %d", + pCellularCommContext->commReceiveCallbackThread, dwRes ) ); + } + } + + pCellularCommContext->commReceiveCallbackThread = NULL; + + /* Wait for the commTaskThreadStarted exit. */ + ( void ) cleanCommTaskThread( pCellularCommContext ); + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfClose( CellularCommInterfaceHandle_t commInterfaceHandle ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + BOOL Status = TRUE; + DWORD dwRes = 0; + + if( pCellularCommContext == NULL ) + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular close comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + /* clean the receive callback. */ + pCellularCommContext->commReceiveCallback = NULL; + + /* Close the COM port. */ + hComm = pCellularCommContext->commFileHandle; + + if( hComm != ( HANDLE ) INVALID_HANDLE_VALUE ) + { + Status = CloseHandle( hComm ); + + if( Status == FALSE ) + { + LogDebug( ( "Cellular close CloseHandle %p fail", hComm ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + pCellularCommContext->commFileHandle = NULL; + + /* Wait for the thread exit. */ + if( pCellularCommContext->commReceiveCallbackThread != NULL ) + { + dwRes = WaitForSingleObject( pCellularCommContext->commReceiveCallbackThread, COMM_RECV_THREAD_TIMEOUT ); + + if( dwRes != WAIT_OBJECT_0 ) + { + LogDebug( ( "Cellular close wait receiveCallbackThread %p fail %d", + pCellularCommContext->commReceiveCallbackThread, dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + CloseHandle( pCellularCommContext->commReceiveCallbackThread ); + } + } + + pCellularCommContext->commReceiveCallbackThread = NULL; + + /* Clean the commTaskThread. */ + ( void ) cleanCommTaskThread( pCellularCommContext ); + + /* clean the data structure. */ + pCellularCommContext->commStatus &= ~( CELLULAR_COMM_OPEN_BIT ); + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfSend( CellularCommInterfaceHandle_t commInterfaceHandle, + const uint8_t * pData, + uint32_t dataLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataSentLength ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + OVERLAPPED osWrite = { 0 }; + DWORD dwRes = 0; + DWORD dwWritten = 0; + BOOL Status = TRUE; + + if( pCellularCommContext == NULL ) + { + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular send comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + hComm = pCellularCommContext->commFileHandle; + osWrite.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); + + if( osWrite.hEvent == NULL ) + { + LogError( ( "Cellular CreateEvent fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = WriteFile( hComm, pData, dataLength, &dwWritten, &osWrite ); + + /* WriteFile fail and error is not the ERROR_IO_PENDING. */ + if( ( Status == FALSE ) && ( GetLastError() != ERROR_IO_PENDING ) ) + { + LogError( ( "Cellular WriteFile fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + if( Status == TRUE ) + { + *pDataSentLength = ( uint32_t ) dwWritten; + } + } + + /* Handle pending I/O. */ + if( ( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) && ( Status == FALSE ) ) + { + dwRes = WaitForSingleObject( osWrite.hEvent, timeoutMilliseconds ); + + switch( dwRes ) + { + case WAIT_OBJECT_0: + + if( GetOverlappedResult( hComm, &osWrite, &dwWritten, FALSE ) == FALSE ) + { + LogError( ( "Cellular GetOverlappedResult fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + break; + + case STATUS_TIMEOUT: + LogError( ( "Cellular WaitForSingleObject timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + break; + + default: + LogError( ( "Cellular WaitForSingleObject fail %d", dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + break; + } + + *pDataSentLength = ( uint32_t ) dwWritten; + } + + if( osWrite.hEvent != NULL ) + { + Status = CloseHandle( osWrite.hEvent ); + + if( Status == FALSE ) + { + LogDebug( ( "Cellular send CloseHandle fail" ) ); + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfReceive( CellularCommInterfaceHandle_t commInterfaceHandle, + uint8_t * pBuffer, + uint32_t bufferLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataReceivedLength ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + OVERLAPPED osRead = { 0 }; + BOOL Status = TRUE; + DWORD dwRes = 0; + DWORD dwRead = 0; + + if( pCellularCommContext == NULL ) + { + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular read comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + hComm = pCellularCommContext->commFileHandle; + osRead.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); + + if( osRead.hEvent == NULL ) + { + LogError( ( "Cellular CreateEvent fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = ReadFile( hComm, pBuffer, bufferLength, &dwRead, &osRead ); + + if( ( Status == FALSE ) && ( GetLastError() != ERROR_IO_PENDING ) ) + { + LogError( ( "Cellular ReadFile fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + if( Status == TRUE ) + { + *pDataReceivedLength = ( uint32_t ) dwRead; + } + } + + /* Handle pending I/O. */ + if( ( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) && ( Status == FALSE ) ) + { + dwRes = WaitForSingleObject( osRead.hEvent, timeoutMilliseconds ); + + switch( dwRes ) + { + case WAIT_OBJECT_0: + + if( GetOverlappedResult( hComm, &osRead, &dwRead, FALSE ) == FALSE ) + { + LogError( ( "Cellular receive GetOverlappedResult fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + break; + + case STATUS_TIMEOUT: + LogError( ( "Cellular receive WaitForSingleObject timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + break; + + default: + LogError( ( "Cellular receive WaitForSingleObject fail %d", dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + break; + } + + *pDataReceivedLength = ( uint32_t ) dwRead; + } + + if( osRead.hEvent != NULL ) + { + Status = CloseHandle( osRead.hEvent ); + + if( Status == FALSE ) + { + LogDebug( ( "Cellular recv CloseHandle fail" ) ); + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/main.c new file mode 100644 index 000000000..cad0c111c --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/main.c @@ -0,0 +1,346 @@ +/* + * FreeRTOS V202107.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 +#include + +/* Visual studio intrinsics used so the __debugbreak() function is available + * should an assert get hit. */ +#include + +/* FreeRTOS includes. */ +#include +#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" + +/* FreeRTOS Cellular Library init and setup cellular network registration. */ +extern bool setupCellular( void ); + +/* The MQTT demo entry function. */ +extern void vStartSimpleMQTTDemo( void ); + +/* The task function to setup cellular with thread ready environment. */ +static void CellularDemoTask( void * pvParameters ); + +/* + * 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 ); + +/* 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; + +/* Used by the pseudo random number generator. */ +static UBaseType_t ulNextRand; +/*-----------------------------------------------------------*/ + +int main( void ) +{ + /*** + * See https://www.FreeRTOS.org/iot-device-shadow for configuration and usage instructions. + ***/ + + /* Miscellaneous initialization including preparing the logging and seeding + * the random number generator. */ + prvMiscInitialisation(); + + /* 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 ) +{ + ( void ) eNetworkEvent; +} +/*-----------------------------------------------------------*/ + +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 CellularDemoTask( void * pvParameters ) +{ + bool retCellular = true; + + ( void ) pvParameters; + /* Setup cellular. */ + retCellular = setupCellular(); + + if( retCellular == false ) + { + configPRINTF( ( "Cellular failed to initialize.\r\n" ) ); + } + + /* Stop here if we fail to initialize cellular. */ + configASSERT( retCellular == true ); + + /* Run the MQTT demo. */ + /* Demos that use the network are created after the network is + * up. */ + LogInfo( ( "---------STARTING DEMO---------\r\n" ) ); + vStartSimpleMQTTDemo(); + + vTaskDelete( NULL ); +} + +/*-----------------------------------------------------------*/ + +static void prvMiscInitialisation( void ) +{ + vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, 0U, configPRINT_PORT ); + + /* FreeRTOS Cellular Library init needs thread ready environment. + * CellularDemoTask invoke setupCellular to init FreeRTOS Cellular Library and register network. + * Then it runs the MQTT demo. */ + xTaskCreate( CellularDemoTask, /* Function that implements the task. */ + "CellularDemo", /* Text name for the task - only used for debugging. */ + democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ + NULL, /* Task parameter - not used in this case. */ + democonfigDEMO_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ + NULL ); /* Used to pass out a handle to the created task - not used in this case. */ +} +/*-----------------------------------------------------------*/ + +#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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/DemoTasks/MutualAuthMQTTExample.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/DemoTasks/MutualAuthMQTTExample.c new file mode 100644 index 000000000..849eb874b --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/DemoTasks/MutualAuthMQTTExample.c @@ -0,0 +1,1074 @@ +/* + * FreeRTOS V202107.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 + * + */ + +/* + * Demo for showing use of the MQTT API using a mutually authenticated + * network connection. + * + * The Example shown below uses MQTT APIs to create MQTT messages and send them + * over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * A mutually authenticated TLS connection is used to connect to the + * MQTT message broker in this example. Define democonfigMQTT_BROKER_ENDPOINT, + * democonfigROOT_CA_PEM, democonfigCLIENT_CERTIFICATE_PEM, + * and democonfigCLIENT_PRIVATE_KEY_PEM in demo_config.h to establish a + * mutually authenticated connection. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. + */ + +/* Standard includes. */ +#include +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + +/* MQTT library includes. */ +#include "core_mqtt.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* Transport interface implementation include header for TLS. */ +#include "using_mbedtls.h" + +/*-----------------------------------------------------------*/ + +/* Compile time error for undefined configs. */ +#ifndef democonfigMQTT_BROKER_ENDPOINT + #error "Define the config democonfigMQTT_BROKER_ENDPOINT by following the instructions in file demo_config.h." +#endif +#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 */ + +/*-----------------------------------------------------------*/ + +/* Default values for configs. */ +#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. + * + * @note Appending __TIME__ to the client id string will help to create a unique + * client id every time an application binary is built. Only a single instance of + * this application's compiled binary may be used at a time, since the client ID + * will always be the same. + */ + #define democonfigCLIENT_IDENTIFIER "testClient"__TIME__ +#endif + +#ifndef democonfigMQTT_BROKER_PORT + +/** + * @brief The port to use for the demo. + */ + #define democonfigMQTT_BROKER_PORT ( 8883 ) +#endif + +/*-----------------------------------------------------------*/ + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define mqttexampleRETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed operation + * with server. + */ +#define mqttexampleRETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation retry + * attempts. + */ +#define mqttexampleRETRY_BACKOFF_BASE_MS ( 500U ) + +/** + * @brief Timeout for receiving CONNACK packet in milliseconds. + */ +#define mqttexampleCONNACK_RECV_TIMEOUT_MS ( 5000U ) + +/** + * @brief The topic to subscribe and publish to in the example. + * + * The topic name starts with the client identifier to ensure that each demo + * interacts with a unique topic name. + */ +#define mqttexampleTOPIC democonfigCLIENT_IDENTIFIER "/example/topic" + +/** + * @brief The number of topic filters to subscribe. + */ +#define mqttexampleTOPIC_COUNT ( 1 ) + +/** + * @brief The MQTT message published in this example. + */ +#define mqttexampleMESSAGE "Hello World!" + +/** + * @brief Time in ticks to wait between each cycle of the demo implemented + * by prvMQTTDemoTask(). + */ +#define mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ( pdMS_TO_TICKS( 5000U ) ) + +/** + * @brief Timeout for MQTT_ProcessLoop in milliseconds. + */ +#define mqttexamplePROCESS_LOOP_TIMEOUT_MS ( 5000U ) + +/** + * @brief Keep alive time reported to the broker while establishing + * an MQTT connection. + * + * 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 mqttexampleKEEP_ALIVE_TIMEOUT_SECONDS ( 60U ) + +/** + * @brief Delay (in ticks) between consecutive cycles of MQTT publish operations in a + * demo iteration. + * + * Note that the process loop also has a timeout, so the total time between + * publishes is the sum of the two delays. + */ +#define mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ( pdMS_TO_TICKS( 2000U ) ) + +/** + * @brief Transport timeout in milliseconds for transport send and receive. + */ +#define mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 10000U ) + +/** + * @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@"MQTT_LIBRARY_VERSION +#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 Milliseconds per second. + */ +#define MILLISECONDS_PER_SECOND ( 1000U ) + +/** + * @brief Milliseconds per FreeRTOS tick. + */ +#define MILLISECONDS_PER_TICK ( MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) + +/*-----------------------------------------------------------*/ + +/** + * @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 The task used to demonstrate the MQTT API. + * + * @param[in] pvParameters Parameters as passed at the time of task creation. Not + * used in this example. + */ +static void prvMQTTDemoTask( void * pvParameters ); + + +/** + * @brief Connect to MQTT broker with reconnection retries. + * + * If connection fails, retry is attempted after a timeout. + * Timeout value will exponentially increase until maximum + * timeout value is reached or the number of attempts are exhausted. + * + * @param[out] pxNetworkContext The parameter to return the created network context. + * + * @return The status of the final connection attempt. + */ +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pNetworkContext ); + +/** + * @brief Sends an MQTT Connect packet over the already connected TLS over TCP connection. + * + * @param[in, out] pxMQTTContext MQTT context pointer. + * @param[in] xNetworkContext Network context. + */ +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ); + +/** + * @brief Function to update variable #xTopicFilterContext with status + * information from Subscribe ACK. Called by the event callback after processing + * an incoming SUBACK packet. + * + * @param[in] Server response to the subscription request. + */ +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ); + +/** + * @brief Subscribes to the topic as specified in mqttexampleTOPIC at the top of + * this file. In the case of a Subscribe ACK failure, then subscription is + * retried using an exponential backoff strategy with jitter. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Publishes a message mqttexampleMESSAGE on mqttexampleTOPIC topic. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Unsubscribes from the previously subscribed topic as specified + * in mqttexampleTOPIC. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief The timer query function provided to the MQTT context. + * + * @return Time in milliseconds. + */ +static uint32_t prvGetTimeMs( void ); + +/** + * @brief Process a response or ack to an MQTT request (PING, PUBLISH, + * SUBSCRIBE or UNSUBSCRIBE). This function processes PINGRESP, PUBACK, + * SUBACK, and UNSUBACK. + * + * @param[in] pxIncomingPacket is a pointer to structure containing deserialized + * MQTT response. + * @param[in] usPacketId is the packet identifier from the ack received. + */ +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ); + +/** + * @brief Process incoming Publish message. + * + * @param[in] pxPublishInfo is a pointer to structure containing deserialized + * Publish message. + */ +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ); + +/** + * @brief The application callback function for getting the incoming publishes, + * incoming acks, and ping responses reported from the MQTT library. + * + * @param[in] pxMQTTContext MQTT context pointer. + * @param[in] pxPacketInfo Packet Info pointer for the incoming packet. + * @param[in] pxDeserializedInfo Deserialized information from the incoming packet. + */ +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Static buffer used to hold MQTT messages being sent and received. + */ +static uint8_t ucSharedBuffer[ democonfigNETWORK_BUFFER_SIZE ]; + +/** + * @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 Packet Identifier generated when Publish request was sent to the broker; + * it is used to match received Publish ACK to the transmitted Publish packet. + */ +static uint16_t usPublishPacketIdentifier; + +/** + * @brief Packet Identifier generated when Subscribe request was sent to the broker; + * it is used to match received Subscribe ACK to the transmitted Subscribe packet. + */ +static uint16_t usSubscribePacketIdentifier; + +/** + * @brief Packet Identifier generated when Unsubscribe request was sent to the broker; + * it is used to match received Unsubscribe response to the transmitted Unsubscribe + * request. + */ +static uint16_t usUnsubscribePacketIdentifier; + +/** + * @brief A pair containing a topic filter and its SUBACK status. + */ +typedef struct topicFilterContext +{ + const char * pcTopicFilter; + MQTTSubAckStatus_t xSubAckStatus; +} topicFilterContext_t; + +/** + * @brief An array containing the context of a SUBACK; the SUBACK status + * of a filter is updated when the event callback processes a SUBACK. + */ +static topicFilterContext_t xTopicFilterContext[ mqttexampleTOPIC_COUNT ] = +{ + { mqttexampleTOPIC, MQTTSubAckFailure } +}; + + +/** @brief Static buffer used to hold MQTT messages being sent and received. */ +static MQTTFixedBuffer_t xBuffer = +{ + ucSharedBuffer, + democonfigNETWORK_BUFFER_SIZE +}; + +/*-----------------------------------------------------------*/ + +/* + * @brief Create the task that demonstrates the MQTT API Demo over a + * mutually authenticated network connection with MQTT broker. + */ +void vStartSimpleMQTTDemo( void ) +{ + /* This example uses a single application task, which in turn is used to + * connect, subscribe, publish, unsubscribe and disconnect from the MQTT + * broker. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. */ + prvMQTTDemoTask( NULL ); +} +/*-----------------------------------------------------------*/ + +/* + * @brief The Example shown below uses MQTT APIs to create MQTT messages and + * send them over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * This MQTT client subscribes to the topic as specified in mqttexampleTOPIC at the + * top of this file by sending a subscribe packet and then waiting for a subscribe + * acknowledgment (SUBACK).This client will then publish to the same topic it + * subscribed to, so it will expect all the messages it sends to the broker to be + * sent back to it from the broker. + */ +static void prvMQTTDemoTask( void * pvParameters ) +{ + uint32_t ulPublishCount = 0U, ulTopicCount = 0U; + const uint32_t ulMaxPublishCount = 5UL; + NetworkContext_t xNetworkContext = { 0 }; + TlsTransportParams_t xTlsTransportParams = { 0 }; + NetworkCredentials_t xNetworkCredentials = { 0 }; + MQTTContext_t xMQTTContext = { 0 }; + MQTTStatus_t xMQTTStatus; + TlsTransportStatus_t xNetworkStatus; + + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Set the entry time of the demo application. This entry time will be used + * to calculate relative time elapsed in the execution of the demo application, + * by the timer utility function that is provided to the MQTT library. + */ + ulGlobalEntryTimeMs = prvGetTimeMs(); + + /* Set the pParams member of the network context with desired transport. */ + xNetworkContext.pParams = &xTlsTransportParams; + + for( ; ; ) + { + /****************************** Connect. ******************************/ + + /* Attempt to establish TLS session with MQTT broker. If connection fails, + * retry after a timeout. Timeout value will be exponentially increased + * until the maximum number of attempts are reached or the maximum timeout + * value is reached. The function returns a failure status if the TCP + * connection cannot be established to the broker after the configured + * number of attempts. */ + xNetworkStatus = prvConnectToServerWithBackoffRetries( &xNetworkCredentials, + &xNetworkContext ); + configASSERT( xNetworkStatus == TLS_TRANSPORT_SUCCESS ); + + /* Sends an MQTT Connect packet over the already established TLS connection, + * and waits for connection acknowledgment (CONNACK) packet. */ + LogInfo( ( "Creating an MQTT connection to %s.\r\n", democonfigMQTT_BROKER_ENDPOINT ) ); + prvCreateMQTTConnectionWithBroker( &xMQTTContext, &xNetworkContext ); + + /**************************** Subscribe. ******************************/ + + /* If server rejected the subscription request, attempt to resubscribe to + * topic. Attempts are made according to the exponential backoff retry + * strategy implemented in BackoffAlgorithm. */ + prvMQTTSubscribeWithBackoffRetries( &xMQTTContext ); + + /****************** Publish and Keep Alive Loop. **********************/ + /* Publish messages with QoS1, send and process Keep alive messages. */ + for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ ) + { + LogInfo( ( "Publish to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTPublishToTopic( &xMQTTContext ); + + /* Process incoming publish echo, since application subscribed to the + * same topic, the broker will send publish message back to the + * application. */ + LogInfo( ( "Attempt to receive publish message from broker.\r\n" ) ); + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Leave Connection Idle for some time. */ + LogInfo( ( "Keeping Connection Idle...\r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ); + } + + /******************** Unsubscribe from the topic. *********************/ + LogInfo( ( "Unsubscribe from the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTUnsubscribeFromTopic( &xMQTTContext ); + + /* Process incoming UNSUBACK packet from the broker. */ + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /**************************** Disconnect. *****************************/ + + /* Send an MQTT Disconnect packet over the already connected TLS over + * TCP connection. There is no corresponding response for the disconnect + * packet. After sending disconnect, client must close the network + * connection. */ + LogInfo( ( "Disconnecting the MQTT connection with %s.\r\n", + democonfigMQTT_BROKER_ENDPOINT ) ); + xMQTTStatus = MQTT_Disconnect( &xMQTTContext ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Close the network connection. */ + TLS_FreeRTOS_Disconnect( &xNetworkContext ); + + /* Reset SUBACK status for each topic filter after completion of + * subscription request cycle. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = MQTTSubAckFailure; + } + + /* Wait for some time between two iterations to ensure that we do not + * bombard the broker. */ + LogInfo( ( "prvMQTTDemoTask() completed an iteration successfully. " + "Total free heap is %u.\r\n", + xPortGetFreeHeapSize() ) ); + LogInfo( ( "Demo completed successfully.\r\n" ) ); + LogInfo( ( "Short delay before starting the next iteration.... \r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ); + } +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pxNetworkContext ) +{ + TlsTransportStatus_t xNetworkStatus; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xReconnectParams; + uint16_t usNextRetryBackOff = 0U; + + #ifdef democonfigUSE_AWS_IOT_CORE_BROKER + + /* 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 + pxNetworkCredentials->pAlpnProtos = pcAlpnProtocols; + #endif /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + + pxNetworkCredentials->disableSni = democonfigDISABLE_SNI; + /* Set the credentials for establishing a TLS connection. */ + pxNetworkCredentials->pRootCa = ( const unsigned char * ) democonfigROOT_CA_PEM; + pxNetworkCredentials->rootCaSize = sizeof( democonfigROOT_CA_PEM ); + #ifdef democonfigCLIENT_CERTIFICATE_PEM + pxNetworkCredentials->pClientCert = ( const unsigned char * ) democonfigCLIENT_CERTIFICATE_PEM; + pxNetworkCredentials->clientCertSize = sizeof( democonfigCLIENT_CERTIFICATE_PEM ); + pxNetworkCredentials->pPrivateKey = ( const unsigned char * ) democonfigCLIENT_PRIVATE_KEY_PEM; + pxNetworkCredentials->privateKeySize = sizeof( democonfigCLIENT_PRIVATE_KEY_PEM ); + #endif + + /* Initialize reconnect attempts and interval. */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to MQTT broker. If connection fails, retry after + * a timeout. Timeout value will exponentially increase till maximum + * attempts are reached. + */ + do + { + /* Establish a TLS session 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:%u.\r\n", + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT ) ); + /* Attempt to create a mutually authenticated TLS connection. */ + xNetworkStatus = TLS_FreeRTOS_Connect( pxNetworkContext, + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT, + pxNetworkCredentials, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ); + + if( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) + { + /* 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(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Connection to the broker failed, all attempts exhausted." ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the broker failed. " + "Retrying connection with backoff and jitter." ) ); + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + } + } while( ( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + return xNetworkStatus; +} +/*-----------------------------------------------------------*/ + +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ) +{ + MQTTStatus_t xResult; + MQTTConnectInfo_t xConnectInfo; + bool xSessionPresent; + TransportInterface_t xTransport; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Fill in Transport Interface send and receive function pointers. */ + xTransport.pNetworkContext = pxNetworkContext; + xTransport.send = TLS_FreeRTOS_send; + xTransport.recv = TLS_FreeRTOS_recv; + + /* Initialize MQTT library. */ + xResult = MQTT_Init( pxMQTTContext, &xTransport, prvGetTimeMs, prvEventCallback, &xBuffer ); + configASSERT( xResult == MQTTSuccess ); + + /* Some fields are not used in this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xConnectInfo, 0x00, sizeof( xConnectInfo ) ); + + /* Start with a clean session i.e. direct the MQTT broker to discard any + * previous session data. Also, establishing a connection with clean session + * will ensure that the broker does not store any data when this client + * gets disconnected. */ + xConnectInfo.cleanSession = true; + + /* The client identifier is used to uniquely identify this MQTT client to + * the MQTT broker. In a production device the identifier can be something + * unique, such as a device serial number. */ + xConnectInfo.pClientIdentifier = democonfigCLIENT_IDENTIFIER; + xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( democonfigCLIENT_IDENTIFIER ); + + /* Set MQTT keep-alive period. If the application does not send packets at an interval less than + * the keep-alive period, the MQTT library will send PINGREQ packets. */ + xConnectInfo.keepAliveSeconds = mqttexampleKEEP_ALIVE_TIMEOUT_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. LWT is not used in this demo, so it + * is passed as NULL. */ + xResult = MQTT_Connect( pxMQTTContext, + &xConnectInfo, + NULL, + mqttexampleCONNACK_RECV_TIMEOUT_MS, + &xSessionPresent ); + configASSERT( xResult == MQTTSuccess ); + + /* Successfully established and MQTT connection with the broker. */ + LogInfo( ( "An MQTT connection is established with %s.", democonfigMQTT_BROKER_ENDPOINT ) ); +} +/*-----------------------------------------------------------*/ + +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ) +{ + MQTTStatus_t xResult = MQTTSuccess; + uint8_t * pucPayload = NULL; + size_t ulSize = 0; + uint32_t ulTopicCount = 0U; + + xResult = MQTT_GetSubAckStatusCodes( pxPacketInfo, &pucPayload, &ulSize ); + + /* MQTT_GetSubAckStatusCodes always returns success if called with packet info + * from the event callback and non-NULL parameters. */ + configASSERT( xResult == MQTTSuccess ); + + for( ulTopicCount = 0; ulTopicCount < ulSize; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = pucPayload[ ulTopicCount ]; + } +} +/*-----------------------------------------------------------*/ + +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult = MQTTSuccess; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xRetryParams; + uint16_t usNextRetryBackOff = 0U; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + bool xFailedSubscribeToTopic = false; + uint32_t ulTopicCount = 0U; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Initialize context for backoff retry attempts if SUBSCRIBE request fails. */ + BackoffAlgorithm_InitializeParams( &xRetryParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + do + { + /* The client is now connected to the broker. Subscribe to the topic + * as specified in mqttexampleTOPIC at the top of this file by sending a + * subscribe packet then waiting for a subscribe acknowledgment (SUBACK). + * This client will then publish to the same topic it subscribed to, so it + * will expect all the messages it sends to the broker to be sent back to it + * from the broker. This demo uses QOS0 in Subscribe, therefore, the Publish + * messages received from the broker will have QOS0. */ + LogInfo( ( "Attempt to subscribe to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + xResult = MQTT_Subscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usSubscribePacketIdentifier ); + configASSERT( xResult == MQTTSuccess ); + + LogInfo( ( "SUBSCRIBE sent for topic %s to broker.\n\n", mqttexampleTOPIC ) ); + + /* Process incoming packet from the broker. After sending the subscribe, the + * client may receive a publish before it receives a subscribe ack. Therefore, + * call generic incoming packet processing function. Since this demo is + * subscribing to the topic to which no one is publishing, probability of + * receiving Publish message before subscribe ack is zero; but application + * must be ready to receive any packet. This demo uses the generic packet + * processing function everywhere to highlight this fact. */ + xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xResult == MQTTSuccess ); + + /* Reset flag before checking suback responses. */ + xFailedSubscribeToTopic = false; + + /* Check if recent subscription request has been rejected. #xTopicFilterContext is updated + * in the event callback to reflect the status of the SUBACK sent by the broker. It represents + * either the QoS level granted by the server upon subscription, or acknowledgement of + * server rejection of the subscription request. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus == MQTTSubAckFailure ) + { + xFailedSubscribeToTopic = true; + + /* 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( &xRetryParams, uxRand(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Server rejected subscription request. All retry attempts have exhausted. Topic=%s", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Server rejected subscription request. Attempting to re-subscribe to topic %s.", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + /* Backoff before the next re-subscribe attempt. */ + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + + break; + } + } + + configASSERT( xBackoffAlgStatus != BackoffAlgorithmRetriesExhausted ); + } while( ( xFailedSubscribeToTopic == true ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTPublishInfo_t xMQTTPublishInfo; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Some fields are not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTPublishInfo, 0x00, sizeof( xMQTTPublishInfo ) ); + + /* This demo uses QoS1. */ + xMQTTPublishInfo.qos = MQTTQoS1; + xMQTTPublishInfo.retain = false; + xMQTTPublishInfo.pTopicName = mqttexampleTOPIC; + xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + xMQTTPublishInfo.pPayload = mqttexampleMESSAGE; + xMQTTPublishInfo.payloadLength = strlen( mqttexampleMESSAGE ); + + /* Get a unique packet id. */ + usPublishPacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send PUBLISH packet. Packet ID is not used for a QoS1 publish. */ + xResult = MQTT_Publish( pxMQTTContext, &xMQTTPublishInfo, usPublishPacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Get next unique packet identifier. */ + usUnsubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send UNSUBSCRIBE packet. */ + xResult = MQTT_Unsubscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usUnsubscribePacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ) +{ + uint32_t ulTopicCount = 0U; + + switch( pxIncomingPacket->type ) + { + case MQTT_PACKET_TYPE_PUBACK: + LogInfo( ( "PUBACK received for packet Id %u.\r\n", usPacketId ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usPublishPacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_SUBACK: + + /* A SUBACK from the broker, containing the server response to our subscription request, has been received. + * It contains the status code indicating server approval/rejection for the subscription to the single topic + * requested. The SUBACK will be parsed to obtain the status code, and this status code will be stored in global + * variable #xTopicFilterContext. */ + prvUpdateSubAckStatus( pxIncomingPacket ); + + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus != MQTTSubAckFailure ) + { + LogInfo( ( "Subscribed to the topic %s with maximum QoS %u.\r\n", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter, + xTopicFilterContext[ ulTopicCount ].xSubAckStatus ) ); + } + } + + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usSubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_UNSUBACK: + LogInfo( ( "Unsubscribed from the topic %s.\r\n", mqttexampleTOPIC ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usUnsubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_PINGRESP: + + /* Nothing to be done from application as library handles + * PINGRESP with the use of MQTT_ProcessLoop API function. */ + LogWarn( ( "PINGRESP should not be handled by the application " + "callback when using MQTT_ProcessLoop.\n" ) ); + break; + + /* Any other packet type is invalid. */ + default: + LogWarn( ( "prvMQTTProcessResponse() called with unknown packet type:(%02X).\r\n", + pxIncomingPacket->type ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ) +{ + configASSERT( pxPublishInfo != NULL ); + + /* Process incoming Publish. */ + LogInfo( ( "Incoming QoS : %d\n", pxPublishInfo->qos ) ); + + /* Verify the received publish is for the we have subscribed to. */ + if( ( pxPublishInfo->topicNameLength == strlen( mqttexampleTOPIC ) ) && + ( 0 == strncmp( mqttexampleTOPIC, pxPublishInfo->pTopicName, pxPublishInfo->topicNameLength ) ) ) + { + LogInfo( ( "\r\nIncoming Publish Topic Name: %.*s matches subscribed topic.\r\n" + "Incoming Publish Message : %.*s\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName, + pxPublishInfo->payloadLength, + pxPublishInfo->pPayload ) ); + } + else + { + LogInfo( ( "Incoming Publish Topic Name: %.*s does not match subscribed topic.\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ) +{ + /* The MQTT context is not used for this demo. */ + ( void ) pxMQTTContext; + + if( ( pxPacketInfo->type & 0xF0U ) == MQTT_PACKET_TYPE_PUBLISH ) + { + prvMQTTProcessIncomingPublish( pxDeserializedInfo->pPublishInfo ); + } + else + { + prvMQTTProcessResponse( pxPacketInfo, pxDeserializedInfo->packetIdentifier ); + } +} + +/*-----------------------------------------------------------*/ + +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 * MILLISECONDS_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; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSConfig.h new file mode 100644 index 000000000..80e04e185 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSConfig.h @@ -0,0 +1,210 @@ +/* + * FreeRTOS V202107.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 ( 1L ) + +/* 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 0x6a + +/* 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSIPConfig.h new file mode 100644 index 000000000..54927d2e4 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/FreeRTOSIPConfig.h @@ -0,0 +1,310 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 1 +#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) + #define FreeRTOS_debug_printf( X ) vLoggingPrintf X +#endif + +/* Set to 1 to print out non debugging messages, for example the output of the + * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 + * then FreeRTOS_printf should be set to the function used to print out the + * messages. */ +#define ipconfigHAS_PRINTF 1 +#if ( ipconfigHAS_PRINTF == 1 ) + #define FreeRTOS_printf( X ) vLoggingPrintf X +#endif + +/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing + * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN + +/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) + * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software + * stack repeating the checksum calculations. */ +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 + +/* Several API's will block until the result is known, or the action has been + * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be + * set per socket, using setsockopt(). If not set, the times below will be + * used as defaults. */ +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 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 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj new file mode 100644 index 000000000..0ea6765c2 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj @@ -0,0 +1,644 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + .;..\common;..\..\common\WinPCap;..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\Source\mbedtls_utils;..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\Source\Application-Protocols\network_transport\cellular;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\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;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\ThirdParty\mbedtls\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\common;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\private;..\..\..\Source\FreeRTOS-Cellular-Interface\source\interface;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\cellular;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj.filters new file mode 100644 index 000000000..084cc67f8 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/WIN32.vcxproj.filters @@ -0,0 +1,895 @@ + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {84164849-198e-497b-b135-322242d511cf} + + + {b61fd40e-ae93-4a08-9ee7-5dc8182595be} + + + {0c062983-2e9b-43c4-abd7-daf4e6254d96} + + + {141c3342-468b-4833-a23a-70ac37be207b} + + + {9d52e9bc-39e7-4d8e-a150-64eeeae9410b} + + + {26ee1535-b417-427d-8e72-79c6c859db6b} + + + {5465caea-3879-404b-a54e-753ece92941c} + + + {2559b11d-a741-471f-ad56-e7263dc15046} + + + {553e6fa4-ea81-46c6-bc4e-b694d9fa766e} + + + {a53e6044-6b9b-4e35-aaed-43e6f9dfbdb2} + + + {6c3bcc0b-b831-4567-9ca9-525a5a75427c} + + + {bfecf3e3-7116-4b34-9f78-dc11bc1fbbf3} + + + {aa0ef4b9-5c3e-4a1a-82b1-7938b1a596a7} + + + {d7c1e40c-3e7e-4e0e-b027-697eb7dd60bd} + + + {d61ee4c2-5375-4d96-8904-fd826d63208a} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + Common + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + Module + + + Module + + + Module + + + Module + + + Common + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + + + + Common\mbedtls + + + Common\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + Config + + + Config + + + Config + + + Config + + + + Config + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\interface + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + Module + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + + + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/cellular_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/cellular_config.h new file mode 100644 index 000000000..67f37864f --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/cellular_config.h @@ -0,0 +1,69 @@ +/* + * FreeRTOS V202107.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 cellular_config.h + * @brief cellular config options. + */ + +#ifndef __CELLULAR_CONFIG_H__ +#define __CELLULAR_CONFIG_H__ + +/* This is a project specific file and is used to override config values defined + * in cellular_config_defaults.h. */ + +/** + * Cellular comm interface make use of COM port on computer to communicate with + * cellular module on windows simulator, for example "COM5". + * #define CELLULAR_COMM_INTERFACE_PORT "...insert here..." + */ + +/* + * Default APN for network registration. + * #define CELLULAR_APN "...insert here..." + */ + +/* + * PDN context id for cellular network. + */ +#define CELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID_MIN ) + +/* + * PDN connect timeout for network registration. + */ +#define CELLULAR_PDN_CONNECT_TIMEOUT ( 100000UL ) + +/* + * Overwrite default config for different cellular modules. + */ + +/* + * GetHostByName API is not used in the demo. IP address is used to store the hostname. + * The value should be longer than the length of democonfigMQTT_BROKER_ENDPOINT in demo_config.h. + */ +#define CELLULAR_IP_ADDRESS_MAX_SIZE ( 64U ) + +#endif /* __CELLULAR_CONFIG_H__ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/core_mqtt_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/core_mqtt_config.h new file mode 100644 index 000000000..72c611851 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/core_mqtt_config.h @@ -0,0 +1,80 @@ +/* + * FreeRTOS V202107.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 + +#endif /* ifndef CORE_MQTT_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/demo_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/demo_config.h new file mode 100644 index 000000000..5003d56d5 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/demo_config.h @@ -0,0 +1,273 @@ +/* + * FreeRTOS V202107.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 + +/* FreeRTOS config include. */ +#include "FreeRTOSConfig.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 "CellularBG96" +#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 The MQTT client identifier used in this example. Each client identifier + * must be unique; so edit as required to ensure that 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, that supports mutual + * authentication. + * + * 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). + * + * @note If you would like to setup an MQTT broker for running this demo, + * please see `mqtt_broker_setup.txt`. + * + * #define democonfigMQTT_BROKER_ENDPOINT "...insert here..." + */ + +/** + * @brief The port to use for the demo. + * + * In general, port 8883 is for secured MQTT connections. + * + * @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. ) + */ + +/** + * @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. + * + * 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 ) + */ + +/** + * @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. + */ +#include "core_mqtt.h" /* Include coreMQTT header for MQTT_LIBRARY_VERSION macro. */ +#define democonfigMQTT_LIB "core-mqtt@"MQTT_LIBRARY_VERSION + +/** + * @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 + +/** + * @brief Set the priority of the main demo task. + */ +#define democonfigDEMO_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/** + * @brief Size of the network buffer for MQTT packets. + */ +#define democonfigNETWORK_BUFFER_SIZE ( 1024U ) + +/** + * @brief Size of the range request from 1nce onboarding service. + */ +#define democonfigRANGE_SIZE ( 1000U ) + +#endif /* DEMO_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mbedtls_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mbedtls_config.h new file mode 100644 index 000000000..94f704a77 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mbedtls_config.h @@ -0,0 +1,137 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/* This file configures mbed TLS for FreeRTOS. */ + +#ifndef MBEDTLS_CONFIG_H_ +#define MBEDTLS_CONFIG_H_ + +/* FreeRTOS include. */ +#include "FreeRTOS.h" + +/* Generate errors if deprecated functions are used. */ +#define MBEDTLS_DEPRECATED_REMOVED + +/* Place AES tables in ROM. */ +#define MBEDTLS_AES_ROM_TABLES + +/* Enable the following cipher modes. */ +#define MBEDTLS_CIPHER_MODE_CBC +#define MBEDTLS_CIPHER_MODE_CFB +#define MBEDTLS_CIPHER_MODE_CTR + +/* Enable the following cipher padding modes. */ +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS +#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN +#define MBEDTLS_CIPHER_PADDING_ZEROS + +/* Cipher suite configuration. */ +#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_NIST_OPTIM +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + +/* Enable all SSL alert messages. */ +#define MBEDTLS_SSL_ALL_ALERT_MESSAGES + +/* Enable the following SSL features. */ +#define MBEDTLS_SSL_ENCRYPT_THEN_MAC +#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET +#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH +#define MBEDTLS_SSL_PROTO_TLS1_2 +#define MBEDTLS_SSL_ALPN +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +/* Check certificate key usage. */ +#define MBEDTLS_X509_CHECK_KEY_USAGE +#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + +/* Disable platform entropy functions. */ +#define MBEDTLS_NO_PLATFORM_ENTROPY + +/* Enable the following mbed TLS features. */ +#define MBEDTLS_AES_C +#define MBEDTLS_ASN1_PARSE_C +#define MBEDTLS_ASN1_WRITE_C +#define MBEDTLS_BASE64_C +#define MBEDTLS_BIGNUM_C +#define MBEDTLS_CIPHER_C +#define MBEDTLS_CTR_DRBG_C +#define MBEDTLS_ECDH_C +#define MBEDTLS_ECDSA_C +#define MBEDTLS_ECP_C +#define MBEDTLS_ENTROPY_C +#define MBEDTLS_ERROR_C +#define MBEDTLS_GCM_C +#define MBEDTLS_MD_C +#define MBEDTLS_OID_C +#define MBEDTLS_PEM_PARSE_C +#define MBEDTLS_PK_C +#define MBEDTLS_PK_PARSE_C +#define MBEDTLS_PKCS1_V15 +#define MBEDTLS_PLATFORM_C +#define MBEDTLS_RSA_C +#define MBEDTLS_SHA1_C +#define MBEDTLS_SHA256_C +#define MBEDTLS_SSL_CLI_C +#define MBEDTLS_SSL_TLS_C +#define MBEDTLS_THREADING_ALT +#define MBEDTLS_THREADING_C +#define MBEDTLS_X509_USE_C +#define MBEDTLS_X509_CRT_PARSE_C + +/* Set the memory allocation functions on FreeRTOS. */ +void * mbedtls_platform_calloc( size_t nmemb, + size_t size ); +void mbedtls_platform_free( void * ptr ); +#define MBEDTLS_PLATFORM_MEMORY +#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc +#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free + +/* The network send and receive functions on FreeRTOS. */ +int mbedtls_cellular_send( void * ctx, + const unsigned char * buf, + size_t len ); +int mbedtls_cellular_recv( void * ctx, + unsigned char * buf, + size_t len ); + +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_cellular_send +#define MBEDTLS_SSL_RECV mbedtls_cellular_recv + +/* The entropy poll function. */ +int mbedtls_platform_entropy_poll( void * data, + unsigned char * output, + size_t len, + size_t * olen ); + +#include "mbedtls/check_config.h" + +#endif /* ifndef MBEDTLS_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mqtt_mutual_auth_demo_with_bg96.sln b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mqtt_mutual_auth_demo_with_bg96.sln new file mode 100644 index 000000000..dcfc1fe09 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96/mqtt_mutual_auth_demo_with_bg96.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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/DemoTasks/MutualAuthMQTTExample.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/DemoTasks/MutualAuthMQTTExample.c new file mode 100644 index 000000000..849eb874b --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/DemoTasks/MutualAuthMQTTExample.c @@ -0,0 +1,1074 @@ +/* + * FreeRTOS V202107.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 + * + */ + +/* + * Demo for showing use of the MQTT API using a mutually authenticated + * network connection. + * + * The Example shown below uses MQTT APIs to create MQTT messages and send them + * over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * A mutually authenticated TLS connection is used to connect to the + * MQTT message broker in this example. Define democonfigMQTT_BROKER_ENDPOINT, + * democonfigROOT_CA_PEM, democonfigCLIENT_CERTIFICATE_PEM, + * and democonfigCLIENT_PRIVATE_KEY_PEM in demo_config.h to establish a + * mutually authenticated connection. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. + */ + +/* Standard includes. */ +#include +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + +/* MQTT library includes. */ +#include "core_mqtt.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* Transport interface implementation include header for TLS. */ +#include "using_mbedtls.h" + +/*-----------------------------------------------------------*/ + +/* Compile time error for undefined configs. */ +#ifndef democonfigMQTT_BROKER_ENDPOINT + #error "Define the config democonfigMQTT_BROKER_ENDPOINT by following the instructions in file demo_config.h." +#endif +#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 */ + +/*-----------------------------------------------------------*/ + +/* Default values for configs. */ +#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. + * + * @note Appending __TIME__ to the client id string will help to create a unique + * client id every time an application binary is built. Only a single instance of + * this application's compiled binary may be used at a time, since the client ID + * will always be the same. + */ + #define democonfigCLIENT_IDENTIFIER "testClient"__TIME__ +#endif + +#ifndef democonfigMQTT_BROKER_PORT + +/** + * @brief The port to use for the demo. + */ + #define democonfigMQTT_BROKER_PORT ( 8883 ) +#endif + +/*-----------------------------------------------------------*/ + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define mqttexampleRETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed operation + * with server. + */ +#define mqttexampleRETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation retry + * attempts. + */ +#define mqttexampleRETRY_BACKOFF_BASE_MS ( 500U ) + +/** + * @brief Timeout for receiving CONNACK packet in milliseconds. + */ +#define mqttexampleCONNACK_RECV_TIMEOUT_MS ( 5000U ) + +/** + * @brief The topic to subscribe and publish to in the example. + * + * The topic name starts with the client identifier to ensure that each demo + * interacts with a unique topic name. + */ +#define mqttexampleTOPIC democonfigCLIENT_IDENTIFIER "/example/topic" + +/** + * @brief The number of topic filters to subscribe. + */ +#define mqttexampleTOPIC_COUNT ( 1 ) + +/** + * @brief The MQTT message published in this example. + */ +#define mqttexampleMESSAGE "Hello World!" + +/** + * @brief Time in ticks to wait between each cycle of the demo implemented + * by prvMQTTDemoTask(). + */ +#define mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ( pdMS_TO_TICKS( 5000U ) ) + +/** + * @brief Timeout for MQTT_ProcessLoop in milliseconds. + */ +#define mqttexamplePROCESS_LOOP_TIMEOUT_MS ( 5000U ) + +/** + * @brief Keep alive time reported to the broker while establishing + * an MQTT connection. + * + * 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 mqttexampleKEEP_ALIVE_TIMEOUT_SECONDS ( 60U ) + +/** + * @brief Delay (in ticks) between consecutive cycles of MQTT publish operations in a + * demo iteration. + * + * Note that the process loop also has a timeout, so the total time between + * publishes is the sum of the two delays. + */ +#define mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ( pdMS_TO_TICKS( 2000U ) ) + +/** + * @brief Transport timeout in milliseconds for transport send and receive. + */ +#define mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 10000U ) + +/** + * @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@"MQTT_LIBRARY_VERSION +#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 Milliseconds per second. + */ +#define MILLISECONDS_PER_SECOND ( 1000U ) + +/** + * @brief Milliseconds per FreeRTOS tick. + */ +#define MILLISECONDS_PER_TICK ( MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) + +/*-----------------------------------------------------------*/ + +/** + * @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 The task used to demonstrate the MQTT API. + * + * @param[in] pvParameters Parameters as passed at the time of task creation. Not + * used in this example. + */ +static void prvMQTTDemoTask( void * pvParameters ); + + +/** + * @brief Connect to MQTT broker with reconnection retries. + * + * If connection fails, retry is attempted after a timeout. + * Timeout value will exponentially increase until maximum + * timeout value is reached or the number of attempts are exhausted. + * + * @param[out] pxNetworkContext The parameter to return the created network context. + * + * @return The status of the final connection attempt. + */ +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pNetworkContext ); + +/** + * @brief Sends an MQTT Connect packet over the already connected TLS over TCP connection. + * + * @param[in, out] pxMQTTContext MQTT context pointer. + * @param[in] xNetworkContext Network context. + */ +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ); + +/** + * @brief Function to update variable #xTopicFilterContext with status + * information from Subscribe ACK. Called by the event callback after processing + * an incoming SUBACK packet. + * + * @param[in] Server response to the subscription request. + */ +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ); + +/** + * @brief Subscribes to the topic as specified in mqttexampleTOPIC at the top of + * this file. In the case of a Subscribe ACK failure, then subscription is + * retried using an exponential backoff strategy with jitter. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Publishes a message mqttexampleMESSAGE on mqttexampleTOPIC topic. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Unsubscribes from the previously subscribed topic as specified + * in mqttexampleTOPIC. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief The timer query function provided to the MQTT context. + * + * @return Time in milliseconds. + */ +static uint32_t prvGetTimeMs( void ); + +/** + * @brief Process a response or ack to an MQTT request (PING, PUBLISH, + * SUBSCRIBE or UNSUBSCRIBE). This function processes PINGRESP, PUBACK, + * SUBACK, and UNSUBACK. + * + * @param[in] pxIncomingPacket is a pointer to structure containing deserialized + * MQTT response. + * @param[in] usPacketId is the packet identifier from the ack received. + */ +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ); + +/** + * @brief Process incoming Publish message. + * + * @param[in] pxPublishInfo is a pointer to structure containing deserialized + * Publish message. + */ +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ); + +/** + * @brief The application callback function for getting the incoming publishes, + * incoming acks, and ping responses reported from the MQTT library. + * + * @param[in] pxMQTTContext MQTT context pointer. + * @param[in] pxPacketInfo Packet Info pointer for the incoming packet. + * @param[in] pxDeserializedInfo Deserialized information from the incoming packet. + */ +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Static buffer used to hold MQTT messages being sent and received. + */ +static uint8_t ucSharedBuffer[ democonfigNETWORK_BUFFER_SIZE ]; + +/** + * @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 Packet Identifier generated when Publish request was sent to the broker; + * it is used to match received Publish ACK to the transmitted Publish packet. + */ +static uint16_t usPublishPacketIdentifier; + +/** + * @brief Packet Identifier generated when Subscribe request was sent to the broker; + * it is used to match received Subscribe ACK to the transmitted Subscribe packet. + */ +static uint16_t usSubscribePacketIdentifier; + +/** + * @brief Packet Identifier generated when Unsubscribe request was sent to the broker; + * it is used to match received Unsubscribe response to the transmitted Unsubscribe + * request. + */ +static uint16_t usUnsubscribePacketIdentifier; + +/** + * @brief A pair containing a topic filter and its SUBACK status. + */ +typedef struct topicFilterContext +{ + const char * pcTopicFilter; + MQTTSubAckStatus_t xSubAckStatus; +} topicFilterContext_t; + +/** + * @brief An array containing the context of a SUBACK; the SUBACK status + * of a filter is updated when the event callback processes a SUBACK. + */ +static topicFilterContext_t xTopicFilterContext[ mqttexampleTOPIC_COUNT ] = +{ + { mqttexampleTOPIC, MQTTSubAckFailure } +}; + + +/** @brief Static buffer used to hold MQTT messages being sent and received. */ +static MQTTFixedBuffer_t xBuffer = +{ + ucSharedBuffer, + democonfigNETWORK_BUFFER_SIZE +}; + +/*-----------------------------------------------------------*/ + +/* + * @brief Create the task that demonstrates the MQTT API Demo over a + * mutually authenticated network connection with MQTT broker. + */ +void vStartSimpleMQTTDemo( void ) +{ + /* This example uses a single application task, which in turn is used to + * connect, subscribe, publish, unsubscribe and disconnect from the MQTT + * broker. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. */ + prvMQTTDemoTask( NULL ); +} +/*-----------------------------------------------------------*/ + +/* + * @brief The Example shown below uses MQTT APIs to create MQTT messages and + * send them over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * This MQTT client subscribes to the topic as specified in mqttexampleTOPIC at the + * top of this file by sending a subscribe packet and then waiting for a subscribe + * acknowledgment (SUBACK).This client will then publish to the same topic it + * subscribed to, so it will expect all the messages it sends to the broker to be + * sent back to it from the broker. + */ +static void prvMQTTDemoTask( void * pvParameters ) +{ + uint32_t ulPublishCount = 0U, ulTopicCount = 0U; + const uint32_t ulMaxPublishCount = 5UL; + NetworkContext_t xNetworkContext = { 0 }; + TlsTransportParams_t xTlsTransportParams = { 0 }; + NetworkCredentials_t xNetworkCredentials = { 0 }; + MQTTContext_t xMQTTContext = { 0 }; + MQTTStatus_t xMQTTStatus; + TlsTransportStatus_t xNetworkStatus; + + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Set the entry time of the demo application. This entry time will be used + * to calculate relative time elapsed in the execution of the demo application, + * by the timer utility function that is provided to the MQTT library. + */ + ulGlobalEntryTimeMs = prvGetTimeMs(); + + /* Set the pParams member of the network context with desired transport. */ + xNetworkContext.pParams = &xTlsTransportParams; + + for( ; ; ) + { + /****************************** Connect. ******************************/ + + /* Attempt to establish TLS session with MQTT broker. If connection fails, + * retry after a timeout. Timeout value will be exponentially increased + * until the maximum number of attempts are reached or the maximum timeout + * value is reached. The function returns a failure status if the TCP + * connection cannot be established to the broker after the configured + * number of attempts. */ + xNetworkStatus = prvConnectToServerWithBackoffRetries( &xNetworkCredentials, + &xNetworkContext ); + configASSERT( xNetworkStatus == TLS_TRANSPORT_SUCCESS ); + + /* Sends an MQTT Connect packet over the already established TLS connection, + * and waits for connection acknowledgment (CONNACK) packet. */ + LogInfo( ( "Creating an MQTT connection to %s.\r\n", democonfigMQTT_BROKER_ENDPOINT ) ); + prvCreateMQTTConnectionWithBroker( &xMQTTContext, &xNetworkContext ); + + /**************************** Subscribe. ******************************/ + + /* If server rejected the subscription request, attempt to resubscribe to + * topic. Attempts are made according to the exponential backoff retry + * strategy implemented in BackoffAlgorithm. */ + prvMQTTSubscribeWithBackoffRetries( &xMQTTContext ); + + /****************** Publish and Keep Alive Loop. **********************/ + /* Publish messages with QoS1, send and process Keep alive messages. */ + for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ ) + { + LogInfo( ( "Publish to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTPublishToTopic( &xMQTTContext ); + + /* Process incoming publish echo, since application subscribed to the + * same topic, the broker will send publish message back to the + * application. */ + LogInfo( ( "Attempt to receive publish message from broker.\r\n" ) ); + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Leave Connection Idle for some time. */ + LogInfo( ( "Keeping Connection Idle...\r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ); + } + + /******************** Unsubscribe from the topic. *********************/ + LogInfo( ( "Unsubscribe from the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTUnsubscribeFromTopic( &xMQTTContext ); + + /* Process incoming UNSUBACK packet from the broker. */ + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /**************************** Disconnect. *****************************/ + + /* Send an MQTT Disconnect packet over the already connected TLS over + * TCP connection. There is no corresponding response for the disconnect + * packet. After sending disconnect, client must close the network + * connection. */ + LogInfo( ( "Disconnecting the MQTT connection with %s.\r\n", + democonfigMQTT_BROKER_ENDPOINT ) ); + xMQTTStatus = MQTT_Disconnect( &xMQTTContext ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Close the network connection. */ + TLS_FreeRTOS_Disconnect( &xNetworkContext ); + + /* Reset SUBACK status for each topic filter after completion of + * subscription request cycle. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = MQTTSubAckFailure; + } + + /* Wait for some time between two iterations to ensure that we do not + * bombard the broker. */ + LogInfo( ( "prvMQTTDemoTask() completed an iteration successfully. " + "Total free heap is %u.\r\n", + xPortGetFreeHeapSize() ) ); + LogInfo( ( "Demo completed successfully.\r\n" ) ); + LogInfo( ( "Short delay before starting the next iteration.... \r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ); + } +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pxNetworkContext ) +{ + TlsTransportStatus_t xNetworkStatus; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xReconnectParams; + uint16_t usNextRetryBackOff = 0U; + + #ifdef democonfigUSE_AWS_IOT_CORE_BROKER + + /* 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 + pxNetworkCredentials->pAlpnProtos = pcAlpnProtocols; + #endif /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + + pxNetworkCredentials->disableSni = democonfigDISABLE_SNI; + /* Set the credentials for establishing a TLS connection. */ + pxNetworkCredentials->pRootCa = ( const unsigned char * ) democonfigROOT_CA_PEM; + pxNetworkCredentials->rootCaSize = sizeof( democonfigROOT_CA_PEM ); + #ifdef democonfigCLIENT_CERTIFICATE_PEM + pxNetworkCredentials->pClientCert = ( const unsigned char * ) democonfigCLIENT_CERTIFICATE_PEM; + pxNetworkCredentials->clientCertSize = sizeof( democonfigCLIENT_CERTIFICATE_PEM ); + pxNetworkCredentials->pPrivateKey = ( const unsigned char * ) democonfigCLIENT_PRIVATE_KEY_PEM; + pxNetworkCredentials->privateKeySize = sizeof( democonfigCLIENT_PRIVATE_KEY_PEM ); + #endif + + /* Initialize reconnect attempts and interval. */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to MQTT broker. If connection fails, retry after + * a timeout. Timeout value will exponentially increase till maximum + * attempts are reached. + */ + do + { + /* Establish a TLS session 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:%u.\r\n", + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT ) ); + /* Attempt to create a mutually authenticated TLS connection. */ + xNetworkStatus = TLS_FreeRTOS_Connect( pxNetworkContext, + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT, + pxNetworkCredentials, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ); + + if( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) + { + /* 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(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Connection to the broker failed, all attempts exhausted." ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the broker failed. " + "Retrying connection with backoff and jitter." ) ); + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + } + } while( ( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + return xNetworkStatus; +} +/*-----------------------------------------------------------*/ + +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ) +{ + MQTTStatus_t xResult; + MQTTConnectInfo_t xConnectInfo; + bool xSessionPresent; + TransportInterface_t xTransport; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Fill in Transport Interface send and receive function pointers. */ + xTransport.pNetworkContext = pxNetworkContext; + xTransport.send = TLS_FreeRTOS_send; + xTransport.recv = TLS_FreeRTOS_recv; + + /* Initialize MQTT library. */ + xResult = MQTT_Init( pxMQTTContext, &xTransport, prvGetTimeMs, prvEventCallback, &xBuffer ); + configASSERT( xResult == MQTTSuccess ); + + /* Some fields are not used in this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xConnectInfo, 0x00, sizeof( xConnectInfo ) ); + + /* Start with a clean session i.e. direct the MQTT broker to discard any + * previous session data. Also, establishing a connection with clean session + * will ensure that the broker does not store any data when this client + * gets disconnected. */ + xConnectInfo.cleanSession = true; + + /* The client identifier is used to uniquely identify this MQTT client to + * the MQTT broker. In a production device the identifier can be something + * unique, such as a device serial number. */ + xConnectInfo.pClientIdentifier = democonfigCLIENT_IDENTIFIER; + xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( democonfigCLIENT_IDENTIFIER ); + + /* Set MQTT keep-alive period. If the application does not send packets at an interval less than + * the keep-alive period, the MQTT library will send PINGREQ packets. */ + xConnectInfo.keepAliveSeconds = mqttexampleKEEP_ALIVE_TIMEOUT_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. LWT is not used in this demo, so it + * is passed as NULL. */ + xResult = MQTT_Connect( pxMQTTContext, + &xConnectInfo, + NULL, + mqttexampleCONNACK_RECV_TIMEOUT_MS, + &xSessionPresent ); + configASSERT( xResult == MQTTSuccess ); + + /* Successfully established and MQTT connection with the broker. */ + LogInfo( ( "An MQTT connection is established with %s.", democonfigMQTT_BROKER_ENDPOINT ) ); +} +/*-----------------------------------------------------------*/ + +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ) +{ + MQTTStatus_t xResult = MQTTSuccess; + uint8_t * pucPayload = NULL; + size_t ulSize = 0; + uint32_t ulTopicCount = 0U; + + xResult = MQTT_GetSubAckStatusCodes( pxPacketInfo, &pucPayload, &ulSize ); + + /* MQTT_GetSubAckStatusCodes always returns success if called with packet info + * from the event callback and non-NULL parameters. */ + configASSERT( xResult == MQTTSuccess ); + + for( ulTopicCount = 0; ulTopicCount < ulSize; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = pucPayload[ ulTopicCount ]; + } +} +/*-----------------------------------------------------------*/ + +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult = MQTTSuccess; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xRetryParams; + uint16_t usNextRetryBackOff = 0U; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + bool xFailedSubscribeToTopic = false; + uint32_t ulTopicCount = 0U; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Initialize context for backoff retry attempts if SUBSCRIBE request fails. */ + BackoffAlgorithm_InitializeParams( &xRetryParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + do + { + /* The client is now connected to the broker. Subscribe to the topic + * as specified in mqttexampleTOPIC at the top of this file by sending a + * subscribe packet then waiting for a subscribe acknowledgment (SUBACK). + * This client will then publish to the same topic it subscribed to, so it + * will expect all the messages it sends to the broker to be sent back to it + * from the broker. This demo uses QOS0 in Subscribe, therefore, the Publish + * messages received from the broker will have QOS0. */ + LogInfo( ( "Attempt to subscribe to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + xResult = MQTT_Subscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usSubscribePacketIdentifier ); + configASSERT( xResult == MQTTSuccess ); + + LogInfo( ( "SUBSCRIBE sent for topic %s to broker.\n\n", mqttexampleTOPIC ) ); + + /* Process incoming packet from the broker. After sending the subscribe, the + * client may receive a publish before it receives a subscribe ack. Therefore, + * call generic incoming packet processing function. Since this demo is + * subscribing to the topic to which no one is publishing, probability of + * receiving Publish message before subscribe ack is zero; but application + * must be ready to receive any packet. This demo uses the generic packet + * processing function everywhere to highlight this fact. */ + xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xResult == MQTTSuccess ); + + /* Reset flag before checking suback responses. */ + xFailedSubscribeToTopic = false; + + /* Check if recent subscription request has been rejected. #xTopicFilterContext is updated + * in the event callback to reflect the status of the SUBACK sent by the broker. It represents + * either the QoS level granted by the server upon subscription, or acknowledgement of + * server rejection of the subscription request. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus == MQTTSubAckFailure ) + { + xFailedSubscribeToTopic = true; + + /* 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( &xRetryParams, uxRand(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Server rejected subscription request. All retry attempts have exhausted. Topic=%s", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Server rejected subscription request. Attempting to re-subscribe to topic %s.", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + /* Backoff before the next re-subscribe attempt. */ + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + + break; + } + } + + configASSERT( xBackoffAlgStatus != BackoffAlgorithmRetriesExhausted ); + } while( ( xFailedSubscribeToTopic == true ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTPublishInfo_t xMQTTPublishInfo; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Some fields are not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTPublishInfo, 0x00, sizeof( xMQTTPublishInfo ) ); + + /* This demo uses QoS1. */ + xMQTTPublishInfo.qos = MQTTQoS1; + xMQTTPublishInfo.retain = false; + xMQTTPublishInfo.pTopicName = mqttexampleTOPIC; + xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + xMQTTPublishInfo.pPayload = mqttexampleMESSAGE; + xMQTTPublishInfo.payloadLength = strlen( mqttexampleMESSAGE ); + + /* Get a unique packet id. */ + usPublishPacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send PUBLISH packet. Packet ID is not used for a QoS1 publish. */ + xResult = MQTT_Publish( pxMQTTContext, &xMQTTPublishInfo, usPublishPacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Get next unique packet identifier. */ + usUnsubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send UNSUBSCRIBE packet. */ + xResult = MQTT_Unsubscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usUnsubscribePacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ) +{ + uint32_t ulTopicCount = 0U; + + switch( pxIncomingPacket->type ) + { + case MQTT_PACKET_TYPE_PUBACK: + LogInfo( ( "PUBACK received for packet Id %u.\r\n", usPacketId ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usPublishPacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_SUBACK: + + /* A SUBACK from the broker, containing the server response to our subscription request, has been received. + * It contains the status code indicating server approval/rejection for the subscription to the single topic + * requested. The SUBACK will be parsed to obtain the status code, and this status code will be stored in global + * variable #xTopicFilterContext. */ + prvUpdateSubAckStatus( pxIncomingPacket ); + + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus != MQTTSubAckFailure ) + { + LogInfo( ( "Subscribed to the topic %s with maximum QoS %u.\r\n", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter, + xTopicFilterContext[ ulTopicCount ].xSubAckStatus ) ); + } + } + + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usSubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_UNSUBACK: + LogInfo( ( "Unsubscribed from the topic %s.\r\n", mqttexampleTOPIC ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usUnsubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_PINGRESP: + + /* Nothing to be done from application as library handles + * PINGRESP with the use of MQTT_ProcessLoop API function. */ + LogWarn( ( "PINGRESP should not be handled by the application " + "callback when using MQTT_ProcessLoop.\n" ) ); + break; + + /* Any other packet type is invalid. */ + default: + LogWarn( ( "prvMQTTProcessResponse() called with unknown packet type:(%02X).\r\n", + pxIncomingPacket->type ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ) +{ + configASSERT( pxPublishInfo != NULL ); + + /* Process incoming Publish. */ + LogInfo( ( "Incoming QoS : %d\n", pxPublishInfo->qos ) ); + + /* Verify the received publish is for the we have subscribed to. */ + if( ( pxPublishInfo->topicNameLength == strlen( mqttexampleTOPIC ) ) && + ( 0 == strncmp( mqttexampleTOPIC, pxPublishInfo->pTopicName, pxPublishInfo->topicNameLength ) ) ) + { + LogInfo( ( "\r\nIncoming Publish Topic Name: %.*s matches subscribed topic.\r\n" + "Incoming Publish Message : %.*s\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName, + pxPublishInfo->payloadLength, + pxPublishInfo->pPayload ) ); + } + else + { + LogInfo( ( "Incoming Publish Topic Name: %.*s does not match subscribed topic.\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ) +{ + /* The MQTT context is not used for this demo. */ + ( void ) pxMQTTContext; + + if( ( pxPacketInfo->type & 0xF0U ) == MQTT_PACKET_TYPE_PUBLISH ) + { + prvMQTTProcessIncomingPublish( pxDeserializedInfo->pPublishInfo ); + } + else + { + prvMQTTProcessResponse( pxPacketInfo, pxDeserializedInfo->packetIdentifier ); + } +} + +/*-----------------------------------------------------------*/ + +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 * MILLISECONDS_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; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSConfig.h new file mode 100644 index 000000000..80e04e185 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSConfig.h @@ -0,0 +1,210 @@ +/* + * FreeRTOS V202107.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 ( 1L ) + +/* 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 0x6a + +/* 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSIPConfig.h new file mode 100644 index 000000000..54927d2e4 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/FreeRTOSIPConfig.h @@ -0,0 +1,310 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 1 +#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) + #define FreeRTOS_debug_printf( X ) vLoggingPrintf X +#endif + +/* Set to 1 to print out non debugging messages, for example the output of the + * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 + * then FreeRTOS_printf should be set to the function used to print out the + * messages. */ +#define ipconfigHAS_PRINTF 1 +#if ( ipconfigHAS_PRINTF == 1 ) + #define FreeRTOS_printf( X ) vLoggingPrintf X +#endif + +/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing + * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN + +/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) + * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software + * stack repeating the checksum calculations. */ +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 + +/* Several API's will block until the result is known, or the action has been + * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be + * set per socket, using setsockopt(). If not set, the times below will be + * used as defaults. */ +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 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 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj new file mode 100644 index 000000000..f2675a270 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj @@ -0,0 +1,644 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + .;..\common;..\..\common\WinPCap;..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\Source\mbedtls_utils;..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\Source\Application-Protocols\network_transport\cellular;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\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;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\ThirdParty\mbedtls\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\common;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\private;..\..\..\Source\FreeRTOS-Cellular-Interface\source\interface;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\cellular;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj.filters new file mode 100644 index 000000000..225682aab --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/WIN32.vcxproj.filters @@ -0,0 +1,897 @@ + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {84164849-198e-497b-b135-322242d511cf} + + + {b61fd40e-ae93-4a08-9ee7-5dc8182595be} + + + {0c062983-2e9b-43c4-abd7-daf4e6254d96} + + + {141c3342-468b-4833-a23a-70ac37be207b} + + + {9d52e9bc-39e7-4d8e-a150-64eeeae9410b} + + + {26ee1535-b417-427d-8e72-79c6c859db6b} + + + {5465caea-3879-404b-a54e-753ece92941c} + + + {2559b11d-a741-471f-ad56-e7263dc15046} + + + {553e6fa4-ea81-46c6-bc4e-b694d9fa766e} + + + {a53e6044-6b9b-4e35-aaed-43e6f9dfbdb2} + + + {6c3bcc0b-b831-4567-9ca9-525a5a75427c} + + + {bfecf3e3-7116-4b34-9f78-dc11bc1fbbf3} + + + {aa0ef4b9-5c3e-4a1a-82b1-7938b1a596a7} + + + {d7c1e40c-3e7e-4e0e-b027-697eb7dd60bd} + + + {ecbccccb-07f7-402c-a775-58bae2032453} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + Common + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + Common + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + + Module + + + Module + + + Module + + + Module + + + + + + + + Common\mbedtls + + + Common\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + Config + + + Config + + + Config + + + Config + + + + Config + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\interface + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + + Module + + + + + + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/cellular_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/cellular_config.h new file mode 100644 index 000000000..3679bc629 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/cellular_config.h @@ -0,0 +1,76 @@ +/* + * FreeRTOS V202107.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 cellular_config.h + * @brief cellular config options. + */ + +#ifndef __CELLULAR_CONFIG_H__ +#define __CELLULAR_CONFIG_H__ + +/* This is a project specific file and is used to override config values defined + * in cellular_config_defaults.h. */ + +/** + * Cellular comm interface make use of COM port on computer to communicate with + * cellular module on windows simulator, for example "COM5". + * #define CELLULAR_COMM_INTERFACE_PORT "...insert here..." + */ + +/* + * Default APN for network registration. + * #define CELLULAR_APN "...insert here..." + */ + +/* + * PDN context id for cellular network. + */ +#define CELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID_MIN ) + +/* + * PDN connect timeout for network registration. + */ +#define CELLULAR_PDN_CONNECT_TIMEOUT ( 100000UL ) + +/* + * Overwrite default config for different cellular modules. + */ + +/* + * GetHostByName API is not used in the demo. IP address is used to store the hostname. + * The value should be longer than the length of democonfigMQTT_BROKER_ENDPOINT in demo_config.h. + */ +#define CELLULAR_IP_ADDRESS_MAX_SIZE ( 64U ) + +/* + * GSM network is not supported in HL7800. + * Add this config to suppress Error message if you are using HL7800. + * #define CELLULAR_MODEM_NO_GSM_NETWORK + */ +#define CELLULAR_MODEM_NO_GSM_NETWORK + +#endif /* __CELLULAR_CONFIG_H__ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/core_mqtt_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/core_mqtt_config.h new file mode 100644 index 000000000..72c611851 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/core_mqtt_config.h @@ -0,0 +1,80 @@ +/* + * FreeRTOS V202107.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 + +#endif /* ifndef CORE_MQTT_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/demo_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/demo_config.h new file mode 100644 index 000000000..645c05e2b --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/demo_config.h @@ -0,0 +1,273 @@ +/* + * FreeRTOS V202107.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 + +/* FreeRTOS config include. */ +#include "FreeRTOSConfig.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 "CellularHL7802" +#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 The MQTT client identifier used in this example. Each client identifier + * must be unique; so edit as required to ensure that 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, that supports mutual + * authentication. + * + * 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). + * + * @note If you would like to setup an MQTT broker for running this demo, + * please see `mqtt_broker_setup.txt`. + * + * #define democonfigMQTT_BROKER_ENDPOINT "...insert here..." + */ + +/** + * @brief The port to use for the demo. + * + * In general, port 8883 is for secured MQTT connections. + * + * @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. ) + */ + +/** + * @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. + * + * 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 ) + */ + +/** + * @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. + */ +#include "core_mqtt.h" /* Include coreMQTT header for MQTT_LIBRARY_VERSION macro. */ +#define democonfigMQTT_LIB "core-mqtt@"MQTT_LIBRARY_VERSION + +/** + * @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 + +/** + * @brief Set the priority of the main demo task. + */ +#define democonfigDEMO_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/** + * @brief Size of the network buffer for MQTT packets. + */ +#define democonfigNETWORK_BUFFER_SIZE ( 1024U ) + +/** + * @brief Size of the range request from 1nce onboarding service. + */ +#define democonfigRANGE_SIZE ( 1000U ) + +#endif /* DEMO_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mbedtls_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mbedtls_config.h new file mode 100644 index 000000000..94f704a77 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mbedtls_config.h @@ -0,0 +1,137 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/* This file configures mbed TLS for FreeRTOS. */ + +#ifndef MBEDTLS_CONFIG_H_ +#define MBEDTLS_CONFIG_H_ + +/* FreeRTOS include. */ +#include "FreeRTOS.h" + +/* Generate errors if deprecated functions are used. */ +#define MBEDTLS_DEPRECATED_REMOVED + +/* Place AES tables in ROM. */ +#define MBEDTLS_AES_ROM_TABLES + +/* Enable the following cipher modes. */ +#define MBEDTLS_CIPHER_MODE_CBC +#define MBEDTLS_CIPHER_MODE_CFB +#define MBEDTLS_CIPHER_MODE_CTR + +/* Enable the following cipher padding modes. */ +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS +#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN +#define MBEDTLS_CIPHER_PADDING_ZEROS + +/* Cipher suite configuration. */ +#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_NIST_OPTIM +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + +/* Enable all SSL alert messages. */ +#define MBEDTLS_SSL_ALL_ALERT_MESSAGES + +/* Enable the following SSL features. */ +#define MBEDTLS_SSL_ENCRYPT_THEN_MAC +#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET +#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH +#define MBEDTLS_SSL_PROTO_TLS1_2 +#define MBEDTLS_SSL_ALPN +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +/* Check certificate key usage. */ +#define MBEDTLS_X509_CHECK_KEY_USAGE +#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + +/* Disable platform entropy functions. */ +#define MBEDTLS_NO_PLATFORM_ENTROPY + +/* Enable the following mbed TLS features. */ +#define MBEDTLS_AES_C +#define MBEDTLS_ASN1_PARSE_C +#define MBEDTLS_ASN1_WRITE_C +#define MBEDTLS_BASE64_C +#define MBEDTLS_BIGNUM_C +#define MBEDTLS_CIPHER_C +#define MBEDTLS_CTR_DRBG_C +#define MBEDTLS_ECDH_C +#define MBEDTLS_ECDSA_C +#define MBEDTLS_ECP_C +#define MBEDTLS_ENTROPY_C +#define MBEDTLS_ERROR_C +#define MBEDTLS_GCM_C +#define MBEDTLS_MD_C +#define MBEDTLS_OID_C +#define MBEDTLS_PEM_PARSE_C +#define MBEDTLS_PK_C +#define MBEDTLS_PK_PARSE_C +#define MBEDTLS_PKCS1_V15 +#define MBEDTLS_PLATFORM_C +#define MBEDTLS_RSA_C +#define MBEDTLS_SHA1_C +#define MBEDTLS_SHA256_C +#define MBEDTLS_SSL_CLI_C +#define MBEDTLS_SSL_TLS_C +#define MBEDTLS_THREADING_ALT +#define MBEDTLS_THREADING_C +#define MBEDTLS_X509_USE_C +#define MBEDTLS_X509_CRT_PARSE_C + +/* Set the memory allocation functions on FreeRTOS. */ +void * mbedtls_platform_calloc( size_t nmemb, + size_t size ); +void mbedtls_platform_free( void * ptr ); +#define MBEDTLS_PLATFORM_MEMORY +#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc +#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free + +/* The network send and receive functions on FreeRTOS. */ +int mbedtls_cellular_send( void * ctx, + const unsigned char * buf, + size_t len ); +int mbedtls_cellular_recv( void * ctx, + unsigned char * buf, + size_t len ); + +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_cellular_send +#define MBEDTLS_SSL_RECV mbedtls_cellular_recv + +/* The entropy poll function. */ +int mbedtls_platform_entropy_poll( void * data, + unsigned char * output, + size_t len, + size_t * olen ); + +#include "mbedtls/check_config.h" + +#endif /* ifndef MBEDTLS_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mqtt_mutual_auth_demo_with_hl7802.sln b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mqtt_mutual_auth_demo_with_hl7802.sln new file mode 100644 index 000000000..dcfc1fe09 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_HL7802/mqtt_mutual_auth_demo_with_hl7802.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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/DemoTasks/MutualAuthMQTTExample.c b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/DemoTasks/MutualAuthMQTTExample.c new file mode 100644 index 000000000..849eb874b --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/DemoTasks/MutualAuthMQTTExample.c @@ -0,0 +1,1074 @@ +/* + * FreeRTOS V202107.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 + * + */ + +/* + * Demo for showing use of the MQTT API using a mutually authenticated + * network connection. + * + * The Example shown below uses MQTT APIs to create MQTT messages and send them + * over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * A mutually authenticated TLS connection is used to connect to the + * MQTT message broker in this example. Define democonfigMQTT_BROKER_ENDPOINT, + * democonfigROOT_CA_PEM, democonfigCLIENT_CERTIFICATE_PEM, + * and democonfigCLIENT_PRIVATE_KEY_PEM in demo_config.h to establish a + * mutually authenticated connection. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. + */ + +/* Standard includes. */ +#include +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + +/* MQTT library includes. */ +#include "core_mqtt.h" + +/* Exponential backoff retry include. */ +#include "backoff_algorithm.h" + +/* Transport interface implementation include header for TLS. */ +#include "using_mbedtls.h" + +/*-----------------------------------------------------------*/ + +/* Compile time error for undefined configs. */ +#ifndef democonfigMQTT_BROKER_ENDPOINT + #error "Define the config democonfigMQTT_BROKER_ENDPOINT by following the instructions in file demo_config.h." +#endif +#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 */ + +/*-----------------------------------------------------------*/ + +/* Default values for configs. */ +#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. + * + * @note Appending __TIME__ to the client id string will help to create a unique + * client id every time an application binary is built. Only a single instance of + * this application's compiled binary may be used at a time, since the client ID + * will always be the same. + */ + #define democonfigCLIENT_IDENTIFIER "testClient"__TIME__ +#endif + +#ifndef democonfigMQTT_BROKER_PORT + +/** + * @brief The port to use for the demo. + */ + #define democonfigMQTT_BROKER_PORT ( 8883 ) +#endif + +/*-----------------------------------------------------------*/ + +/** + * @brief The maximum number of retries for network operation with server. + */ +#define mqttexampleRETRY_MAX_ATTEMPTS ( 5U ) + +/** + * @brief The maximum back-off delay (in milliseconds) for retrying failed operation + * with server. + */ +#define mqttexampleRETRY_MAX_BACKOFF_DELAY_MS ( 5000U ) + +/** + * @brief The base back-off delay (in milliseconds) to use for network operation retry + * attempts. + */ +#define mqttexampleRETRY_BACKOFF_BASE_MS ( 500U ) + +/** + * @brief Timeout for receiving CONNACK packet in milliseconds. + */ +#define mqttexampleCONNACK_RECV_TIMEOUT_MS ( 5000U ) + +/** + * @brief The topic to subscribe and publish to in the example. + * + * The topic name starts with the client identifier to ensure that each demo + * interacts with a unique topic name. + */ +#define mqttexampleTOPIC democonfigCLIENT_IDENTIFIER "/example/topic" + +/** + * @brief The number of topic filters to subscribe. + */ +#define mqttexampleTOPIC_COUNT ( 1 ) + +/** + * @brief The MQTT message published in this example. + */ +#define mqttexampleMESSAGE "Hello World!" + +/** + * @brief Time in ticks to wait between each cycle of the demo implemented + * by prvMQTTDemoTask(). + */ +#define mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ( pdMS_TO_TICKS( 5000U ) ) + +/** + * @brief Timeout for MQTT_ProcessLoop in milliseconds. + */ +#define mqttexamplePROCESS_LOOP_TIMEOUT_MS ( 5000U ) + +/** + * @brief Keep alive time reported to the broker while establishing + * an MQTT connection. + * + * 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 mqttexampleKEEP_ALIVE_TIMEOUT_SECONDS ( 60U ) + +/** + * @brief Delay (in ticks) between consecutive cycles of MQTT publish operations in a + * demo iteration. + * + * Note that the process loop also has a timeout, so the total time between + * publishes is the sum of the two delays. + */ +#define mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ( pdMS_TO_TICKS( 2000U ) ) + +/** + * @brief Transport timeout in milliseconds for transport send and receive. + */ +#define mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 10000U ) + +/** + * @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@"MQTT_LIBRARY_VERSION +#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 Milliseconds per second. + */ +#define MILLISECONDS_PER_SECOND ( 1000U ) + +/** + * @brief Milliseconds per FreeRTOS tick. + */ +#define MILLISECONDS_PER_TICK ( MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) + +/*-----------------------------------------------------------*/ + +/** + * @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 The task used to demonstrate the MQTT API. + * + * @param[in] pvParameters Parameters as passed at the time of task creation. Not + * used in this example. + */ +static void prvMQTTDemoTask( void * pvParameters ); + + +/** + * @brief Connect to MQTT broker with reconnection retries. + * + * If connection fails, retry is attempted after a timeout. + * Timeout value will exponentially increase until maximum + * timeout value is reached or the number of attempts are exhausted. + * + * @param[out] pxNetworkContext The parameter to return the created network context. + * + * @return The status of the final connection attempt. + */ +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pNetworkContext ); + +/** + * @brief Sends an MQTT Connect packet over the already connected TLS over TCP connection. + * + * @param[in, out] pxMQTTContext MQTT context pointer. + * @param[in] xNetworkContext Network context. + */ +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ); + +/** + * @brief Function to update variable #xTopicFilterContext with status + * information from Subscribe ACK. Called by the event callback after processing + * an incoming SUBACK packet. + * + * @param[in] Server response to the subscription request. + */ +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ); + +/** + * @brief Subscribes to the topic as specified in mqttexampleTOPIC at the top of + * this file. In the case of a Subscribe ACK failure, then subscription is + * retried using an exponential backoff strategy with jitter. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Publishes a message mqttexampleMESSAGE on mqttexampleTOPIC topic. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief Unsubscribes from the previously subscribed topic as specified + * in mqttexampleTOPIC. + * + * @param[in] pxMQTTContext MQTT context pointer. + */ +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ); + +/** + * @brief The timer query function provided to the MQTT context. + * + * @return Time in milliseconds. + */ +static uint32_t prvGetTimeMs( void ); + +/** + * @brief Process a response or ack to an MQTT request (PING, PUBLISH, + * SUBSCRIBE or UNSUBSCRIBE). This function processes PINGRESP, PUBACK, + * SUBACK, and UNSUBACK. + * + * @param[in] pxIncomingPacket is a pointer to structure containing deserialized + * MQTT response. + * @param[in] usPacketId is the packet identifier from the ack received. + */ +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ); + +/** + * @brief Process incoming Publish message. + * + * @param[in] pxPublishInfo is a pointer to structure containing deserialized + * Publish message. + */ +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ); + +/** + * @brief The application callback function for getting the incoming publishes, + * incoming acks, and ping responses reported from the MQTT library. + * + * @param[in] pxMQTTContext MQTT context pointer. + * @param[in] pxPacketInfo Packet Info pointer for the incoming packet. + * @param[in] pxDeserializedInfo Deserialized information from the incoming packet. + */ +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Static buffer used to hold MQTT messages being sent and received. + */ +static uint8_t ucSharedBuffer[ democonfigNETWORK_BUFFER_SIZE ]; + +/** + * @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 Packet Identifier generated when Publish request was sent to the broker; + * it is used to match received Publish ACK to the transmitted Publish packet. + */ +static uint16_t usPublishPacketIdentifier; + +/** + * @brief Packet Identifier generated when Subscribe request was sent to the broker; + * it is used to match received Subscribe ACK to the transmitted Subscribe packet. + */ +static uint16_t usSubscribePacketIdentifier; + +/** + * @brief Packet Identifier generated when Unsubscribe request was sent to the broker; + * it is used to match received Unsubscribe response to the transmitted Unsubscribe + * request. + */ +static uint16_t usUnsubscribePacketIdentifier; + +/** + * @brief A pair containing a topic filter and its SUBACK status. + */ +typedef struct topicFilterContext +{ + const char * pcTopicFilter; + MQTTSubAckStatus_t xSubAckStatus; +} topicFilterContext_t; + +/** + * @brief An array containing the context of a SUBACK; the SUBACK status + * of a filter is updated when the event callback processes a SUBACK. + */ +static topicFilterContext_t xTopicFilterContext[ mqttexampleTOPIC_COUNT ] = +{ + { mqttexampleTOPIC, MQTTSubAckFailure } +}; + + +/** @brief Static buffer used to hold MQTT messages being sent and received. */ +static MQTTFixedBuffer_t xBuffer = +{ + ucSharedBuffer, + democonfigNETWORK_BUFFER_SIZE +}; + +/*-----------------------------------------------------------*/ + +/* + * @brief Create the task that demonstrates the MQTT API Demo over a + * mutually authenticated network connection with MQTT broker. + */ +void vStartSimpleMQTTDemo( void ) +{ + /* This example uses a single application task, which in turn is used to + * connect, subscribe, publish, unsubscribe and disconnect from the MQTT + * broker. + * + * Also see https://www.freertos.org/mqtt/mqtt-agent-demo.html? for an + * alternative run time model whereby coreMQTT runs in an autonomous + * background agent task. Executing the MQTT protocol in an agent task + * removes the need for the application writer to explicitly manage any MQTT + * state or call the MQTT_ProcessLoop() API function. Using an agent task + * also enables multiple application tasks to more easily share a single + * MQTT connection. */ + prvMQTTDemoTask( NULL ); +} +/*-----------------------------------------------------------*/ + +/* + * @brief The Example shown below uses MQTT APIs to create MQTT messages and + * send them over the mutually authenticated network connection established with the + * MQTT broker. This example is single threaded and uses statically allocated + * memory. It uses QoS1 for sending to and receiving messages from the broker. + * + * This MQTT client subscribes to the topic as specified in mqttexampleTOPIC at the + * top of this file by sending a subscribe packet and then waiting for a subscribe + * acknowledgment (SUBACK).This client will then publish to the same topic it + * subscribed to, so it will expect all the messages it sends to the broker to be + * sent back to it from the broker. + */ +static void prvMQTTDemoTask( void * pvParameters ) +{ + uint32_t ulPublishCount = 0U, ulTopicCount = 0U; + const uint32_t ulMaxPublishCount = 5UL; + NetworkContext_t xNetworkContext = { 0 }; + TlsTransportParams_t xTlsTransportParams = { 0 }; + NetworkCredentials_t xNetworkCredentials = { 0 }; + MQTTContext_t xMQTTContext = { 0 }; + MQTTStatus_t xMQTTStatus; + TlsTransportStatus_t xNetworkStatus; + + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Set the entry time of the demo application. This entry time will be used + * to calculate relative time elapsed in the execution of the demo application, + * by the timer utility function that is provided to the MQTT library. + */ + ulGlobalEntryTimeMs = prvGetTimeMs(); + + /* Set the pParams member of the network context with desired transport. */ + xNetworkContext.pParams = &xTlsTransportParams; + + for( ; ; ) + { + /****************************** Connect. ******************************/ + + /* Attempt to establish TLS session with MQTT broker. If connection fails, + * retry after a timeout. Timeout value will be exponentially increased + * until the maximum number of attempts are reached or the maximum timeout + * value is reached. The function returns a failure status if the TCP + * connection cannot be established to the broker after the configured + * number of attempts. */ + xNetworkStatus = prvConnectToServerWithBackoffRetries( &xNetworkCredentials, + &xNetworkContext ); + configASSERT( xNetworkStatus == TLS_TRANSPORT_SUCCESS ); + + /* Sends an MQTT Connect packet over the already established TLS connection, + * and waits for connection acknowledgment (CONNACK) packet. */ + LogInfo( ( "Creating an MQTT connection to %s.\r\n", democonfigMQTT_BROKER_ENDPOINT ) ); + prvCreateMQTTConnectionWithBroker( &xMQTTContext, &xNetworkContext ); + + /**************************** Subscribe. ******************************/ + + /* If server rejected the subscription request, attempt to resubscribe to + * topic. Attempts are made according to the exponential backoff retry + * strategy implemented in BackoffAlgorithm. */ + prvMQTTSubscribeWithBackoffRetries( &xMQTTContext ); + + /****************** Publish and Keep Alive Loop. **********************/ + /* Publish messages with QoS1, send and process Keep alive messages. */ + for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ ) + { + LogInfo( ( "Publish to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTPublishToTopic( &xMQTTContext ); + + /* Process incoming publish echo, since application subscribed to the + * same topic, the broker will send publish message back to the + * application. */ + LogInfo( ( "Attempt to receive publish message from broker.\r\n" ) ); + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Leave Connection Idle for some time. */ + LogInfo( ( "Keeping Connection Idle...\r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS ); + } + + /******************** Unsubscribe from the topic. *********************/ + LogInfo( ( "Unsubscribe from the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + prvMQTTUnsubscribeFromTopic( &xMQTTContext ); + + /* Process incoming UNSUBACK packet from the broker. */ + xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /**************************** Disconnect. *****************************/ + + /* Send an MQTT Disconnect packet over the already connected TLS over + * TCP connection. There is no corresponding response for the disconnect + * packet. After sending disconnect, client must close the network + * connection. */ + LogInfo( ( "Disconnecting the MQTT connection with %s.\r\n", + democonfigMQTT_BROKER_ENDPOINT ) ); + xMQTTStatus = MQTT_Disconnect( &xMQTTContext ); + configASSERT( xMQTTStatus == MQTTSuccess ); + + /* Close the network connection. */ + TLS_FreeRTOS_Disconnect( &xNetworkContext ); + + /* Reset SUBACK status for each topic filter after completion of + * subscription request cycle. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = MQTTSubAckFailure; + } + + /* Wait for some time between two iterations to ensure that we do not + * bombard the broker. */ + LogInfo( ( "prvMQTTDemoTask() completed an iteration successfully. " + "Total free heap is %u.\r\n", + xPortGetFreeHeapSize() ) ); + LogInfo( ( "Demo completed successfully.\r\n" ) ); + LogInfo( ( "Short delay before starting the next iteration.... \r\n\r\n" ) ); + vTaskDelay( mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS ); + } +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredentials_t * pxNetworkCredentials, + NetworkContext_t * pxNetworkContext ) +{ + TlsTransportStatus_t xNetworkStatus; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xReconnectParams; + uint16_t usNextRetryBackOff = 0U; + + #ifdef democonfigUSE_AWS_IOT_CORE_BROKER + + /* 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 + pxNetworkCredentials->pAlpnProtos = pcAlpnProtocols; + #endif /* ifdef democonfigUSE_AWS_IOT_CORE_BROKER */ + + pxNetworkCredentials->disableSni = democonfigDISABLE_SNI; + /* Set the credentials for establishing a TLS connection. */ + pxNetworkCredentials->pRootCa = ( const unsigned char * ) democonfigROOT_CA_PEM; + pxNetworkCredentials->rootCaSize = sizeof( democonfigROOT_CA_PEM ); + #ifdef democonfigCLIENT_CERTIFICATE_PEM + pxNetworkCredentials->pClientCert = ( const unsigned char * ) democonfigCLIENT_CERTIFICATE_PEM; + pxNetworkCredentials->clientCertSize = sizeof( democonfigCLIENT_CERTIFICATE_PEM ); + pxNetworkCredentials->pPrivateKey = ( const unsigned char * ) democonfigCLIENT_PRIVATE_KEY_PEM; + pxNetworkCredentials->privateKeySize = sizeof( democonfigCLIENT_PRIVATE_KEY_PEM ); + #endif + + /* Initialize reconnect attempts and interval. */ + BackoffAlgorithm_InitializeParams( &xReconnectParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + /* Attempt to connect to MQTT broker. If connection fails, retry after + * a timeout. Timeout value will exponentially increase till maximum + * attempts are reached. + */ + do + { + /* Establish a TLS session 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:%u.\r\n", + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT ) ); + /* Attempt to create a mutually authenticated TLS connection. */ + xNetworkStatus = TLS_FreeRTOS_Connect( pxNetworkContext, + democonfigMQTT_BROKER_ENDPOINT, + democonfigMQTT_BROKER_PORT, + pxNetworkCredentials, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS, + mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ); + + if( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) + { + /* 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(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Connection to the broker failed, all attempts exhausted." ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Connection to the broker failed. " + "Retrying connection with backoff and jitter." ) ); + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + } + } while( ( xNetworkStatus != TLS_TRANSPORT_SUCCESS ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); + + return xNetworkStatus; +} +/*-----------------------------------------------------------*/ + +static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext, + NetworkContext_t * pxNetworkContext ) +{ + MQTTStatus_t xResult; + MQTTConnectInfo_t xConnectInfo; + bool xSessionPresent; + TransportInterface_t xTransport; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Fill in Transport Interface send and receive function pointers. */ + xTransport.pNetworkContext = pxNetworkContext; + xTransport.send = TLS_FreeRTOS_send; + xTransport.recv = TLS_FreeRTOS_recv; + + /* Initialize MQTT library. */ + xResult = MQTT_Init( pxMQTTContext, &xTransport, prvGetTimeMs, prvEventCallback, &xBuffer ); + configASSERT( xResult == MQTTSuccess ); + + /* Some fields are not used in this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xConnectInfo, 0x00, sizeof( xConnectInfo ) ); + + /* Start with a clean session i.e. direct the MQTT broker to discard any + * previous session data. Also, establishing a connection with clean session + * will ensure that the broker does not store any data when this client + * gets disconnected. */ + xConnectInfo.cleanSession = true; + + /* The client identifier is used to uniquely identify this MQTT client to + * the MQTT broker. In a production device the identifier can be something + * unique, such as a device serial number. */ + xConnectInfo.pClientIdentifier = democonfigCLIENT_IDENTIFIER; + xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( democonfigCLIENT_IDENTIFIER ); + + /* Set MQTT keep-alive period. If the application does not send packets at an interval less than + * the keep-alive period, the MQTT library will send PINGREQ packets. */ + xConnectInfo.keepAliveSeconds = mqttexampleKEEP_ALIVE_TIMEOUT_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. LWT is not used in this demo, so it + * is passed as NULL. */ + xResult = MQTT_Connect( pxMQTTContext, + &xConnectInfo, + NULL, + mqttexampleCONNACK_RECV_TIMEOUT_MS, + &xSessionPresent ); + configASSERT( xResult == MQTTSuccess ); + + /* Successfully established and MQTT connection with the broker. */ + LogInfo( ( "An MQTT connection is established with %s.", democonfigMQTT_BROKER_ENDPOINT ) ); +} +/*-----------------------------------------------------------*/ + +static void prvUpdateSubAckStatus( MQTTPacketInfo_t * pxPacketInfo ) +{ + MQTTStatus_t xResult = MQTTSuccess; + uint8_t * pucPayload = NULL; + size_t ulSize = 0; + uint32_t ulTopicCount = 0U; + + xResult = MQTT_GetSubAckStatusCodes( pxPacketInfo, &pucPayload, &ulSize ); + + /* MQTT_GetSubAckStatusCodes always returns success if called with packet info + * from the event callback and non-NULL parameters. */ + configASSERT( xResult == MQTTSuccess ); + + for( ulTopicCount = 0; ulTopicCount < ulSize; ulTopicCount++ ) + { + xTopicFilterContext[ ulTopicCount ].xSubAckStatus = pucPayload[ ulTopicCount ]; + } +} +/*-----------------------------------------------------------*/ + +static void prvMQTTSubscribeWithBackoffRetries( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult = MQTTSuccess; + BackoffAlgorithmStatus_t xBackoffAlgStatus = BackoffAlgorithmSuccess; + BackoffAlgorithmContext_t xRetryParams; + uint16_t usNextRetryBackOff = 0U; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + bool xFailedSubscribeToTopic = false; + uint32_t ulTopicCount = 0U; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Initialize context for backoff retry attempts if SUBSCRIBE request fails. */ + BackoffAlgorithm_InitializeParams( &xRetryParams, + mqttexampleRETRY_BACKOFF_BASE_MS, + mqttexampleRETRY_MAX_BACKOFF_DELAY_MS, + mqttexampleRETRY_MAX_ATTEMPTS ); + + do + { + /* The client is now connected to the broker. Subscribe to the topic + * as specified in mqttexampleTOPIC at the top of this file by sending a + * subscribe packet then waiting for a subscribe acknowledgment (SUBACK). + * This client will then publish to the same topic it subscribed to, so it + * will expect all the messages it sends to the broker to be sent back to it + * from the broker. This demo uses QOS0 in Subscribe, therefore, the Publish + * messages received from the broker will have QOS0. */ + LogInfo( ( "Attempt to subscribe to the MQTT topic %s.\r\n", mqttexampleTOPIC ) ); + xResult = MQTT_Subscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usSubscribePacketIdentifier ); + configASSERT( xResult == MQTTSuccess ); + + LogInfo( ( "SUBSCRIBE sent for topic %s to broker.\n\n", mqttexampleTOPIC ) ); + + /* Process incoming packet from the broker. After sending the subscribe, the + * client may receive a publish before it receives a subscribe ack. Therefore, + * call generic incoming packet processing function. Since this demo is + * subscribing to the topic to which no one is publishing, probability of + * receiving Publish message before subscribe ack is zero; but application + * must be ready to receive any packet. This demo uses the generic packet + * processing function everywhere to highlight this fact. */ + xResult = MQTT_ProcessLoop( pxMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS ); + configASSERT( xResult == MQTTSuccess ); + + /* Reset flag before checking suback responses. */ + xFailedSubscribeToTopic = false; + + /* Check if recent subscription request has been rejected. #xTopicFilterContext is updated + * in the event callback to reflect the status of the SUBACK sent by the broker. It represents + * either the QoS level granted by the server upon subscription, or acknowledgement of + * server rejection of the subscription request. */ + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus == MQTTSubAckFailure ) + { + xFailedSubscribeToTopic = true; + + /* 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( &xRetryParams, uxRand(), &usNextRetryBackOff ); + + if( xBackoffAlgStatus == BackoffAlgorithmRetriesExhausted ) + { + LogError( ( "Server rejected subscription request. All retry attempts have exhausted. Topic=%s", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + } + else if( xBackoffAlgStatus == BackoffAlgorithmSuccess ) + { + LogWarn( ( "Server rejected subscription request. Attempting to re-subscribe to topic %s.", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter ) ); + /* Backoff before the next re-subscribe attempt. */ + vTaskDelay( pdMS_TO_TICKS( usNextRetryBackOff ) ); + } + + break; + } + } + + configASSERT( xBackoffAlgStatus != BackoffAlgorithmRetriesExhausted ); + } while( ( xFailedSubscribeToTopic == true ) && ( xBackoffAlgStatus == BackoffAlgorithmSuccess ) ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTPublishToTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTPublishInfo_t xMQTTPublishInfo; + + /*** + * For readability, error handling in this function is restricted to the use of + * asserts(). + ***/ + + /* Some fields are not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTPublishInfo, 0x00, sizeof( xMQTTPublishInfo ) ); + + /* This demo uses QoS1. */ + xMQTTPublishInfo.qos = MQTTQoS1; + xMQTTPublishInfo.retain = false; + xMQTTPublishInfo.pTopicName = mqttexampleTOPIC; + xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + xMQTTPublishInfo.pPayload = mqttexampleMESSAGE; + xMQTTPublishInfo.payloadLength = strlen( mqttexampleMESSAGE ); + + /* Get a unique packet id. */ + usPublishPacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send PUBLISH packet. Packet ID is not used for a QoS1 publish. */ + xResult = MQTT_Publish( pxMQTTContext, &xMQTTPublishInfo, usPublishPacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext ) +{ + MQTTStatus_t xResult; + MQTTSubscribeInfo_t xMQTTSubscription[ mqttexampleTOPIC_COUNT ]; + + /* Some fields not used by this demo so start with everything at 0. */ + ( void ) memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) ); + + /* Get a unique packet id. */ + usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Subscribe to the mqttexampleTOPIC topic filter. This example subscribes to + * only one topic and uses QoS1. */ + xMQTTSubscription[ 0 ].qos = MQTTQoS1; + xMQTTSubscription[ 0 ].pTopicFilter = mqttexampleTOPIC; + xMQTTSubscription[ 0 ].topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC ); + + /* Get next unique packet identifier. */ + usUnsubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext ); + + /* Send UNSUBSCRIBE packet. */ + xResult = MQTT_Unsubscribe( pxMQTTContext, + xMQTTSubscription, + sizeof( xMQTTSubscription ) / sizeof( MQTTSubscribeInfo_t ), + usUnsubscribePacketIdentifier ); + + configASSERT( xResult == MQTTSuccess ); +} +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket, + uint16_t usPacketId ) +{ + uint32_t ulTopicCount = 0U; + + switch( pxIncomingPacket->type ) + { + case MQTT_PACKET_TYPE_PUBACK: + LogInfo( ( "PUBACK received for packet Id %u.\r\n", usPacketId ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usPublishPacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_SUBACK: + + /* A SUBACK from the broker, containing the server response to our subscription request, has been received. + * It contains the status code indicating server approval/rejection for the subscription to the single topic + * requested. The SUBACK will be parsed to obtain the status code, and this status code will be stored in global + * variable #xTopicFilterContext. */ + prvUpdateSubAckStatus( pxIncomingPacket ); + + for( ulTopicCount = 0; ulTopicCount < mqttexampleTOPIC_COUNT; ulTopicCount++ ) + { + if( xTopicFilterContext[ ulTopicCount ].xSubAckStatus != MQTTSubAckFailure ) + { + LogInfo( ( "Subscribed to the topic %s with maximum QoS %u.\r\n", + xTopicFilterContext[ ulTopicCount ].pcTopicFilter, + xTopicFilterContext[ ulTopicCount ].xSubAckStatus ) ); + } + } + + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usSubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_UNSUBACK: + LogInfo( ( "Unsubscribed from the topic %s.\r\n", mqttexampleTOPIC ) ); + /* Make sure ACK packet identifier matches with Request packet identifier. */ + configASSERT( usUnsubscribePacketIdentifier == usPacketId ); + break; + + case MQTT_PACKET_TYPE_PINGRESP: + + /* Nothing to be done from application as library handles + * PINGRESP with the use of MQTT_ProcessLoop API function. */ + LogWarn( ( "PINGRESP should not be handled by the application " + "callback when using MQTT_ProcessLoop.\n" ) ); + break; + + /* Any other packet type is invalid. */ + default: + LogWarn( ( "prvMQTTProcessResponse() called with unknown packet type:(%02X).\r\n", + pxIncomingPacket->type ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo ) +{ + configASSERT( pxPublishInfo != NULL ); + + /* Process incoming Publish. */ + LogInfo( ( "Incoming QoS : %d\n", pxPublishInfo->qos ) ); + + /* Verify the received publish is for the we have subscribed to. */ + if( ( pxPublishInfo->topicNameLength == strlen( mqttexampleTOPIC ) ) && + ( 0 == strncmp( mqttexampleTOPIC, pxPublishInfo->pTopicName, pxPublishInfo->topicNameLength ) ) ) + { + LogInfo( ( "\r\nIncoming Publish Topic Name: %.*s matches subscribed topic.\r\n" + "Incoming Publish Message : %.*s\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName, + pxPublishInfo->payloadLength, + pxPublishInfo->pPayload ) ); + } + else + { + LogInfo( ( "Incoming Publish Topic Name: %.*s does not match subscribed topic.\r\n", + pxPublishInfo->topicNameLength, + pxPublishInfo->pTopicName ) ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvEventCallback( MQTTContext_t * pxMQTTContext, + MQTTPacketInfo_t * pxPacketInfo, + MQTTDeserializedInfo_t * pxDeserializedInfo ) +{ + /* The MQTT context is not used for this demo. */ + ( void ) pxMQTTContext; + + if( ( pxPacketInfo->type & 0xF0U ) == MQTT_PACKET_TYPE_PUBLISH ) + { + prvMQTTProcessIncomingPublish( pxDeserializedInfo->pPublishInfo ); + } + else + { + prvMQTTProcessResponse( pxPacketInfo, pxDeserializedInfo->packetIdentifier ); + } +} + +/*-----------------------------------------------------------*/ + +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 * MILLISECONDS_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; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSConfig.h new file mode 100644 index 000000000..80e04e185 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSConfig.h @@ -0,0 +1,210 @@ +/* + * FreeRTOS V202107.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 ( 1L ) + +/* 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 0x6a + +/* 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSIPConfig.h new file mode 100644 index 000000000..54927d2e4 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/FreeRTOSIPConfig.h @@ -0,0 +1,310 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 1 +#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) + #define FreeRTOS_debug_printf( X ) vLoggingPrintf X +#endif + +/* Set to 1 to print out non debugging messages, for example the output of the + * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 + * then FreeRTOS_printf should be set to the function used to print out the + * messages. */ +#define ipconfigHAS_PRINTF 1 +#if ( ipconfigHAS_PRINTF == 1 ) + #define FreeRTOS_printf( X ) vLoggingPrintf X +#endif + +/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing + * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN + +/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) + * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software + * stack repeating the checksum calculations. */ +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 + +/* Several API's will block until the result is known, or the action has been + * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be + * set per socket, using setsockopt(). If not set, the times below will be + * used as defaults. */ +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 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 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/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj new file mode 100644 index 000000000..e12239956 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj @@ -0,0 +1,644 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + .;..\common;..\..\common\WinPCap;..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\Source\mbedtls_utils;..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\Source\Application-Protocols\network_transport\cellular;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\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;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\ThirdParty\mbedtls\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\common;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\private;..\..\..\Source\FreeRTOS-Cellular-Interface\source\interface;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\cellular;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj.filters new file mode 100644 index 000000000..19ddc17f1 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/WIN32.vcxproj.filters @@ -0,0 +1,895 @@ + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {84164849-198e-497b-b135-322242d511cf} + + + {b61fd40e-ae93-4a08-9ee7-5dc8182595be} + + + {0c062983-2e9b-43c4-abd7-daf4e6254d96} + + + {141c3342-468b-4833-a23a-70ac37be207b} + + + {9d52e9bc-39e7-4d8e-a150-64eeeae9410b} + + + {26ee1535-b417-427d-8e72-79c6c859db6b} + + + {5465caea-3879-404b-a54e-753ece92941c} + + + {2559b11d-a741-471f-ad56-e7263dc15046} + + + {553e6fa4-ea81-46c6-bc4e-b694d9fa766e} + + + {a53e6044-6b9b-4e35-aaed-43e6f9dfbdb2} + + + {6c3bcc0b-b831-4567-9ca9-525a5a75427c} + + + {bfecf3e3-7116-4b34-9f78-dc11bc1fbbf3} + + + {aa0ef4b9-5c3e-4a1a-82b1-7938b1a596a7} + + + {d7c1e40c-3e7e-4e0e-b027-697eb7dd60bd} + + + {ded2b563-424b-401d-b14d-d790c2a29f66} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + Common + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + Common + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + + Module + + + Module + + + Module + + + Module + + + + + + + + Common\mbedtls + + + Common\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + Config + + + Config + + + Config + + + Config + + + + Config + + + Common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\interface + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + + Module + + + + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/cellular_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/cellular_config.h new file mode 100644 index 000000000..93de31562 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/cellular_config.h @@ -0,0 +1,113 @@ +/* + * FreeRTOS V202107.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 cellular_config.h + * @brief cellular config options. + */ + +#ifndef __CELLULAR_CONFIG_H__ +#define __CELLULAR_CONFIG_H__ + +/* This is a project specific file and is used to override config values defined + * in cellular_config_defaults.h. */ + +/** + * Cellular comm interface make use of COM port on computer to communicate with + * cellular module on windows simulator, for example "COM5". + * #define CELLULAR_COMM_INTERFACE_PORT "...insert here..." + */ + +/* + * Default APN for network registration. + * #define CELLULAR_APN "...insert here..." + */ + +/* + * PDN context id for cellular network. + */ +#define CELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID_MIN ) + +/* + * PDN connect timeout for network registration. + */ +#define CELLULAR_PDN_CONNECT_TIMEOUT ( 100000UL ) + +/* + * Overwrite default config for different cellular modules. + */ + +/* + * GetHostByName API is not used in the demo. IP address is used to store the hostname. + * The value should be longer than the length of democonfigMQTT_BROKER_ENDPOINT in demo_config.h. + */ +#define CELLULAR_IP_ADDRESS_MAX_SIZE ( 64U ) + +/* + * Sara R4 maximum socket send buffer size is 1024U. + */ +#define CELLULAR_MAX_SEND_DATA_LEN ( 1024U ) + +/* + * Sara R4 maximum socket receive buffer size is 1024U. + */ +#define CELLULAR_MAX_RECV_DATA_LEN ( 1024U ) + +/* + * Sara R4 supports set mobile network operators commands. + * Set the mobile network operators of your environment. + * Reference https://www.u-blox.com/sites/default/files/SARA-R4_ATCommands_%28UBX-17003787%29.pdf + * 0: undefined / regulatory + * 1: SIM ICCID/IMSI select + * 2: AT&T + * 3: Verizon + * 4: Telstra + * 5: T-Mobile US + * 6: China Telecom + * 8: Sprint + * 19: Vodafone + * 20: NTT DoCoMo + * 21: Telus + * 28: SoftBank + * 31: Deutsche Telekom + * 32: US Cellular + * 33: VIVO + * 39: SKT + * 44: Claro Brasil + * 45: TIM Brasil + * 46: Orange France + * 90: global + * 100: standard Europe + * Notes : + * The standard Europe profile should be used as the basis for all other MNOs in + * Europe outside of Vodafone and Deutsche Telekom. However, there may be changes + * that need to be applied to the module for properoperation with any given European + * MNO such as attach type, RAT preference, band selection, etc. Pleaseconsult with + * the preferred network provider. + * #define CELLULAR_CONFIG_SARA_R4_SET_MNO_PROFILE ( ...insert here... ) + */ + +#endif /* __CELLULAR_CONFIG_H__ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/core_mqtt_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/core_mqtt_config.h new file mode 100644 index 000000000..72c611851 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/core_mqtt_config.h @@ -0,0 +1,80 @@ +/* + * FreeRTOS V202107.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 + +#endif /* ifndef CORE_MQTT_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/demo_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/demo_config.h new file mode 100644 index 000000000..1af28b94b --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/demo_config.h @@ -0,0 +1,273 @@ +/* + * FreeRTOS V202107.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 + +/* FreeRTOS config include. */ +#include "FreeRTOSConfig.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 "CellularSaraR4" +#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 The MQTT client identifier used in this example. Each client identifier + * must be unique; so edit as required to ensure that 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, that supports mutual + * authentication. + * + * 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). + * + * @note If you would like to setup an MQTT broker for running this demo, + * please see `mqtt_broker_setup.txt`. + * + * #define democonfigMQTT_BROKER_ENDPOINT "...insert here..." + */ + +/** + * @brief The port to use for the demo. + * + * In general, port 8883 is for secured MQTT connections. + * + * @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. ) + */ + +/** + * @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. + * + * 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 ) + */ + +/** + * @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. + */ +#include "core_mqtt.h" /* Include coreMQTT header for MQTT_LIBRARY_VERSION macro. */ +#define democonfigMQTT_LIB "core-mqtt@"MQTT_LIBRARY_VERSION + +/** + * @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 + +/** + * @brief Set the priority of the main demo task. + */ +#define democonfigDEMO_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/** + * @brief Size of the network buffer for MQTT packets. + */ +#define democonfigNETWORK_BUFFER_SIZE ( 1024U ) + +/** + * @brief Size of the range request from 1nce onboarding service. + */ +#define democonfigRANGE_SIZE ( 1000U ) + +#endif /* DEMO_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mbedtls_config.h b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mbedtls_config.h new file mode 100644 index 000000000..94f704a77 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mbedtls_config.h @@ -0,0 +1,137 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/* This file configures mbed TLS for FreeRTOS. */ + +#ifndef MBEDTLS_CONFIG_H_ +#define MBEDTLS_CONFIG_H_ + +/* FreeRTOS include. */ +#include "FreeRTOS.h" + +/* Generate errors if deprecated functions are used. */ +#define MBEDTLS_DEPRECATED_REMOVED + +/* Place AES tables in ROM. */ +#define MBEDTLS_AES_ROM_TABLES + +/* Enable the following cipher modes. */ +#define MBEDTLS_CIPHER_MODE_CBC +#define MBEDTLS_CIPHER_MODE_CFB +#define MBEDTLS_CIPHER_MODE_CTR + +/* Enable the following cipher padding modes. */ +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS +#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN +#define MBEDTLS_CIPHER_PADDING_ZEROS + +/* Cipher suite configuration. */ +#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_NIST_OPTIM +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + +/* Enable all SSL alert messages. */ +#define MBEDTLS_SSL_ALL_ALERT_MESSAGES + +/* Enable the following SSL features. */ +#define MBEDTLS_SSL_ENCRYPT_THEN_MAC +#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET +#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH +#define MBEDTLS_SSL_PROTO_TLS1_2 +#define MBEDTLS_SSL_ALPN +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +/* Check certificate key usage. */ +#define MBEDTLS_X509_CHECK_KEY_USAGE +#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + +/* Disable platform entropy functions. */ +#define MBEDTLS_NO_PLATFORM_ENTROPY + +/* Enable the following mbed TLS features. */ +#define MBEDTLS_AES_C +#define MBEDTLS_ASN1_PARSE_C +#define MBEDTLS_ASN1_WRITE_C +#define MBEDTLS_BASE64_C +#define MBEDTLS_BIGNUM_C +#define MBEDTLS_CIPHER_C +#define MBEDTLS_CTR_DRBG_C +#define MBEDTLS_ECDH_C +#define MBEDTLS_ECDSA_C +#define MBEDTLS_ECP_C +#define MBEDTLS_ENTROPY_C +#define MBEDTLS_ERROR_C +#define MBEDTLS_GCM_C +#define MBEDTLS_MD_C +#define MBEDTLS_OID_C +#define MBEDTLS_PEM_PARSE_C +#define MBEDTLS_PK_C +#define MBEDTLS_PK_PARSE_C +#define MBEDTLS_PKCS1_V15 +#define MBEDTLS_PLATFORM_C +#define MBEDTLS_RSA_C +#define MBEDTLS_SHA1_C +#define MBEDTLS_SHA256_C +#define MBEDTLS_SSL_CLI_C +#define MBEDTLS_SSL_TLS_C +#define MBEDTLS_THREADING_ALT +#define MBEDTLS_THREADING_C +#define MBEDTLS_X509_USE_C +#define MBEDTLS_X509_CRT_PARSE_C + +/* Set the memory allocation functions on FreeRTOS. */ +void * mbedtls_platform_calloc( size_t nmemb, + size_t size ); +void mbedtls_platform_free( void * ptr ); +#define MBEDTLS_PLATFORM_MEMORY +#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc +#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free + +/* The network send and receive functions on FreeRTOS. */ +int mbedtls_cellular_send( void * ctx, + const unsigned char * buf, + size_t len ); +int mbedtls_cellular_recv( void * ctx, + unsigned char * buf, + size_t len ); + +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_cellular_send +#define MBEDTLS_SSL_RECV mbedtls_cellular_recv + +/* The entropy poll function. */ +int mbedtls_platform_entropy_poll( void * data, + unsigned char * output, + size_t len, + size_t * olen ); + +#include "mbedtls/check_config.h" + +#endif /* ifndef MBEDTLS_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mqtt_mutual_auth_demo_with_sara_r4.sln b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mqtt_mutual_auth_demo_with_sara_r4.sln new file mode 100644 index 000000000..dcfc1fe09 --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_SARA_R4/mqtt_mutual_auth_demo_with_sara_r4.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/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj index f169b2c95..9374feca4 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\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;..\Common;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\Common;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj.filters index 63a970e89..a32651343 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/WIN32.vcxproj.filters @@ -1,766 +1,775 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {ab61f382-9091-4386-ac03-2209168b024d} - - - {721b2928-3ac7-4df6-88c3-cd94f74f3c54} - - - {eab3f2f5-b5cd-42a0-aef3-99344a439aa9} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - FreeRTOS+ - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {ab61f382-9091-4386-ac03-2209168b024d} + + + {721b2928-3ac7-4df6-88c3-cd94f74f3c54} + + + {eab3f2f5-b5cd-42a0-aef3-99344a439aa9} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + FreeRTOS+ + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj index 2fcffba0a..b8c8bc5de 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_plaintext;..\Common;.;%(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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_plaintext;..\Common;.;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -157,9 +157,9 @@ + + - - @@ -198,9 +198,9 @@ - - + + diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj.filters index 1f9bdf27c..d7e70f318 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Plaintext/WIN32.vcxproj.filters @@ -132,12 +132,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP @@ -145,6 +139,12 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + @@ -219,12 +219,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\FreeRTOS+TCP\include @@ -264,5 +258,11 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj index f90531ee0..ec64c8860 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\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;..\Common;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\Common;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj.filters index c6af5b417..722971d86 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/WIN32.vcxproj.filters @@ -1,766 +1,775 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {e28148c9-3da7-4e2b-9753-995186714875} - - - {58e350db-d172-4809-92fe-fcad9dd3d2cf} - - - {64d18fee-0d61-476f-b5e2-9a778d994c6f} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {e28148c9-3da7-4e2b-9753-995186714875} + + + {58e350db-d172-4809-92fe-fcad9dd3d2cf} + + + {64d18fee-0d61-476f-b5e2-9a778d994c6f} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj index eaf14d9b4..728fa16c3 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\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;..\Common;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\Common;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj.filters index da985414a..82758a50d 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/WIN32.vcxproj.filters @@ -1,766 +1,775 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {a2633f53-a9c3-4af7-96c1-367244e12389} - - - {1e2b4517-b5f2-4100-bf26-59ceed614091} - - - {0cc41e6f-4dc0-4f66-818b-901d98b0c217} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {a2633f53-a9c3-4af7-96c1-367244e12389} + + + {1e2b4517-b5f2-4100-bf26-59ceed614091} + + + {0cc41e6f-4dc0-4f66-818b-901d98b0c217} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Download_Multithreaded/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj index dfad96d78..887b6f338 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\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;..\Common;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\Application-Protocols\coreHTTP\source\include;..\..\..\Source\Application-Protocols\coreHTTP\source\interface;..\..\..\Source\Application-Protocols\coreHTTP\source\dependency\3rdparty\http_parser;..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\Common;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj.filters index facff3d76..ee6241880 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/WIN32.vcxproj.filters @@ -1,766 +1,775 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {dca3bd8b-9155-48ff-9e9d-9809c8933f7b} - - - {1aa8b26b-b755-4f40-8255-6ccf3dad760f} - - - {cc6e666d-32a3-4049-b36c-3ebbe5d1ff62} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {dca3bd8b-9155-48ff-9e9d-9809c8933f7b} + + + {1aa8b26b-b755-4f40-8255-6ccf3dad760f} + + + {cc6e666d-32a3-4049-b36c-3ebbe5d1ff62} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreHTTP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_S3_Upload/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj index 3c2338e9f..41d65b9f3 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj.filters index 809d204f5..640cdb7df 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/WIN32.vcxproj.filters @@ -1,768 +1,777 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {c7507ea2-84da-4be0-b1c9-06eb50b4cc29} - - - {6d582f2e-72c0-4435-b99c-e7c9a10c0a14} - - - {ff466008-8120-42da-8aa6-b4a9270f5cf5} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - Config - - - Config - - - Config - - - Config - - - Config - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {c7507ea2-84da-4be0-b1c9-06eb50b4cc29} + + + {6d582f2e-72c0-4435-b99c-e7c9a10c0a14} + + + {ff466008-8120-42da-8aa6-b4a9270f5cf5} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + Config + + + Config + + + Config + + + Config + + + Config + + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj index 88d510216..cecae7700 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\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_plaintext;.;%(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\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_plaintext;.;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -157,8 +157,8 @@ - - + + @@ -195,9 +195,9 @@ - - + + diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj.filters index 2472258e5..a3cb8e3a3 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/WIN32.vcxproj.filters @@ -129,12 +129,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT @@ -144,6 +138,12 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + @@ -233,12 +233,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging @@ -263,5 +257,11 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj index 08f5b0904..7bfcb4e9e 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj @@ -1,628 +1,629 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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_plaintext;..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include;..\..\Common\coreMQTT_Agent_Interface\include/;subscription-manager;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_plaintext;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;..\..\..\Source\Application-Protocols\coreMQTT-Agent\source\include;..\..\Common\coreMQTT_Agent_Interface\include/;subscription-manager;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj.filters index e4ecd7a2d..512e0334f 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/WIN32.vcxproj.filters @@ -1,825 +1,832 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {3d9a75ff-8a0f-40cc-947b-8135af72068e} - - - {a1f3f8f4-7ab7-44ef-891e-a6f9f9cc6379} - - - {0e25b4a0-53aa-4abd-a4bc-b3658c9c3bc9} - - - {a081aee5-1e00-443e-98b5-ca297fc5b4ac} - - - {01a3e0d6-b836-4f1d-8d9d-e83c247a50c7} - - - {7113221b-1ca6-4504-9993-75664336ef8a} - - - {d6d1e5f0-f23c-47d1-ba70-3dbc26acf362} - - - {775bbd2e-ac31-4bb4-9de2-468c05269332} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface - - - subscription-manager - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - Config - - - Config - - - Config - - - Config - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include - - - subscription-manager - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {3d9a75ff-8a0f-40cc-947b-8135af72068e} + + + {a1f3f8f4-7ab7-44ef-891e-a6f9f9cc6379} + + + {0e25b4a0-53aa-4abd-a4bc-b3658c9c3bc9} + + + {a081aee5-1e00-443e-98b5-ca297fc5b4ac} + + + {01a3e0d6-b836-4f1d-8d9d-e83c247a50c7} + + + {7113221b-1ca6-4504-9993-75664336ef8a} + + + {d6d1e5f0-f23c-47d1-ba70-3dbc26acf362} + + + {775bbd2e-ac31-4bb4-9de2-468c05269332} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface + + + subscription-manager + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + Config + + + Config + + + Config + + + Config + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT-Agent\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mqtt-agent-interface\include + + + subscription-manager + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj index 8fde12f53..919d9b20b 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj @@ -1,614 +1,615 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C686325E-3261-42F7-AEB1-DDE5280E1CEB} - RTOSDemo - 10.0 - - - - Application - false - MultiByte - v142 - - - Application - false - MultiByte - v142 - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - AllRules.ruleset - - - - .\Debug/WIN32.tlb - - - - - Disabled - ..\..\..\..\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;.;%(AdditionalIncludeDirectories) - MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDLL - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - false - EditAndContinue - /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) - true - NotUsing - false - CompileAsC - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Debug/RTOSDemo.exe - true - true - .\Debug/WIN32.pdb - Console - MachineX86 - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - ..\Common\WinPCap - false - false - - - true - .\Debug/WIN32.bsc - - - - - .\Release/WIN32.tlb - - - - - MaxSpeed - OnlyExplicitInline - _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - MultiThreaded - true - .\Release/WIN32.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - ..\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) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c09 - - - .\Release/RTOSDemo.exe - true - .\Release/WIN32.pdb - Console - MachineX86 - ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap - wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) - - - true - .\Release/WIN32.bsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - TurnOffAllWarnings - TurnOffAllWarnings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + RTOSDemo + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + + .\Debug/WIN32.tlb + + + + + Disabled + ..\..\..\..\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\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls;..\..\..\Source\Utilities\mbedtls_freertos;..\..\..\..\Source\mbedtls_utils;..\..\..\ThirdParty\mbedtls\include;.;%(AdditionalIncludeDirectories) + MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/RTOSDemo.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + ..\Common\WinPCap + false + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;Bcrypt.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj.filters index 8a01e909d..5dafaf508 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/WIN32.vcxproj.filters @@ -1,768 +1,775 @@ - - - - - {af3445a1-4908-4170-89ed-39345d90d30c} - - - {f32be356-4763-4cae-9020-974a2638cb08} - *.c - - - {88f409e6-d396-4ac5-94bd-7a99c914be46} - - - {e5ad4ec7-23dc-4295-8add-2acaee488f5a} - - - {d2dcd641-8d91-492b-852f-5563ffadaec6} - - - {8672fa26-b119-481f-8b8d-086419c01a3e} - - - {4570be11-ec96-4b55-ac58-24b50ada980a} - - - {5d93ed51-023a-41ad-9243-8d230165d34b} - - - {b71e974a-9f28-4815-972b-d930ba8a34d0} - - - {60717407-397f-4ea5-8492-3314acdd25f0} - - - {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} - - - {2d17d5e6-ed70-4e42-9693-f7a63baf4948} - - - {6ad56e6d-c330-4830-8f4b-c75b05dfa866} - - - {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} - - - {7bedd2e3-adbb-4c95-9632-445132b459ce} - - - {07a14673-4d02-4780-a099-6b8c654dff91} - - - {e875c5e3-40a2-4408-941e-5e1a951cc663} - - - {8a0aa896-6b3a-49b3-997e-681f0d1949ae} - - - {c5a01679-3e7a-4320-97ac-ee5b872c1650} - - - {c992824d-4198-46b2-8d59-5f99ab9946ab} - - - {6a35782c-bc09-42d5-a850-98bcb668a4dc} - - - {fcf93295-15e2-4a84-a5e9-b3c162e9f061} - - - {84164849-198e-497b-b135-322242d511cf} - - - {b61fd40e-ae93-4a08-9ee7-5dc8182595be} - - - {0c062983-2e9b-43c4-abd7-daf4e6254d96} - - - - - FreeRTOS\Source\Portable - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS\Source - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP\portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS\Source\Portable - - - FreeRTOS+\FreeRTOS+TCP - - - FreeRTOS\Source - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - FreeRTOS+\mbedtls\library - - - - - DemoTasks - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT - - - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS\Source\include - - - FreeRTOS\Source\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\mbedtls\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS+TCP\include - - - FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging - - - Config - - - Config - - - Config - - - Config - - - Config - - - + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {b71e974a-9f28-4815-972b-d930ba8a34d0} + + + {60717407-397f-4ea5-8492-3314acdd25f0} + + + {8a90222f-d723-4b4e-8e6e-c57afaf7fa92} + + + {2d17d5e6-ed70-4e42-9693-f7a63baf4948} + + + {6ad56e6d-c330-4830-8f4b-c75b05dfa866} + + + {84613aa2-91dc-4e1a-a3b3-823b6d7bf0e0} + + + {7bedd2e3-adbb-4c95-9632-445132b459ce} + + + {07a14673-4d02-4780-a099-6b8c654dff91} + + + {e875c5e3-40a2-4408-941e-5e1a951cc663} + + + {8a0aa896-6b3a-49b3-997e-681f0d1949ae} + + + {c5a01679-3e7a-4320-97ac-ee5b872c1650} + + + {c992824d-4198-46b2-8d59-5f99ab9946ab} + + + {6a35782c-bc09-42d5-a850-98bcb668a4dc} + + + {fcf93295-15e2-4a84-a5e9-b3c162e9f061} + + + {84164849-198e-497b-b135-322242d511cf} + + + {b61fd40e-ae93-4a08-9ee7-5dc8182595be} + + + {0c062983-2e9b-43c4-abd7-daf4e6254d96} + + + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS\Source + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP\portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS\Source\Portable + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS\Source + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + FreeRTOS+\mbedtls\library + + + + + DemoTasks + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\mbedtls\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Config + + + Config + + + Config + + + Config + + + Config + + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/mbedtls_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/mbedtls_config.h index 1745d60dd..f5c31dd70 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/mbedtls_config.h @@ -121,6 +121,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj index 58f7e7cba..085950fea 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\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;..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\FreeRTOS-Plus\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\freertos_plus_tcp\using_wolfSSL;..\..\..\Source\Utilities\wolfSSL_freertos;..\..\..\ThirdParty\wolfSSL;.;%(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;..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\FreeRTOS-Plus\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\FreeRTOS-Plus\Source\Utilities\backoff_algorithm\source\include;..\..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_wolfSSL;..\..\..\Source\Utilities\wolfSSL_freertos;..\..\..\ThirdParty\wolfSSL;.;%(AdditionalIncludeDirectories) WOLFSSL_USER_SETTINGS;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -161,8 +161,8 @@ - - + + @@ -361,8 +361,8 @@ - - + + diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj.filters index a83cf0fa5..48694279c 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL/WIN32.vcxproj.filters @@ -396,16 +396,16 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\src - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\src - FreeRTOS\Source FreeRTOS+\FreeRTOS IoT Libraries\platform\freertos - + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\src + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\src @@ -498,9 +498,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT\include - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\FreeRTOS IoT Libraries\platform @@ -756,7 +753,10 @@ - + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj index ae7c14c60..be6ad083d 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\..\..\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_plaintext;.;%(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\sockets_wrapper\freertos_plus_tcp;..\..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_plaintext;.;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -157,8 +157,8 @@ - - + + @@ -195,8 +195,8 @@ - - + + diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj.filters index 15c319479..8894db35b 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/WIN32.vcxproj.filters @@ -138,10 +138,10 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport @@ -236,12 +236,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\FreeRTOS IoT Libraries\platform\logging @@ -263,5 +257,11 @@ Config + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + \ No newline at end of file diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj index 8b64ede31..fd238cbc8 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj @@ -58,7 +58,7 @@ Disabled - ..\..\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;..\coreMQTT_Windows_Simulator\Common;..\coreMQTT_Windows_Simulator\common\WinPCap;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;..\..\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_pkcs11;..\..\Source\Utilities\mbedtls_freertos;..\..\Source\mbedtls_utils;..\..\ThirdParty\mbedtls\include;.;%(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;..\coreMQTT_Windows_Simulator\Common;..\coreMQTT_Windows_Simulator\common\WinPCap;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\Source\Utilities\backoff_algorithm\source\include;..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\Source\Application-Protocols\network_transport\using_mbedtls\using_mbedtls_pkcs11;..\..\Source\Utilities\mbedtls_freertos;..\..\Source\mbedtls_utils;..\..\ThirdParty\mbedtls\include;.;%(AdditionalIncludeDirectories) MBEDTLS_CONFIG_FILE="mbedtls_config.h";WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -159,16 +159,17 @@ - - + + + @@ -289,8 +290,8 @@ - - + + diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj.filters index 9d97c439a..38b7f8150 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/WIN32.vcxproj.filters @@ -410,12 +410,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport - FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls @@ -429,6 +423,16 @@ FreeRTOS+\FreeRTOS IoT Libraries\standard\coreMQTT + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\mbedtls + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport + @@ -809,12 +813,6 @@ FreeRTOS+\FreeRTOS IoT Libraries\platform\backoff_algorithm\include - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - - - FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include - FreeRTOS+\FreeRTOS IoT Libraries\platform @@ -833,6 +831,14 @@ Config + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\transport\include + diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/mbedtls_config.h b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/mbedtls_config.h index 67b9674eb..9068e15ce 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/mbedtls_config.h @@ -125,6 +125,11 @@ int mbedtls_platform_recv( void * ctx, unsigned char * buf, size_t len ); +/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network + * transport layer. */ +#define MBEDTLS_SSL_SEND mbedtls_platform_send +#define MBEDTLS_SSL_RECV mbedtls_platform_recv + /* The entropy poll function. */ int mbedtls_platform_entropy_poll( void * data, unsigned char * output, diff --git a/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/WIN32.vcxproj index 545166ef7..49bc2c6e2 100755 --- a/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/WIN32.vcxproj @@ -238,6 +238,7 @@ + diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.c deleted file mode 100644 index 7d07ae395..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * FreeRTOS V202107.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 sockets_wrapper.c - * @brief FreeRTOS Sockets connect and disconnect wrapper implementation. - */ - -/* Standard includes. */ -#include - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" - -#include "sockets_wrapper.h" - -/*-----------------------------------------------------------*/ - -/* Maximum number of times to call FreeRTOS_recv when initiating a graceful shutdown. */ -#ifndef FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS - #define FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ( 3 ) -#endif - -/* A negative error code indicating a network failure. */ -#define FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR ( -1 ) - -/*-----------------------------------------------------------*/ - -BaseType_t Sockets_Connect( Socket_t * pTcpSocket, - const char * pHostName, - uint16_t port, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ) -{ - Socket_t tcpSocket = FREERTOS_INVALID_SOCKET; - BaseType_t socketStatus = 0; - struct freertos_sockaddr serverAddress = { 0 }; - TickType_t transportTimeout = 0; - - /* Create a new TCP socket. */ - tcpSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP ); - - if( tcpSocket == FREERTOS_INVALID_SOCKET ) - { - LogError( ( "Failed to create new socket." ) ); - socketStatus = FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR; - } - else - { - LogDebug( ( "Created new TCP socket." ) ); - - /* Connection parameters. */ - serverAddress.sin_family = FREERTOS_AF_INET; - serverAddress.sin_port = FreeRTOS_htons( port ); - serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); - serverAddress.sin_len = ( uint8_t ) sizeof( serverAddress ); - - /* Check for errors from DNS lookup. */ - if( serverAddress.sin_addr == 0U ) - { - LogError( ( "Failed to connect to server: DNS resolution failed: Hostname=%s.", - pHostName ) ); - socketStatus = FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR; - } - } - - if( socketStatus == 0 ) - { - /* Establish connection. */ - LogDebug( ( "Creating TCP Connection to %s.", pHostName ) ); - socketStatus = FreeRTOS_connect( tcpSocket, &serverAddress, sizeof( serverAddress ) ); - - if( socketStatus != 0 ) - { - LogError( ( "Failed to connect to server: FreeRTOS_Connect failed: ReturnCode=%d," - " Hostname=%s, Port=%u.", - socketStatus, - pHostName, - port ) ); - } - } - - if( socketStatus == 0 ) - { - /* Set socket receive timeout. */ - transportTimeout = pdMS_TO_TICKS( receiveTimeoutMs ); - /* Setting the receive block time cannot fail. */ - ( void ) FreeRTOS_setsockopt( tcpSocket, - 0, - FREERTOS_SO_RCVTIMEO, - &transportTimeout, - sizeof( TickType_t ) ); - - /* Set socket send timeout. */ - transportTimeout = pdMS_TO_TICKS( sendTimeoutMs ); - /* Setting the send block time cannot fail. */ - ( void ) FreeRTOS_setsockopt( tcpSocket, - 0, - FREERTOS_SO_SNDTIMEO, - &transportTimeout, - sizeof( TickType_t ) ); - } - - /* Clean up on failure. */ - if( socketStatus != 0 ) - { - if( tcpSocket != FREERTOS_INVALID_SOCKET ) - { - ( void ) FreeRTOS_closesocket( tcpSocket ); - } - } - else - { - /* Set the socket. */ - *pTcpSocket = tcpSocket; - LogInfo( ( "Established TCP connection with %s.", pHostName ) ); - } - - return socketStatus; -} - -/*-----------------------------------------------------------*/ - -void Sockets_Disconnect( Socket_t tcpSocket ) -{ - BaseType_t waitForShutdownLoopCount = 0; - uint8_t pDummyBuffer[ 2 ]; - - if( tcpSocket != FREERTOS_INVALID_SOCKET ) - { - /* Initiate graceful shutdown. */ - ( void ) FreeRTOS_shutdown( tcpSocket, FREERTOS_SHUT_RDWR ); - - /* Wait for the socket to disconnect gracefully (indicated by FreeRTOS_recv() - * returning a FREERTOS_EINVAL error) before closing the socket. */ - while( FreeRTOS_recv( tcpSocket, pDummyBuffer, sizeof( pDummyBuffer ), 0 ) >= 0 ) - { - /* We don't need to delay since FreeRTOS_recv should already have a timeout. */ - - if( ++waitForShutdownLoopCount >= FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ) - { - break; - } - } - - ( void ) FreeRTOS_closesocket( tcpSocket ); - } -} - -/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h deleted file mode 100644 index 7ca28a949..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * FreeRTOS V202107.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 sockets_wrapper.h - * @brief FreeRTOS Sockets connect and disconnect function wrapper. - */ - -#ifndef SOCKETS_WRAPPER_H -#define SOCKETS_WRAPPER_H - -/* FreeRTOS+TCP includes. */ -#include "FreeRTOS_IP.h" -#include "FreeRTOS_Sockets.h" -#include "FreeRTOS_DNS.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 Sockets. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "Sockets" -#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 Establish a connection to server. - * - * @param[out] pTcpSocket The output parameter to return the created socket descriptor. - * @param[in] pHostName Server hostname to connect to. - * @param[in] pServerInfo Server port to connect to. - * @param[in] receiveTimeoutMs Timeout (in milliseconds) for transport receive. - * @param[in] sendTimeoutMs Timeout (in milliseconds) for transport send. - * - * @note A timeout of 0 means infinite timeout. - * - * @return Non-zero value on error, 0 on success. - */ -BaseType_t Sockets_Connect( Socket_t * pTcpSocket, - const char * pHostName, - uint16_t port, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ); - -/** - * @brief End connection to server. - * - * @param[in] tcpSocket The socket descriptor. - */ -void Sockets_Disconnect( Socket_t tcpSocket ); - -#endif /* ifndef SOCKETS_WRAPPER_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.c deleted file mode 100644 index e0d3fff9b..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.c +++ /dev/null @@ -1,847 +0,0 @@ -/* - * FreeRTOS V202107.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 tls_freertos.c - * @brief TLS transport interface implementations. This implementation uses - * mbedTLS. - */ - -/* Standard includes. */ -#include - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" - -/* FreeRTOS+TCP includes. */ -#include "FreeRTOS_IP.h" -#include "FreeRTOS_Sockets.h" - -/* TLS transport header. */ -#include "using_mbedtls.h" - -/* FreeRTOS Socket wrapper include. */ -#include "sockets_wrapper.h" - -/*-----------------------------------------------------------*/ - -/** - * @brief Each compilation unit that consumes the NetworkContext must define it. - * It should contain a single pointer as seen below whenever the header file - * of this transport implementation is included to your project. - * - * @note When using multiple transports in the same compilation unit, - * define this pointer as void *. - */ -struct NetworkContext -{ - TlsTransportParams_t * pParams; -}; - -/*-----------------------------------------------------------*/ - -/** - * @brief Represents string to be logged when mbedTLS returned error - * does not contain a high-level code. - */ -static const char * pNoHighLevelMbedTlsCodeStr = ""; - -/** - * @brief Represents string to be logged when mbedTLS returned error - * does not contain a low-level code. - */ -static const char * pNoLowLevelMbedTlsCodeStr = ""; - -/** - * @brief Utility for converting the high-level code in an mbedTLS error to string, - * if the code-contains a high-level code; otherwise, using a default string. - */ -#define mbedtlsHighLevelCodeOrDefault( mbedTlsCode ) \ - ( mbedtls_high_level_strerr( mbedTlsCode ) != NULL ) ? \ - mbedtls_high_level_strerr( mbedTlsCode ) : pNoHighLevelMbedTlsCodeStr - -/** - * @brief Utility for converting the level-level code in an mbedTLS error to string, - * if the code-contains a level-level code; otherwise, using a default string. - */ -#define mbedtlsLowLevelCodeOrDefault( mbedTlsCode ) \ - ( mbedtls_low_level_strerr( mbedTlsCode ) != NULL ) ? \ - mbedtls_low_level_strerr( mbedTlsCode ) : pNoLowLevelMbedTlsCodeStr - -/*-----------------------------------------------------------*/ - -/** - * @brief Initialize the mbed TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to initialize. - */ -static void sslContextInit( SSLContext_t * pSslContext ); - -/** - * @brief Free the mbed TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to free. - */ -static void sslContextFree( SSLContext_t * pSslContext ); - -/** - * @brief Add X509 certificate to the trusted list of root certificates. - * - * OpenSSL does not provide a single function for reading and loading certificates - * from files into stores, so the file API must be called. Start with the - * root certificate. - * - * @param[out] pSslContext SSL context to which the trusted server root CA is to be added. - * @param[in] pRootCa PEM-encoded string of the trusted server root CA. - * @param[in] rootCaSize Size of the trusted server root CA. - * - * @return 0 on success; otherwise, failure; - */ -static int32_t setRootCa( SSLContext_t * pSslContext, - const uint8_t * pRootCa, - size_t rootCaSize ); - -/** - * @brief Set X509 certificate as client certificate for the server to authenticate. - * - * @param[out] pSslContext SSL context to which the client certificate is to be set. - * @param[in] pClientCert PEM-encoded string of the client certificate. - * @param[in] clientCertSize Size of the client certificate. - * - * @return 0 on success; otherwise, failure; - */ -static int32_t setClientCertificate( SSLContext_t * pSslContext, - const uint8_t * pClientCert, - size_t clientCertSize ); - -/** - * @brief Set private key for the client's certificate. - * - * @param[out] pSslContext SSL context to which the private key is to be set. - * @param[in] pPrivateKey PEM-encoded string of the client private key. - * @param[in] privateKeySize Size of the client private key. - * - * @return 0 on success; otherwise, failure; - */ -static int32_t setPrivateKey( SSLContext_t * pSslContext, - const uint8_t * pPrivateKey, - size_t privateKeySize ); - -/** - * @brief Passes TLS credentials to the OpenSSL library. - * - * Provides the root CA certificate, client certificate, and private key to the - * OpenSSL library. If the client certificate or private key is not NULL, mutual - * authentication is used when performing the TLS handshake. - * - * @param[out] pSslContext SSL context to which the credentials are to be imported. - * @param[in] pNetworkCredentials TLS credentials to be imported. - * - * @return 0 on success; otherwise, failure; - */ -static int32_t setCredentials( SSLContext_t * pSslContext, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Set optional configurations for the TLS connection. - * - * This function is used to set SNI and ALPN protocols. - * - * @param[in] pSslContext SSL context to which the optional configurations are to be set. - * @param[in] pHostName Remote host name, used for server name indication. - * @param[in] pNetworkCredentials TLS setup parameters. - */ -static void setOptionalConfigurations( SSLContext_t * pSslContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Setup TLS by initializing contexts and setting configurations. - * - * @param[in] pNetworkContext Network context. - * @param[in] pHostName Remote host name, used for server name indication. - * @param[in] pNetworkCredentials TLS setup parameters. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Perform the TLS handshake on a TCP connection. - * - * @param[in] pNetworkContext Network context. - * @param[in] pNetworkCredentials TLS setup parameters. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t tlsHandshake( NetworkContext_t * pNetworkContext, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Initialize mbedTLS. - * - * @param[out] entropyContext mbed TLS entropy context for generation of random numbers. - * @param[out] ctrDrgbContext mbed TLS CTR DRBG context for generation of random numbers. - * - * @return #TLS_TRANSPORT_SUCCESS, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t initMbedtls( mbedtls_entropy_context * pEntropyContext, - mbedtls_ctr_drbg_context * pCtrDrgbContext ); - -/*-----------------------------------------------------------*/ - -static void sslContextInit( SSLContext_t * pSslContext ) -{ - configASSERT( pSslContext != NULL ); - - mbedtls_ssl_config_init( &( pSslContext->config ) ); - mbedtls_x509_crt_init( &( pSslContext->rootCa ) ); - mbedtls_pk_init( &( pSslContext->privKey ) ); - mbedtls_x509_crt_init( &( pSslContext->clientCert ) ); - mbedtls_ssl_init( &( pSslContext->context ) ); -} -/*-----------------------------------------------------------*/ - -static void sslContextFree( SSLContext_t * pSslContext ) -{ - configASSERT( pSslContext != NULL ); - - mbedtls_ssl_free( &( pSslContext->context ) ); - mbedtls_x509_crt_free( &( pSslContext->rootCa ) ); - mbedtls_x509_crt_free( &( pSslContext->clientCert ) ); - mbedtls_pk_free( &( pSslContext->privKey ) ); - mbedtls_entropy_free( &( pSslContext->entropyContext ) ); - mbedtls_ctr_drbg_free( &( pSslContext->ctrDrgbContext ) ); - mbedtls_ssl_config_free( &( pSslContext->config ) ); -} -/*-----------------------------------------------------------*/ - -static int32_t setRootCa( SSLContext_t * pSslContext, - const uint8_t * pRootCa, - size_t rootCaSize ) -{ - int32_t mbedtlsError = -1; - - configASSERT( pSslContext != NULL ); - configASSERT( pRootCa != NULL ); - - /* Parse the server root CA certificate into the SSL context. */ - mbedtlsError = mbedtls_x509_crt_parse( &( pSslContext->rootCa ), - pRootCa, - rootCaSize ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to parse server root CA certificate: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - else - { - mbedtls_ssl_conf_ca_chain( &( pSslContext->config ), - &( pSslContext->rootCa ), - NULL ); - } - - return mbedtlsError; -} -/*-----------------------------------------------------------*/ - -static int32_t setClientCertificate( SSLContext_t * pSslContext, - const uint8_t * pClientCert, - size_t clientCertSize ) -{ - int32_t mbedtlsError = -1; - - configASSERT( pSslContext != NULL ); - configASSERT( pClientCert != NULL ); - - /* Setup the client certificate. */ - mbedtlsError = mbedtls_x509_crt_parse( &( pSslContext->clientCert ), - pClientCert, - clientCertSize ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to parse the client certificate: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - - return mbedtlsError; -} -/*-----------------------------------------------------------*/ - -static int32_t setPrivateKey( SSLContext_t * pSslContext, - const uint8_t * pPrivateKey, - size_t privateKeySize ) -{ - int32_t mbedtlsError = -1; - - configASSERT( pSslContext != NULL ); - configASSERT( pPrivateKey != NULL ); - - /* Setup the client private key. */ - mbedtlsError = mbedtls_pk_parse_key( &( pSslContext->privKey ), - pPrivateKey, - privateKeySize, - NULL, - 0 ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to parse the client key: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - - return mbedtlsError; -} -/*-----------------------------------------------------------*/ - -static int32_t setCredentials( SSLContext_t * pSslContext, - const NetworkCredentials_t * pNetworkCredentials ) -{ - int32_t mbedtlsError = -1; - - configASSERT( pSslContext != NULL ); - configASSERT( pNetworkCredentials != NULL ); - - /* Set up the certificate security profile, starting from the default value. */ - pSslContext->certProfile = mbedtls_x509_crt_profile_default; - - /* Set SSL authmode and the RNG context. */ - mbedtls_ssl_conf_authmode( &( pSslContext->config ), - MBEDTLS_SSL_VERIFY_REQUIRED ); - mbedtls_ssl_conf_rng( &( pSslContext->config ), - mbedtls_ctr_drbg_random, - &( pSslContext->ctrDrgbContext ) ); - mbedtls_ssl_conf_cert_profile( &( pSslContext->config ), - &( pSslContext->certProfile ) ); - - mbedtlsError = setRootCa( pSslContext, - pNetworkCredentials->pRootCa, - pNetworkCredentials->rootCaSize ); - - if( ( pNetworkCredentials->pClientCert != NULL ) && - ( pNetworkCredentials->pPrivateKey != NULL ) ) - { - if( mbedtlsError == 0 ) - { - mbedtlsError = setClientCertificate( pSslContext, - pNetworkCredentials->pClientCert, - pNetworkCredentials->clientCertSize ); - } - - if( mbedtlsError == 0 ) - { - mbedtlsError = setPrivateKey( pSslContext, - pNetworkCredentials->pPrivateKey, - pNetworkCredentials->privateKeySize ); - } - - if( mbedtlsError == 0 ) - { - mbedtlsError = mbedtls_ssl_conf_own_cert( &( pSslContext->config ), - &( pSslContext->clientCert ), - &( pSslContext->privKey ) ); - } - } - - return mbedtlsError; -} -/*-----------------------------------------------------------*/ - -static void setOptionalConfigurations( SSLContext_t * pSslContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ) -{ - int32_t mbedtlsError = -1; - - configASSERT( pSslContext != NULL ); - configASSERT( pHostName != NULL ); - configASSERT( pNetworkCredentials != NULL ); - - if( pNetworkCredentials->pAlpnProtos != NULL ) - { - /* Include an application protocol list in the TLS ClientHello - * message. */ - mbedtlsError = mbedtls_ssl_conf_alpn_protocols( &( pSslContext->config ), - pNetworkCredentials->pAlpnProtos ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to configure ALPN protocol in mbed TLS: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - } - - /* Enable SNI if requested. */ - if( pNetworkCredentials->disableSni == pdFALSE ) - { - mbedtlsError = mbedtls_ssl_set_hostname( &( pSslContext->context ), - pHostName ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set server name: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - } - - /* Set Maximum Fragment Length if enabled. */ - #ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH - - /* Enable the max fragment extension. 4096 bytes is currently the largest fragment size permitted. - * See RFC 8449 https://tools.ietf.org/html/rfc8449 for more information. - * - * Smaller values can be found in "mbedtls/include/ssl.h". - */ - mbedtlsError = mbedtls_ssl_conf_max_frag_len( &( pSslContext->config ), MBEDTLS_SSL_MAX_FRAG_LEN_4096 ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to maximum fragment length extension: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - } - #endif /* ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ -} -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - int32_t mbedtlsError = 0; - - configASSERT( pNetworkContext != NULL ); - configASSERT( pNetworkContext->pParams != NULL ); - configASSERT( pHostName != NULL ); - configASSERT( pNetworkCredentials != NULL ); - configASSERT( pNetworkCredentials->pRootCa != NULL ); - - pTlsTransportParams = pNetworkContext->pParams; - /* Initialize the mbed TLS context structures. */ - sslContextInit( &( pTlsTransportParams->sslContext ) ); - - mbedtlsError = mbedtls_ssl_config_defaults( &( pTlsTransportParams->sslContext.config ), - MBEDTLS_SSL_IS_CLIENT, - MBEDTLS_SSL_TRANSPORT_STREAM, - MBEDTLS_SSL_PRESET_DEFAULT ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set default SSL configuration: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - /* Per mbed TLS docs, mbedtls_ssl_config_defaults only fails on memory allocation. */ - returnStatus = TLS_TRANSPORT_INSUFFICIENT_MEMORY; - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - mbedtlsError = setCredentials( &( pTlsTransportParams->sslContext ), - pNetworkCredentials ); - - if( mbedtlsError != 0 ) - { - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - else - { - /* Optionally set SNI and ALPN protocols. */ - setOptionalConfigurations( &( pTlsTransportParams->sslContext ), - pHostName, - pNetworkCredentials ); - } - } - - return returnStatus; -} -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t tlsHandshake( NetworkContext_t * pNetworkContext, - const NetworkCredentials_t * pNetworkCredentials ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - int32_t mbedtlsError = 0; - - configASSERT( pNetworkContext != NULL ); - configASSERT( pNetworkContext->pParams != NULL ); - configASSERT( pNetworkCredentials != NULL ); - - pTlsTransportParams = pNetworkContext->pParams; - /* Initialize the mbed TLS secured connection context. */ - mbedtlsError = mbedtls_ssl_setup( &( pTlsTransportParams->sslContext.context ), - &( pTlsTransportParams->sslContext.config ) ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set up mbed TLS SSL context: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - else - { - /* Set the underlying IO for the TLS connection. */ - - /* MISRA Rule 11.2 flags the following line for casting the second - * parameter to void *. This rule is suppressed because - * #mbedtls_ssl_set_bio requires the second parameter as void *. - */ - /* coverity[misra_c_2012_rule_11_2_violation] */ - mbedtls_ssl_set_bio( &( pTlsTransportParams->sslContext.context ), - ( void * ) pTlsTransportParams->tcpSocket, - mbedtls_platform_send, - mbedtls_platform_recv, - NULL ); - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Perform the TLS handshake. */ - do - { - mbedtlsError = mbedtls_ssl_handshake( &( pTlsTransportParams->sslContext.context ) ); - } while( ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_READ ) || - ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_WRITE ) ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to perform TLS handshake: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; - } - else - { - LogInfo( ( "(Network connection %p) TLS handshake successful.", - pNetworkContext ) ); - } - } - - return returnStatus; -} -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t initMbedtls( mbedtls_entropy_context * pEntropyContext, - mbedtls_ctr_drbg_context * pCtrDrgbContext ) -{ - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - int32_t mbedtlsError = 0; - - /* Set the mutex functions for mbed TLS thread safety. */ - mbedtls_threading_set_alt( mbedtls_platform_mutex_init, - mbedtls_platform_mutex_free, - mbedtls_platform_mutex_lock, - mbedtls_platform_mutex_unlock ); - - /* Initialize contexts for random number generation. */ - mbedtls_entropy_init( pEntropyContext ); - mbedtls_ctr_drbg_init( pCtrDrgbContext ); - - /* Add a strong entropy source. At least one is required. */ - mbedtlsError = mbedtls_entropy_add_source( pEntropyContext, - mbedtls_platform_entropy_poll, - NULL, - 32, - MBEDTLS_ENTROPY_SOURCE_STRONG ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to add entropy source: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Seed the random number generator. */ - mbedtlsError = mbedtls_ctr_drbg_seed( pCtrDrgbContext, - mbedtls_entropy_func, - pEntropyContext, - NULL, - 0 ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to seed PRNG: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - LogDebug( ( "Successfully initialized mbedTLS." ) ); - } - - return returnStatus; -} -/*-----------------------------------------------------------*/ - -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - BaseType_t socketStatus = 0; - - if( ( pNetworkContext == NULL ) || - ( pNetworkContext->pParams == NULL ) || - ( pHostName == NULL ) || - ( pNetworkCredentials == NULL ) ) - { - LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " - "pHostName=%p, pNetworkCredentials=%p.", - pNetworkContext, - pHostName, - pNetworkCredentials ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - else if( ( pNetworkCredentials->pRootCa == NULL ) ) - { - LogError( ( "pRootCa cannot be NULL." ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - else - { - /* Empty else for MISRA 15.7 compliance. */ - } - - /* Establish a TCP connection with the server. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - pTlsTransportParams = pNetworkContext->pParams; - socketStatus = Sockets_Connect( &( pTlsTransportParams->tcpSocket ), - pHostName, - port, - receiveTimeoutMs, - sendTimeoutMs ); - - if( socketStatus != 0 ) - { - LogError( ( "Failed to connect to %s with error %d.", - pHostName, - socketStatus ) ); - returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; - } - } - - /* Initialize mbedtls. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = initMbedtls( &( pTlsTransportParams->sslContext.entropyContext ), - &( pTlsTransportParams->sslContext.ctrDrgbContext ) ); - } - - /* Initialize TLS contexts and set credentials. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); - } - - /* Perform TLS handshake. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = tlsHandshake( pNetworkContext, pNetworkCredentials ); - } - - /* Clean up on failure. */ - if( returnStatus != TLS_TRANSPORT_SUCCESS ) - { - if( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ) - { - sslContextFree( &( pTlsTransportParams->sslContext ) ); - - if( pTlsTransportParams->tcpSocket != FREERTOS_INVALID_SOCKET ) - { - ( void ) FreeRTOS_closesocket( pTlsTransportParams->tcpSocket ); - } - } - } - else - { - LogInfo( ( "(Network connection %p) Connection to %s established.", - pNetworkContext, - pHostName ) ); - } - - return returnStatus; -} -/*-----------------------------------------------------------*/ - -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - BaseType_t tlsStatus = 0; - - if( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ) - { - pTlsTransportParams = pNetworkContext->pParams; - /* Attempting to terminate TLS connection. */ - tlsStatus = ( BaseType_t ) mbedtls_ssl_close_notify( &( pTlsTransportParams->sslContext.context ) ); - - /* Ignore the WANT_READ and WANT_WRITE return values. */ - if( ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_READ ) && - ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - if( tlsStatus == 0 ) - { - LogInfo( ( "(Network connection %p) TLS close-notify sent.", - pNetworkContext ) ); - } - else - { - LogError( ( "(Network connection %p) Failed to send TLS close-notify: mbedTLSError= %s : %s.", - pNetworkContext, - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - } - else - { - /* WANT_READ and WANT_WRITE can be ignored. Logging for debugging purposes. */ - LogInfo( ( "(Network connection %p) TLS close-notify sent; ", - "received %s as the TLS status can be ignored for close-notify." - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE", - pNetworkContext ) ); - } - - /* Call socket shutdown function to close connection. */ - Sockets_Disconnect( pTlsTransportParams->tcpSocket ); - - /* Free mbed TLS contexts. */ - sslContextFree( &( pTlsTransportParams->sslContext ) ); - } - - /* Clear the mutex functions for mbed TLS thread safety. */ - mbedtls_threading_free_alt(); -} -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - int32_t tlsStatus = 0; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pTlsTransportParams = pNetworkContext->pParams; - tlsStatus = ( int32_t ) mbedtls_ssl_read( &( pTlsTransportParams->sslContext.context ), - pBuffer, - bytesToRecv ); - - if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - LogDebug( ( "Failed to read data. However, a read can be retried on this error. " - "mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - - /* Mark these set of errors as a timeout. The libraries may retry read - * on these errors. */ - tlsStatus = 0; - } - else if( tlsStatus < 0 ) - { - LogError( ( "Failed to read data: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - else - { - /* Empty else marker. */ - } - - return tlsStatus; -} -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - int32_t tlsStatus = 0; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pTlsTransportParams = pNetworkContext->pParams; - tlsStatus = ( int32_t ) mbedtls_ssl_write( &( pTlsTransportParams->sslContext.context ), - pBuffer, - bytesToSend ); - - if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - LogDebug( ( "Failed to send data. However, send can be retried on this error. " - "mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - - /* Mark these set of errors as a timeout. The libraries may retry send - * on these errors. */ - tlsStatus = 0; - } - else if( tlsStatus < 0 ) - { - LogError( ( "Failed to send data: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - else - { - /* Empty else marker. */ - } - - return tlsStatus; -} -/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h deleted file mode 100644 index 25eb5074c..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * FreeRTOS V202107.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 tls_freertos.h - * @brief TLS transport interface header. - */ - -#ifndef USING_MBEDTLS -#define USING_MBEDTLS - -/**************************************************/ -/******* 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 Sockets. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "TlsTransport" -#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 ****************/ - -/* FreeRTOS+TCP include. */ -#include "FreeRTOS_Sockets.h" - -/* Transport interface include. */ -#include "transport_interface.h" - -/* mbed TLS includes. */ -#include "mbedtls/ctr_drbg.h" -#include "mbedtls/entropy.h" -#include "mbedtls/ssl.h" -#include "mbedtls/threading.h" -#include "mbedtls/x509.h" -#include "mbedtls/error.h" - -/** - * @brief Secured connection context. - */ -typedef struct SSLContext -{ - mbedtls_ssl_config config; /**< @brief SSL connection configuration. */ - mbedtls_ssl_context context; /**< @brief SSL connection context */ - mbedtls_x509_crt_profile certProfile; /**< @brief Certificate security profile for this connection. */ - mbedtls_x509_crt rootCa; /**< @brief Root CA certificate context. */ - mbedtls_x509_crt clientCert; /**< @brief Client certificate context. */ - mbedtls_pk_context privKey; /**< @brief Client private key context. */ - mbedtls_entropy_context entropyContext; /**< @brief Entropy context for random number generation. */ - mbedtls_ctr_drbg_context ctrDrgbContext; /**< @brief CTR DRBG context for random number generation. */ -} SSLContext_t; - -/** - * @brief Parameters for the network context of the transport interface - * implementation that uses mbedTLS and FreeRTOS+TCP sockets. - */ -typedef struct TlsTransportParams -{ - Socket_t tcpSocket; - SSLContext_t sslContext; -} TlsTransportParams_t; - -/** - * @brief Contains the credentials necessary for tls connection setup. - */ -typedef struct NetworkCredentials -{ - /** - * @brief To use ALPN, set this to a NULL-terminated list of supported - * protocols in decreasing order of preference. - * - * See [this link] - * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) - * for more information. - */ - const char ** pAlpnProtos; - - /** - * @brief Disable server name indication (SNI) for a TLS session. - */ - BaseType_t disableSni; - - const uint8_t * pRootCa; /**< @brief String representing a trusted server root certificate. */ - size_t rootCaSize; /**< @brief Size associated with #NetworkCredentials.pRootCa. */ - const uint8_t * pClientCert; /**< @brief String representing the client certificate. */ - size_t clientCertSize; /**< @brief Size associated with #NetworkCredentials.pClientCert. */ - const uint8_t * pPrivateKey; /**< @brief String representing the client certificate's private key. */ - size_t privateKeySize; /**< @brief Size associated with #NetworkCredentials.pPrivateKey. */ -} NetworkCredentials_t; - -/** - * @brief TLS Connect / Disconnect return status. - */ -typedef enum TlsTransportStatus -{ - TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ - TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ - TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ - TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ - TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ - TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ - TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ -} TlsTransportStatus_t; - -/** - * @brief Create a TLS connection with FreeRTOS sockets. - * - * @param[out] pNetworkContext Pointer to a network context to contain the - * initialized socket handle. - * @param[in] pHostName The hostname of the remote endpoint. - * @param[in] port The destination port. - * @param[in] pNetworkCredentials Credentials for the TLS connection. - * @param[in] receiveTimeoutMs Receive socket timeout. - * @param[in] sendTimeoutMs Send socket timeout. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. - */ -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ); - -/** - * @brief Gracefully disconnect an established TLS connection. - * - * @param[in] pNetworkContext Network context. - */ -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); - -/** - * @brief Receives data from an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportRecv_t function. - * - * @param[in] pNetworkContext The Network context. - * @param[out] pBuffer Buffer to receive bytes into. - * @param[in] bytesToRecv Number of bytes to receive from the network. - * - * @return Number of bytes (> 0) received if successful; - * 0 if the socket times out without reading any bytes; - * negative value on error. - */ -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ); - -/** - * @brief Sends data over an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportSend_t function. - * - * @param[in] pNetworkContext The network context. - * @param[in] pBuffer Buffer containing the bytes to send. - * @param[in] bytesToSend Number of bytes to send from the buffer. - * - * @return Number of bytes (> 0) sent on success; - * 0 if the socket times out without sending any bytes; - * else a negative value to represent error. - */ -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ); - -#endif /* ifndef USING_MBEDTLS */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c deleted file mode 100644 index ef0a45ef5..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c +++ /dev/null @@ -1,1011 +0,0 @@ -/* - * FreeRTOS V202107.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 tls_freertos_pkcs11.c - * @brief TLS transport interface implementations. This implementation uses - * mbedTLS. - * @note This file is derived from the tls_freertos.c source file found in the mqtt - * section of IoT Libraries source code. The file has been modified to support using - * PKCS #11 when using TLS. - */ - -/* Standard includes. */ -#include - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" - -/* FreeRTOS+TCP includes. */ -#include "FreeRTOS_IP.h" -#include "FreeRTOS_Sockets.h" - -/* TLS transport header. */ -#include "using_mbedtls_pkcs11.h" - -/* FreeRTOS Socket wrapper include. */ -#include "sockets_wrapper.h" - -/* PKCS #11 includes. */ -#include "core_pkcs11_config.h" -#include "core_pkcs11.h" -#include "pkcs11.h" -#include "core_pki_utils.h" - -/*-----------------------------------------------------------*/ - -/** - * @brief Each compilation unit that consumes the NetworkContext must define it. - * It should contain a single pointer as seen below whenever the header file - * of this transport implementation is included to your project. - * - * @note When using multiple transports in the same compilation unit, - * define this pointer as void *. - */ -struct NetworkContext -{ - TlsTransportParams_t * pParams; -}; - -/*-----------------------------------------------------------*/ - -/** - * @brief Represents string to be logged when mbedTLS returned error - * does not contain a high-level code. - */ -static const char * pNoHighLevelMbedTlsCodeStr = ""; - -/** - * @brief Represents string to be logged when mbedTLS returned error - * does not contain a low-level code. - */ -static const char * pNoLowLevelMbedTlsCodeStr = ""; - -/** - * @brief Utility for converting the high-level code in an mbedTLS error to string, - * if the code-contains a high-level code; otherwise, using a default string. - */ -#define mbedtlsHighLevelCodeOrDefault( mbedTlsCode ) \ - ( mbedtls_high_level_strerr( mbedTlsCode ) != NULL ) ? \ - mbedtls_high_level_strerr( mbedTlsCode ) : pNoHighLevelMbedTlsCodeStr - -/** - * @brief Utility for converting the level-level code in an mbedTLS error to string, - * if the code-contains a level-level code; otherwise, using a default string. - */ -#define mbedtlsLowLevelCodeOrDefault( mbedTlsCode ) \ - ( mbedtls_low_level_strerr( mbedTlsCode ) != NULL ) ? \ - mbedtls_low_level_strerr( mbedTlsCode ) : pNoLowLevelMbedTlsCodeStr - -/*-----------------------------------------------------------*/ - -/** - * @brief Initialize the mbed TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to initialize. - */ -static void sslContextInit( SSLContext_t * pSslContext ); - -/** - * @brief Free the mbed TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to free. - */ -static void sslContextFree( SSLContext_t * pSslContext ); - -/** - * @brief Set up TLS on a TCP connection. - * - * @param[in] pNetworkContext Network context. - * @param[in] pHostName Remote host name, used for server name indication. - * @param[in] pNetworkCredentials TLS setup parameters. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Initialize mbedTLS. - * - * @return #TLS_TRANSPORT_SUCCESS, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t initMbedtls( void ); - -/*-----------------------------------------------------------*/ - -/** - * @brief Callback that wraps PKCS#11 for pseudo-random number generation. - * - * @param[in] pvCtx Caller context. - * @param[in] pucRandom Byte array to fill with random data. - * @param[in] xRandomLength Length of byte array. - * - * @return Zero on success. - */ -static int32_t generateRandomBytes( void * pvCtx, - unsigned char * pucRandom, - size_t xRandomLength ); - -/** - * @brief Helper for reading the specified certificate object, if present, - * out of storage, into RAM, and then into an mbedTLS certificate context - * object. - * - * @param[in] pSslContext Caller TLS context. - * @param[in] pcLabelName PKCS #11 certificate object label. - * @param[in] xClass PKCS #11 certificate object class. - * @param[out] pxCertificateContext Certificate context. - * - * @return Zero on success. - */ -static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext, - char * pcLabelName, - CK_OBJECT_CLASS xClass, - mbedtls_x509_crt * pxCertificateContext ); - -/** - * @brief Helper for setting up potentially hardware-based cryptographic context. - * - * @param Caller context. - * - * @return Zero on success. - */ -static CK_RV initializeClientKeys( SSLContext_t * pxCtx ); - -/** - * @brief Sign a cryptographic hash with the private key. - * - * @param[in] pvContext Crypto context. - * @param[in] xMdAlg Unused. - * @param[in] pucHash Length in bytes of hash to be signed. - * @param[in] uiHashLen Byte array of hash to be signed. - * @param[out] pucSig RSA signature bytes. - * @param[in] pxSigLen Length in bytes of signature buffer. - * @param[in] piRng Unused. - * @param[in] pvRng Unused. - * - * @return Zero on success. - */ -static int32_t privateKeySigningCallback( void * pvContext, - mbedtls_md_type_t xMdAlg, - const unsigned char * pucHash, - size_t xHashLen, - unsigned char * pucSig, - size_t * pxSigLen, - int32_t ( * piRng )( void *, - unsigned char *, - size_t ), - void * pvRng ); - - -/*-----------------------------------------------------------*/ - -static void sslContextInit( SSLContext_t * pSslContext ) -{ - configASSERT( pSslContext != NULL ); - - mbedtls_ssl_config_init( &( pSslContext->config ) ); - mbedtls_x509_crt_init( &( pSslContext->rootCa ) ); - mbedtls_x509_crt_init( &( pSslContext->clientCert ) ); - mbedtls_ssl_init( &( pSslContext->context ) ); - - xInitializePkcs11Session( &( pSslContext->xP11Session ) ); - C_GetFunctionList( &( pSslContext->pxP11FunctionList ) ); -} -/*-----------------------------------------------------------*/ - -static void sslContextFree( SSLContext_t * pSslContext ) -{ - configASSERT( pSslContext != NULL ); - - mbedtls_ssl_free( &( pSslContext->context ) ); - mbedtls_x509_crt_free( &( pSslContext->rootCa ) ); - mbedtls_x509_crt_free( &( pSslContext->clientCert ) ); - mbedtls_ssl_config_free( &( pSslContext->config ) ); - - pSslContext->pxP11FunctionList->C_CloseSession( pSslContext->xP11Session ); -} - -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - int32_t mbedtlsError = 0; - CK_RV xResult = CKR_OK; - - configASSERT( pNetworkContext != NULL ); - configASSERT( pNetworkContext->pParams != NULL ); - configASSERT( pHostName != NULL ); - configASSERT( pNetworkCredentials != NULL ); - configASSERT( pNetworkCredentials->pRootCa != NULL ); - - pTlsTransportParams = pNetworkContext->pParams; - - /* Initialize the mbed TLS context structures. */ - sslContextInit( &( pTlsTransportParams->sslContext ) ); - - mbedtlsError = mbedtls_ssl_config_defaults( &( pTlsTransportParams->sslContext.config ), - MBEDTLS_SSL_IS_CLIENT, - MBEDTLS_SSL_TRANSPORT_STREAM, - MBEDTLS_SSL_PRESET_DEFAULT ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set default SSL configuration: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - /* Per mbed TLS docs, mbedtls_ssl_config_defaults only fails on memory allocation. */ - returnStatus = TLS_TRANSPORT_INSUFFICIENT_MEMORY; - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Set up the certificate security profile, starting from the default value. */ - pTlsTransportParams->sslContext.certProfile = mbedtls_x509_crt_profile_default; - - /* test.mosquitto.org only provides a 1024-bit RSA certificate, which is - * not acceptable by the default mbed TLS certificate security profile. - * For the purposes of this demo, allow the use of 1024-bit RSA certificates. - * This block should be removed otherwise. */ - if( strncmp( pHostName, "test.mosquitto.org", strlen( pHostName ) ) == 0 ) - { - pTlsTransportParams->sslContext.certProfile.rsa_min_bitlen = 1024; - } - - /* Set SSL authmode and the RNG context. */ - mbedtls_ssl_conf_authmode( &( pTlsTransportParams->sslContext.config ), - MBEDTLS_SSL_VERIFY_REQUIRED ); - mbedtls_ssl_conf_rng( &( pTlsTransportParams->sslContext.config ), - generateRandomBytes, - &pTlsTransportParams->sslContext ); - mbedtls_ssl_conf_cert_profile( &( pTlsTransportParams->sslContext.config ), - &( pTlsTransportParams->sslContext.certProfile ) ); - - /* Parse the server root CA certificate into the SSL context. */ - mbedtlsError = mbedtls_x509_crt_parse( &( pTlsTransportParams->sslContext.rootCa ), - pNetworkCredentials->pRootCa, - pNetworkCredentials->rootCaSize ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to parse server root CA certificate: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - else - { - mbedtls_ssl_conf_ca_chain( &( pTlsTransportParams->sslContext.config ), - &( pTlsTransportParams->sslContext.rootCa ), - NULL ); - } - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Setup the client private key. */ - xResult = initializeClientKeys( &( pTlsTransportParams->sslContext ) ); - - if( xResult != CKR_OK ) - { - LogError( ( "Failed to setup key handling by PKCS #11." ) ); - - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - else - { - /* Setup the client certificate. */ - xResult = readCertificateIntoContext( &( pTlsTransportParams->sslContext ), - pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS, - CKO_CERTIFICATE, - &( pTlsTransportParams->sslContext.clientCert ) ); - - if( xResult != CKR_OK ) - { - LogError( ( "Failed to get certificate from PKCS #11 module." ) ); - - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - else - { - ( void ) mbedtls_ssl_conf_own_cert( &( pTlsTransportParams->sslContext.config ), - &( pTlsTransportParams->sslContext.clientCert ), - &( pTlsTransportParams->sslContext.privKey ) ); - } - } - } - - if( ( returnStatus == TLS_TRANSPORT_SUCCESS ) && ( pNetworkCredentials->pAlpnProtos != NULL ) ) - { - /* Include an application protocol list in the TLS ClientHello - * message. */ - mbedtlsError = mbedtls_ssl_conf_alpn_protocols( &( pTlsTransportParams->sslContext.config ), - pNetworkCredentials->pAlpnProtos ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to configure ALPN protocol in mbed TLS: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Initialize the mbed TLS secured connection context. */ - mbedtlsError = mbedtls_ssl_setup( &( pTlsTransportParams->sslContext.context ), - &( pTlsTransportParams->sslContext.config ) ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set up mbed TLS SSL context: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - else - { - /* Set the underlying IO for the TLS connection. */ - - /* MISRA Rule 11.2 flags the following line for casting the second - * parameter to void *. This rule is suppressed because - * #mbedtls_ssl_set_bio requires the second parameter as void *. - */ - /* coverity[misra_c_2012_rule_11_2_violation] */ - mbedtls_ssl_set_bio( &( pTlsTransportParams->sslContext.context ), - ( void * ) pTlsTransportParams->tcpSocket, - mbedtls_platform_send, - mbedtls_platform_recv, - NULL ); - } - } - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Enable SNI if requested. */ - if( pNetworkCredentials->disableSni == pdFALSE ) - { - mbedtlsError = mbedtls_ssl_set_hostname( &( pTlsTransportParams->sslContext.context ), - pHostName ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to set server name: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - } - } - - /* Set Maximum Fragment Length if enabled. */ - #ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Enable the max fragment extension. 4096 bytes is currently the largest fragment size permitted. - * See RFC 8449 https://tools.ietf.org/html/rfc8449 for more information. - * - * Smaller values can be found in "mbedtls/include/ssl.h". - */ - mbedtlsError = mbedtls_ssl_conf_max_frag_len( &( pTlsTransportParams->sslContext.config ), MBEDTLS_SSL_MAX_FRAG_LEN_4096 ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to maximum fragment length extension: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - } - #endif /* ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - /* Perform the TLS handshake. */ - do - { - mbedtlsError = mbedtls_ssl_handshake( &( pTlsTransportParams->sslContext.context ) ); - } while( ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_READ ) || - ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_WRITE ) ); - - if( mbedtlsError != 0 ) - { - LogError( ( "Failed to perform TLS handshake: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( mbedtlsError ), - mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); - - returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; - } - } - - if( returnStatus != TLS_TRANSPORT_SUCCESS ) - { - sslContextFree( &( pTlsTransportParams->sslContext ) ); - } - else - { - LogInfo( ( "(Network connection %p) TLS handshake successful.", - pNetworkContext ) ); - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t initMbedtls( void ) -{ - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - - /* Set the mutex functions for mbed TLS thread safety. */ - mbedtls_threading_set_alt( mbedtls_platform_mutex_init, - mbedtls_platform_mutex_free, - mbedtls_platform_mutex_lock, - mbedtls_platform_mutex_unlock ); - - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - LogDebug( ( "Successfully initialized mbedTLS." ) ); - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - -static int32_t generateRandomBytes( void * pvCtx, - unsigned char * pucRandom, - size_t xRandomLength ) -{ - /* Must cast from void pointer to conform to mbed TLS API. */ - SSLContext_t * pxCtx = ( SSLContext_t * ) pvCtx; - CK_RV xResult; - - xResult = pxCtx->pxP11FunctionList->C_GenerateRandom( pxCtx->xP11Session, pucRandom, xRandomLength ); - - if( xResult != CKR_OK ) - { - LogError( ( "Failed to generate random bytes from the PKCS #11 module." ) ); - } - - return xResult; -} - -/*-----------------------------------------------------------*/ - -static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext, - char * pcLabelName, - CK_OBJECT_CLASS xClass, - mbedtls_x509_crt * pxCertificateContext ) -{ - CK_RV xResult = CKR_OK; - CK_ATTRIBUTE xTemplate = { 0 }; - CK_OBJECT_HANDLE xCertObj = 0; - - /* Get the handle of the certificate. */ - xResult = xFindObjectWithLabelAndClass( pSslContext->xP11Session, - pcLabelName, - strlen( pcLabelName ), - xClass, - &xCertObj ); - - if( ( CKR_OK == xResult ) && ( xCertObj == CK_INVALID_HANDLE ) ) - { - xResult = CKR_OBJECT_HANDLE_INVALID; - } - - /* Query the certificate size. */ - if( CKR_OK == xResult ) - { - xTemplate.type = CKA_VALUE; - xTemplate.ulValueLen = 0; - xTemplate.pValue = NULL; - xResult = pSslContext->pxP11FunctionList->C_GetAttributeValue( pSslContext->xP11Session, - xCertObj, - &xTemplate, - 1 ); - } - - /* Create a buffer for the certificate. */ - if( CKR_OK == xResult ) - { - xTemplate.pValue = pvPortMalloc( xTemplate.ulValueLen ); - - if( NULL == xTemplate.pValue ) - { - xResult = CKR_HOST_MEMORY; - } - } - - /* Export the certificate. */ - if( CKR_OK == xResult ) - { - xResult = pSslContext->pxP11FunctionList->C_GetAttributeValue( pSslContext->xP11Session, - xCertObj, - &xTemplate, - 1 ); - } - - /* Decode the certificate. */ - if( CKR_OK == xResult ) - { - xResult = mbedtls_x509_crt_parse( pxCertificateContext, - ( const unsigned char * ) xTemplate.pValue, - xTemplate.ulValueLen ); - } - - /* Free memory. */ - vPortFree( xTemplate.pValue ); - - return xResult; -} - -/*-----------------------------------------------------------*/ - -/** - * @brief Helper for setting up potentially hardware-based cryptographic context - * for the client TLS certificate and private key. - * - * @param Caller context. - * - * @return Zero on success. - */ -static CK_RV initializeClientKeys( SSLContext_t * pxCtx ) -{ - CK_RV xResult = CKR_OK; - CK_SLOT_ID * pxSlotIds = NULL; - CK_ULONG xCount = 0; - CK_ATTRIBUTE xTemplate[ 2 ]; - mbedtls_pk_type_t xKeyAlgo = ( mbedtls_pk_type_t ) ~0; - - /* Get the PKCS #11 module/token slot count. */ - if( CKR_OK == xResult ) - { - xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_GetSlotList( CK_TRUE, - NULL, - &xCount ); - } - - /* Allocate memory to store the token slots. */ - if( CKR_OK == xResult ) - { - pxSlotIds = ( CK_SLOT_ID * ) pvPortMalloc( sizeof( CK_SLOT_ID ) * xCount ); - - if( NULL == pxSlotIds ) - { - xResult = CKR_HOST_MEMORY; - } - } - - /* Get all of the available private key slot identities. */ - if( CKR_OK == xResult ) - { - xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_GetSlotList( CK_TRUE, - pxSlotIds, - &xCount ); - } - - /* Put the module in authenticated mode. */ - if( CKR_OK == xResult ) - { - xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_Login( pxCtx->xP11Session, - CKU_USER, - ( CK_UTF8CHAR_PTR ) configPKCS11_DEFAULT_USER_PIN, - sizeof( configPKCS11_DEFAULT_USER_PIN ) - 1 ); - } - - if( CKR_OK == xResult ) - { - /* Get the handle of the device private key. */ - xResult = xFindObjectWithLabelAndClass( pxCtx->xP11Session, - pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS, - sizeof( pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ) - 1UL, - CKO_PRIVATE_KEY, - &pxCtx->xP11PrivateKey ); - } - - if( ( CKR_OK == xResult ) && ( pxCtx->xP11PrivateKey == CK_INVALID_HANDLE ) ) - { - xResult = CK_INVALID_HANDLE; - LogError( ( "Could not find private key." ) ); - } - - /* Query the device private key type. */ - if( xResult == CKR_OK ) - { - xTemplate[ 0 ].type = CKA_KEY_TYPE; - xTemplate[ 0 ].pValue = &pxCtx->xKeyType; - xTemplate[ 0 ].ulValueLen = sizeof( CK_KEY_TYPE ); - xResult = pxCtx->pxP11FunctionList->C_GetAttributeValue( pxCtx->xP11Session, - pxCtx->xP11PrivateKey, - xTemplate, - 1 ); - } - - /* Map the PKCS #11 key type to an mbedTLS algorithm. */ - if( xResult == CKR_OK ) - { - switch( pxCtx->xKeyType ) - { - case CKK_RSA: - xKeyAlgo = MBEDTLS_PK_RSA; - break; - - case CKK_EC: - xKeyAlgo = MBEDTLS_PK_ECKEY; - break; - - default: - xResult = CKR_ATTRIBUTE_VALUE_INVALID; - break; - } - } - - /* Map the mbedTLS algorithm to its internal metadata. */ - if( xResult == CKR_OK ) - { - memcpy( &pxCtx->privKeyInfo, mbedtls_pk_info_from_type( xKeyAlgo ), sizeof( mbedtls_pk_info_t ) ); - - pxCtx->privKeyInfo.sign_func = privateKeySigningCallback; - pxCtx->privKey.pk_info = &pxCtx->privKeyInfo; - pxCtx->privKey.pk_ctx = pxCtx; - } - - /* Free memory. */ - vPortFree( pxSlotIds ); - - return xResult; -} - -/*-----------------------------------------------------------*/ - -static int32_t privateKeySigningCallback( void * pvContext, - mbedtls_md_type_t xMdAlg, - const unsigned char * pucHash, - size_t xHashLen, - unsigned char * pucSig, - size_t * pxSigLen, - int32_t ( * piRng )( void *, - unsigned char *, - size_t ), - void * pvRng ) -{ - CK_RV xResult = CKR_OK; - int32_t lFinalResult = 0; - SSLContext_t * pxTLSContext = ( SSLContext_t * ) pvContext; - CK_MECHANISM xMech = { 0 }; - CK_BYTE xToBeSigned[ 256 ]; - CK_ULONG xToBeSignedLen = sizeof( xToBeSigned ); - - /* Unreferenced parameters. */ - ( void ) ( piRng ); - ( void ) ( pvRng ); - ( void ) ( xMdAlg ); - - /* Sanity check buffer length. */ - if( xHashLen > sizeof( xToBeSigned ) ) - { - xResult = CKR_ARGUMENTS_BAD; - } - - /* Format the hash data to be signed. */ - if( CKK_RSA == pxTLSContext->xKeyType ) - { - xMech.mechanism = CKM_RSA_PKCS; - - /* mbedTLS expects hashed data without padding, but PKCS #11 C_Sign function performs a hash - * & sign if hash algorithm is specified. This helper function applies padding - * indicating data was hashed with SHA-256 while still allowing pre-hashed data to - * be provided. */ - xResult = vAppendSHA256AlgorithmIdentifierSequence( ( uint8_t * ) pucHash, xToBeSigned ); - xToBeSignedLen = pkcs11RSA_SIGNATURE_INPUT_LENGTH; - } - else if( CKK_EC == pxTLSContext->xKeyType ) - { - xMech.mechanism = CKM_ECDSA; - memcpy( xToBeSigned, pucHash, xHashLen ); - xToBeSignedLen = xHashLen; - } - else - { - xResult = CKR_ARGUMENTS_BAD; - } - - if( CKR_OK == xResult ) - { - /* Use the PKCS#11 module to sign. */ - xResult = pxTLSContext->pxP11FunctionList->C_SignInit( pxTLSContext->xP11Session, - &xMech, - pxTLSContext->xP11PrivateKey ); - } - - if( CKR_OK == xResult ) - { - *pxSigLen = sizeof( xToBeSigned ); - xResult = pxTLSContext->pxP11FunctionList->C_Sign( ( CK_SESSION_HANDLE ) pxTLSContext->xP11Session, - xToBeSigned, - xToBeSignedLen, - pucSig, - ( CK_ULONG_PTR ) pxSigLen ); - } - - if( ( xResult == CKR_OK ) && ( CKK_EC == pxTLSContext->xKeyType ) ) - { - /* PKCS #11 for P256 returns a 64-byte signature with 32 bytes for R and 32 bytes for S. - * This must be converted to an ASN.1 encoded array. */ - if( *pxSigLen != pkcs11ECDSA_P256_SIGNATURE_LENGTH ) - { - xResult = CKR_FUNCTION_FAILED; - } - - if( xResult == CKR_OK ) - { - PKI_pkcs11SignatureTombedTLSSignature( pucSig, pxSigLen ); - } - } - - if( xResult != CKR_OK ) - { - LogError( ( "Failed to sign message using PKCS #11 with error code %02X.", xResult ) ); - } - - return lFinalResult; -} - -/*-----------------------------------------------------------*/ - -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - BaseType_t socketStatus = 0; - - if( ( pNetworkContext == NULL ) || - ( pNetworkContext->pParams == NULL ) || - ( pHostName == NULL ) || - ( pNetworkCredentials == NULL ) ) - { - LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " - "pHostName=%p, pNetworkCredentials=%p.", - pNetworkContext, - pHostName, - pNetworkCredentials ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - else if( ( pNetworkCredentials->pRootCa == NULL ) ) - { - LogError( ( "pRootCa cannot be NULL." ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - else - { - /* Empty else for MISRA 15.7 compliance. */ - } - - /* Establish a TCP connection with the server. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - pTlsTransportParams = pNetworkContext->pParams; - socketStatus = Sockets_Connect( &( pTlsTransportParams->tcpSocket ), - pHostName, - port, - receiveTimeoutMs, - sendTimeoutMs ); - - if( socketStatus != 0 ) - { - LogError( ( "Failed to connect to %s with error %d.", - pHostName, - socketStatus ) ); - returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; - } - } - - /* Initialize mbedtls. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = initMbedtls(); - } - - /* Perform TLS handshake. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); - } - - /* Clean up on failure. */ - if( returnStatus != TLS_TRANSPORT_SUCCESS ) - { - if( ( pNetworkContext != NULL ) && - ( pTlsTransportParams->tcpSocket != FREERTOS_INVALID_SOCKET ) ) - { - ( void ) FreeRTOS_closesocket( pTlsTransportParams->tcpSocket ); - } - } - else - { - LogInfo( ( "(Network connection %p) Connection to %s established.", - pNetworkContext, - pHostName ) ); - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - BaseType_t tlsStatus = 0; - - if( pNetworkContext != NULL && pNetworkContext->pParams != NULL ) - { - pTlsTransportParams = pNetworkContext->pParams; - /* Attempting to terminate TLS connection. */ - tlsStatus = ( BaseType_t ) mbedtls_ssl_close_notify( &( pTlsTransportParams->sslContext.context ) ); - - /* Ignore the WANT_READ and WANT_WRITE return values. */ - if( ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_READ ) && - ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - if( tlsStatus == 0 ) - { - LogInfo( ( "(Network connection %p) TLS close-notify sent.", - pNetworkContext ) ); - } - else - { - LogError( ( "(Network connection %p) Failed to send TLS close-notify: mbedTLSError= %s : %s.", - pNetworkContext, - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - } - else - { - /* WANT_READ and WANT_WRITE can be ignored. Logging for debugging purposes. */ - LogInfo( ( "(Network connection %p) TLS close-notify sent; ", - "received %s as the TLS status can be ignored for close-notify." - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE", - pNetworkContext ) ); - } - - /* Call socket shutdown function to close connection. */ - Sockets_Disconnect( pTlsTransportParams->tcpSocket ); - - /* Free mbed TLS contexts. */ - sslContextFree( &( pTlsTransportParams->sslContext ) ); - } - - /* Clear the mutex functions for mbed TLS thread safety. */ - mbedtls_threading_free_alt(); -} - -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - int32_t tlsStatus = 0; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pTlsTransportParams = pNetworkContext->pParams; - tlsStatus = ( int32_t ) mbedtls_ssl_read( &( pTlsTransportParams->sslContext.context ), - pBuffer, - bytesToRecv ); - - if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - LogDebug( ( "Failed to read data. However, a read can be retried on this error. " - "mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - - /* Mark these set of errors as a timeout. The libraries may retry read - * on these errors. */ - tlsStatus = 0; - } - else if( tlsStatus < 0 ) - { - LogError( ( "Failed to read data: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - else - { - /* Empty else marker. */ - } - - return tlsStatus; -} - -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ) -{ - TlsTransportParams_t * pTlsTransportParams = NULL; - int32_t tlsStatus = 0; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pTlsTransportParams = pNetworkContext->pParams; - tlsStatus = ( int32_t ) mbedtls_ssl_write( &( pTlsTransportParams->sslContext.context ), - pBuffer, - bytesToSend ); - - if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || - ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) - { - LogDebug( ( "Failed to send data. However, send can be retried on this error. " - "mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - - /* Mark these set of errors as a timeout. The libraries may retry send - * on these errors. */ - tlsStatus = 0; - } - else if( tlsStatus < 0 ) - { - LogError( ( "Failed to send data: mbedTLSError= %s : %s.", - mbedtlsHighLevelCodeOrDefault( tlsStatus ), - mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); - } - else - { - /* Empty else marker. */ - } - - return tlsStatus; -} -/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h deleted file mode 100644 index 68bd50721..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * FreeRTOS V202107.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 tls_freertos_pkcs11.h - * @brief TLS transport interface header. - * @note This file is derived from the tls_freertos.h header file found in the mqtt - * section of IoT Libraries source code. The file has been modified to support using - * PKCS #11 when using TLS. - */ - -#ifndef USING_MBEDTLS_PKCS11 -#define USING_MBEDTLS_PKCS11 - -/**************************************************/ -/******* 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 Sockets. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "PkcsTlsTransport" -#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 ****************/ - -/* FreeRTOS+TCP include. */ -#include "FreeRTOS_Sockets.h" - -/* Transport interface include. */ -#include "transport_interface.h" - -/* mbed TLS includes. */ -#include "mbedtls/ctr_drbg.h" -#include "mbedtls/entropy.h" -#include "mbedtls/ssl.h" -#include "mbedtls/threading.h" -#include "mbedtls/x509.h" -#include "mbedtls/pk.h" -#include "mbedtls/pk_internal.h" -#include "mbedtls/error.h" - -/* PKCS #11 includes. */ -#include "core_pkcs11.h" - -/** - * @brief Secured connection context. - */ -typedef struct SSLContext -{ - mbedtls_ssl_config config; /**< @brief SSL connection configuration. */ - mbedtls_ssl_context context; /**< @brief SSL connection context */ - mbedtls_x509_crt_profile certProfile; /**< @brief Certificate security profile for this connection. */ - mbedtls_x509_crt rootCa; /**< @brief Root CA certificate context. */ - mbedtls_x509_crt clientCert; /**< @brief Client certificate context. */ - mbedtls_pk_context privKey; /**< @brief Client private key context. */ - mbedtls_pk_info_t privKeyInfo; /**< @brief Client private key info. */ - - /* PKCS#11. */ - CK_FUNCTION_LIST_PTR pxP11FunctionList; - CK_SESSION_HANDLE xP11Session; - CK_OBJECT_HANDLE xP11PrivateKey; - CK_KEY_TYPE xKeyType; -} SSLContext_t; - -/** - * @brief Definition of the network context for the transport interface - * implementation that uses mbedTLS and FreeRTOS+TLS sockets. - */ -typedef struct TlsTransportParams -{ - Socket_t tcpSocket; - SSLContext_t sslContext; -} TlsTransportParams_t; - -/** - * @brief Contains the credentials necessary for tls connection setup. - */ -typedef struct NetworkCredentials -{ - /** - * @brief To use ALPN, set this to a NULL-terminated list of supported - * protocols in decreasing order of preference. - * - * See [this link] - * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) - * for more information. - */ - const char ** pAlpnProtos; - - /** - * @brief Disable server name indication (SNI) for a TLS session. - */ - BaseType_t disableSni; - - const unsigned char * pRootCa; /**< @brief String representing a trusted server root certificate. */ - size_t rootCaSize; /**< @brief Size associated with #NetworkCredentials.pRootCa. */ - const unsigned char * pUserName; /**< @brief String representing the username for MQTT. */ - size_t userNameSize; /**< @brief Size associated with #NetworkCredentials.pUserName. */ - const unsigned char * pPassword; /**< @brief String representing the password for MQTT. */ - size_t passwordSize; /**< @brief Size associated with #NetworkCredentials.pPassword. */ -} NetworkCredentials_t; - -/** - * @brief TLS Connect / Disconnect return status. - */ -typedef enum TlsTransportStatus -{ - TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ - TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ - TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ - TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ - TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ - TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ - TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ -} TlsTransportStatus_t; - -/** - * @brief Create a TLS connection with FreeRTOS sockets. - * - * @param[out] pNetworkContext Pointer to a network context to contain the - * initialized socket handle. - * @param[in] pHostName The hostname of the remote endpoint. - * @param[in] port The destination port. - * @param[in] pNetworkCredentials Credentials for the TLS connection. - * @param[in] receiveTimeoutMs Receive socket timeout. - * @param[in] sendTimeoutMs Send socket timeout. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. - */ -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ); - -/** - * @brief Gracefully disconnect an established TLS connection. - * - * @param[in] pNetworkContext Network context. - */ -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); - -/** - * @brief Receives data from an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportRecv_t function. - * - * @param[in] pNetworkContext The Network context. - * @param[out] pBuffer Buffer to receive bytes into. - * @param[in] bytesToRecv Number of bytes to receive from the network. - * - * @return Number of bytes (> 0) received if successful; - * 0 if the socket times out without reading any bytes; - * negative value on error. - */ -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ); - -/** - * @brief Sends data over an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportSend_t function. - * - * @param[in] pNetworkContext The network context. - * @param[in] pBuffer Buffer containing the bytes to send. - * @param[in] bytesToSend Number of bytes to send from the buffer. - * - * @return Number of bytes (> 0) sent on success; - * 0 if the socket times out without sending any bytes; - * else a negative value to represent error. - */ -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ); - -#endif /* ifndef USING_MBEDTLS_PKCS11 */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.c deleted file mode 100644 index 62cdbb568..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * FreeRTOS V202107.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 - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" -#if ( configUSE_PREEMPTION == 0 ) - #include "task.h" -#endif - -/* FreeRTOS+TCP includes. */ -#include "FreeRTOS_IP.h" -#include "FreeRTOS_Sockets.h" - -/* FreeRTOS Socket wrapper include. */ -#include "sockets_wrapper.h" - -/* Transport interface include. */ -#include "using_plaintext.h" - -/*-----------------------------------------------------------*/ - -/** - * @brief Each compilation unit that consumes the NetworkContext must define it. - * It should contain a single pointer as seen below whenever the header file - * of this transport implementation is included to your project. - * - * @note When using multiple transports in the same compilation unit, - * define this pointer as void *. - */ -struct NetworkContext -{ - PlaintextTransportParams_t * pParams; -}; - -/*-----------------------------------------------------------*/ - -PlaintextTransportStatus_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ) -{ - PlaintextTransportParams_t * pPlaintextTransportParams = NULL; - PlaintextTransportStatus_t plaintextStatus = PLAINTEXT_TRANSPORT_SUCCESS; - BaseType_t socketStatus = 0; - - if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) || ( pHostName == NULL ) ) - { - LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " - "pHostName=%p.", - pNetworkContext, - pHostName ) ); - plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; - } - else - { - pPlaintextTransportParams = pNetworkContext->pParams; - /* Establish a TCP connection with the server. */ - socketStatus = Sockets_Connect( &( pPlaintextTransportParams->tcpSocket ), - pHostName, - port, - receiveTimeoutMs, - sendTimeoutMs ); - - /* A non zero status is an error. */ - if( socketStatus != 0 ) - { - LogError( ( "Failed to connect to %s with error %d.", - pHostName, - socketStatus ) ); - plaintextStatus = PLAINTEXT_TRANSPORT_CONNECT_FAILURE; - } - } - - return plaintextStatus; -} - -PlaintextTransportStatus_t Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext ) -{ - PlaintextTransportParams_t * pPlaintextTransportParams = NULL; - PlaintextTransportStatus_t plaintextStatus = PLAINTEXT_TRANSPORT_SUCCESS; - - if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) ) - { - LogError( ( "pNetworkContext cannot be NULL." ) ); - plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; - } - else if( pNetworkContext->pParams->tcpSocket == FREERTOS_INVALID_SOCKET ) - { - LogError( ( "pPlaintextTransportParams->tcpSocket cannot be an invalid socket." ) ); - plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; - } - else - { - pPlaintextTransportParams = pNetworkContext->pParams; - /* Call socket disconnect function to close connection. */ - Sockets_Disconnect( pPlaintextTransportParams->tcpSocket ); - } - - return plaintextStatus; -} - -int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ) -{ - PlaintextTransportParams_t * pPlaintextTransportParams = NULL; - int32_t socketStatus = 1; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pPlaintextTransportParams = pNetworkContext->pParams; - - /* The TCP socket may have a receive block time. If bytesToRecv is greater - * than 1 then a frame is likely already part way through reception and - * blocking to wait for the desired number of bytes to be available is the - * most efficient thing to do. If bytesToRecv is 1 then this may be a - * speculative call to read to find the start of a new frame, in which case - * blocking is not desirable as it could block an entire protocol agent - * task for the duration of the read block time and therefore negatively - * impact performance. So if bytesToRecv is 1 then don't call recv unless - * it is known that bytes are already available. */ - if( bytesToRecv == 1 ) - { - socketStatus = ( int32_t ) FreeRTOS_recvcount( pPlaintextTransportParams->tcpSocket ); - } - - if( socketStatus > 0 ) - { - socketStatus = FreeRTOS_recv( pPlaintextTransportParams->tcpSocket, - pBuffer, - bytesToRecv, - 0 ); - } - - return socketStatus; -} - -int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ) -{ - PlaintextTransportParams_t * pPlaintextTransportParams = NULL; - int32_t socketStatus = 0; - - configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); - - pPlaintextTransportParams = pNetworkContext->pParams; - socketStatus = FreeRTOS_send( pPlaintextTransportParams->tcpSocket, - pBuffer, - bytesToSend, - 0 ); - - if( socketStatus == -pdFREERTOS_ERRNO_ENOSPC ) - { - /* The TCP buffers could not accept any more bytes so zero bytes were sent. - * This is not necessarily an error that should cause a disconnect - * unless it persists. */ - socketStatus = 0; - } - - #if ( configUSE_PREEMPTION == 0 ) - { - /* FreeRTOS_send adds the packet to be sent to the IP task's queue for later processing. - * The packet is sent later by the IP task. When FreeRTOS is used in collaborative - * mode (i.e. configUSE_PREEMPTION is 0), call taskYIELD to give IP task a chance to run - * so that the packet is actually sent before this function returns. */ - taskYIELD(); - } - #endif - - return socketStatus; -} diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h deleted file mode 100644 index 10b2e2093..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * FreeRTOS V202107.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 USING_PLAINTEXT_H -#define USING_PLAINTEXT_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 Sockets. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "PlaintextTransport" -#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 ****************/ - -/* FreeRTOS+TCP include. */ -#include "FreeRTOS_Sockets.h" - -/* Transport interface include. */ -#include "transport_interface.h" - -/** - * @brief Parameters for the network context that uses FreeRTOS+TCP sockets. - */ -typedef struct PlaintextTransportParams -{ - Socket_t tcpSocket; -} PlaintextTransportParams_t; - -/** - * @brief Plain text transport Connect / Disconnect return status. - */ -typedef enum PlaintextTransportStatus -{ - PLAINTEXT_TRANSPORT_SUCCESS = 1, /**< Function successfully completed. */ - PLAINTEXT_TRANSPORT_INVALID_PARAMETER = 2, /**< At least one parameter was invalid. */ - PLAINTEXT_TRANSPORT_CONNECT_FAILURE = 3 /**< Initial connection to the server failed. */ -} PlaintextTransportStatus_t; - -/** - * @brief Create a TCP connection with FreeRTOS sockets. - * - * @param[out] pNetworkContext Pointer to a network context to contain the - * initialized socket handle. - * @param[in] pHostName The hostname of the remote endpoint. - * @param[in] port The destination port. - * @param[in] receiveTimeoutMs Receive socket timeout. - * - * @return #PLAINTEXT_TRANSPORT_SUCCESS, #PLAINTEXT_TRANSPORT_INVALID_PARAMETER, - * or #PLAINTEXT_TRANSPORT_CONNECT_FAILURE. - */ -PlaintextTransportStatus_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ); - -/** - * @brief Gracefully disconnect an established TCP connection. - * - * @param[in] pNetworkContext Network context containing the TCP socket handle. - * - * @return #PLAINTEXT_TRANSPORT_SUCCESS, or #PLAINTEXT_TRANSPORT_INVALID_PARAMETER. - */ -PlaintextTransportStatus_t Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext ); - -/** - * @brief Receives data from an established TCP connection. - * - * @note When the number of bytes requested is 1, the TCP socket's Rx stream - * is checked for available bytes to read. If there are none, this function - * immediately returns 0 without blocking. - * - * @param[in] pNetworkContext The network context containing the TCP socket - * handle. - * @param[out] pBuffer Buffer to receive bytes into. - * @param[in] bytesToRecv Number of bytes to receive from the network. - * - * @return Number of bytes received if successful; 0 if the socket times out; - * Negative value on error. - */ -int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ); - -/** - * @brief Sends data over an established TCP connection. - * - * @param[in] pNetworkContext The network context containing the TCP socket - * handle. - * @param[in] pBuffer Buffer containing the bytes to send. - * @param[in] bytesToSend Number of bytes to send from the buffer. - * - * @return Number of bytes sent on success; else a negative value. - */ -int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ); - -#endif /* ifndef USING_PLAINTEXT_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.c deleted file mode 100644 index 6c651f623..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - * FreeRTOS V202107.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 using_wolfSSL.c - * @brief TLS transport interface implementations. This implementation uses - * wolfSSL. - */ - -/* Standard includes. */ -#include - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" - -/* FreeRTOS+TCP includes. */ -#include "FreeRTOS_IP.h" -#include "FreeRTOS_Sockets.h" - -/* TLS transport header. */ -#include "using_wolfSSL.h" - -/* FreeRTOS Socket wrapper include. */ -#include "sockets_wrapper.h" - - -/* wolfSSL user settings header */ -#include "user_settings.h" - -/* Demo Specific configs. */ -#include "demo_config.h" - -/** - * @brief Initialize the TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to initialize. - */ -static void sslContextInit( SSLContext_t * pSslContext ); - -/** - * @brief Free the TLS structures in a network connection. - * - * @param[in] pSslContext The SSL context to free. - */ -static void sslContextFree( SSLContext_t * pSslContext ); - -/** - * @brief Set up TLS on a TCP connection. - * - * @param[in] pNetworkContext Network context. - * @param[in] pHostName Remote host name, used for server name indication. - * @param[in] pNetworkCredentials TLS setup parameters. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, - const char * pHostName, - const NetworkCredentials_t * pNetworkCredentials ); - -/** - * @brief Initialize TLS component. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, or #TLS_TRANSPORT_INTERNAL_ERROR. - */ -static TlsTransportStatus_t initTLS( void ); - -/* - * @brief Receive date from the socket passed as the context - * - * @param[in] ssl WOLFSSL object. - * @param[in] buf Buffer for received data - * @param[in] sz Size to receive - * @param[in] context Socket to be received from - * - * @return received size( > 0 ), #WOLFSSL_CBIO_ERR_CONN_CLOSE, #WOLFSSL_CBIO_ERR_WANT_READ. - */ -static int wolfSSL_IORecvGlue( WOLFSSL * ssl, - char * buf, - int sz, - void * context ); - -/* - * @brief Send date to the socket passed as the context - * - * @param[in] ssl WOLFSSL object. - * @param[in] buf Buffer for data to be sent - * @param[in] sz Size to send - * @param[in] context Socket to be sent to - * - * @return received size( > 0 ), #WOLFSSL_CBIO_ERR_CONN_CLOSE, #WOLFSSL_CBIO_ERR_WANT_WRITE. - */ -static int wolfSSL_IOSendGlue( WOLFSSL * ssl, - char * buf, - int sz, - void * context ); - -/* - * @brief Load credentials from file/buffer - * - * @param[in] pNetCtx NetworkContext_t - * @param[in] pNetCred NetworkCredentials_t - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INVALID_CREDENTIALS. - */ -static TlsTransportStatus_t loadCredentials( NetworkContext_t * pNetCtx, - const NetworkCredentials_t * pNetCred ); - -/*-----------------------------------------------------------*/ -static int wolfSSL_IORecvGlue( WOLFSSL * ssl, - char * buf, - int sz, - void * context ) -{ - ( void ) ssl; /* to prevent unused warning*/ - BaseType_t read = 0; - - Socket_t xSocket = ( Socket_t ) context; - - - read = FreeRTOS_recv( xSocket, ( void * ) buf, ( size_t ) sz, 0 ); - - if( ( read == 0 ) || - ( read == -pdFREERTOS_ERRNO_EWOULDBLOCK ) ) - { - read = WOLFSSL_CBIO_ERR_WANT_READ; - } - else if( read == -pdFREERTOS_ERRNO_ENOTCONN ) - { - read = WOLFSSL_CBIO_ERR_CONN_CLOSE; - } - else - { - /* do nothing */ - } - - return ( int ) read; -} -/*-----------------------------------------------------------*/ - -static int wolfSSL_IOSendGlue( WOLFSSL * ssl, - char * buf, - int sz, - void * context ) -{ - ( void ) ssl; /* to prevent unused warning*/ - Socket_t xSocket = ( Socket_t ) context; - BaseType_t sent = FreeRTOS_send( xSocket, ( void * ) buf, ( size_t ) sz, 0 ); - - if( sent == -pdFREERTOS_ERRNO_EWOULDBLOCK ) - { - sent = WOLFSSL_CBIO_ERR_WANT_WRITE; - } - else if( sent == -pdFREERTOS_ERRNO_ENOTCONN ) - { - sent = WOLFSSL_CBIO_ERR_CONN_CLOSE; - } - else - { - /* do nothing */ - } - - return ( int ) sent; -} - -/*-----------------------------------------------------------*/ -static TlsTransportStatus_t initTLS( void ) -{ - /* initialize wolfSSL */ - wolfSSL_Init(); - - #ifdef DEBUG_WOLFSSL - wolfSSL_Debugging_ON(); - #endif - - return TLS_TRANSPORT_SUCCESS; -} - -/*-----------------------------------------------------------*/ -static TlsTransportStatus_t loadCredentials( NetworkContext_t * pNetCtx, - const NetworkCredentials_t * pNetCred ) -{ - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - - configASSERT( pNetCtx != NULL ); - configASSERT( pNetCred != NULL ); - - #if defined( democonfigCREDENTIALS_IN_BUFFER ) - if( wolfSSL_CTX_load_verify_buffer( pNetCtx->sslContext.ctx, - ( const byte * ) ( pNetCred->pRootCa ), ( long ) ( pNetCred->rootCaSize ), - SSL_FILETYPE_PEM ) == SSL_SUCCESS ) - { - if( wolfSSL_CTX_use_certificate_buffer( pNetCtx->sslContext.ctx, - ( const byte * ) ( pNetCred->pClientCert ), ( long ) ( pNetCred->clientCertSize ), - SSL_FILETYPE_PEM ) == SSL_SUCCESS ) - { - if( wolfSSL_CTX_use_PrivateKey_buffer( pNetCtx->sslContext.ctx, - ( const byte * ) ( pNetCred->pPrivateKey ), ( long ) ( pNetCred->privateKeySize ), - SSL_FILETYPE_PEM ) == SSL_SUCCESS ) - { - returnStatus = TLS_TRANSPORT_SUCCESS; - } - else - { - LogError( ( "Failed to load client-private-key from buffer" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - } - else - { - LogError( ( "Failed to load client-certificate from buffer" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - } - else - { - LogError( ( "Failed to load ca-certificate from buffer" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - - return returnStatus; - #else /* if defined( democonfigCREDENTIALS_IN_BUFFER ) */ - if( wolfSSL_CTX_load_verify_locations( pNetCtx->sslContext.ctx, - ( const char * ) ( pNetCred->pRootCa ), NULL ) == SSL_SUCCESS ) - { - if( wolfSSL_CTX_use_certificate_file( pNetCtx->sslContext.ctx, - ( const char * ) ( pNetCred->pClientCert ), SSL_FILETYPE_PEM ) - == SSL_SUCCESS ) - { - if( wolfSSL_CTX_use_PrivateKey_file( pNetCtx->sslContext.ctx, - ( const char * ) ( pNetCred->pPrivateKey ), SSL_FILETYPE_PEM ) - == SSL_SUCCESS ) - { - returnStatus = TLS_TRANSPORT_SUCCESS; - } - else - { - LogError( ( "Failed to load client-private-key file" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - } - else - { - LogError( ( "Failed to load client-certificate file" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - } - else - { - LogError( ( "Failed to load ca-certificate file" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - return returnStatus; - #endif /* if defined( democonfigCREDENTIALS_IN_BUFFER ) */ -} - -/*-----------------------------------------------------------*/ - -static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetCtx, - const char * pHostName, - const NetworkCredentials_t * pNetCred ) -{ - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - Socket_t xSocket = { 0 }; - - configASSERT( pNetCtx != NULL ); - configASSERT( pHostName != NULL ); - configASSERT( pNetCred != NULL ); - configASSERT( pNetCred->pRootCa != NULL ); - configASSERT( pNetCtx->tcpSocket != NULL ); - - if( pNetCtx->sslContext.ctx == NULL ) - { - /* Attempt to create a context that uses the TLS 1.3 or 1.2 */ - pNetCtx->sslContext.ctx = - wolfSSL_CTX_new( wolfSSLv23_client_method_ex( NULL ) ); - } - - if( pNetCtx->sslContext.ctx != NULL ) - { - /* load credentials from file */ - if( loadCredentials( pNetCtx, pNetCred ) == TLS_TRANSPORT_SUCCESS ) - { - /* create a ssl object */ - pNetCtx->sslContext.ssl = - wolfSSL_new( pNetCtx->sslContext.ctx ); - - if( pNetCtx->sslContext.ssl != NULL ) - { - xSocket = pNetCtx->tcpSocket; - - /* set Recv/Send glue functions to the WOLFSSL object */ - wolfSSL_SSLSetIORecv( pNetCtx->sslContext.ssl, - wolfSSL_IORecvGlue ); - wolfSSL_SSLSetIOSend( pNetCtx->sslContext.ssl, - wolfSSL_IOSendGlue ); - - /* set socket as a context of read/send glue funcs */ - wolfSSL_SetIOReadCtx( pNetCtx->sslContext.ssl, xSocket ); - wolfSSL_SetIOWriteCtx( pNetCtx->sslContext.ssl, xSocket ); - - /* let wolfSSL perform tls handshake */ - if( wolfSSL_connect( pNetCtx->sslContext.ssl ) - == SSL_SUCCESS ) - { - returnStatus = TLS_TRANSPORT_SUCCESS; - } - else - { - wolfSSL_shutdown( pNetCtx->sslContext.ssl ); - wolfSSL_free( pNetCtx->sslContext.ssl ); - pNetCtx->sslContext.ssl = NULL; - wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); - pNetCtx->sslContext.ctx = NULL; - - LogError( ( "Failed to establish a TLS connection" ) ); - returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; - } - } - else - { - wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); - pNetCtx->sslContext.ctx = NULL; - - LogError( ( "Failed to create wolfSSL object" ) ); - returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; - } - } - else - { - wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); - pNetCtx->sslContext.ctx = NULL; - - LogError( ( "Failed to load credentials" ) ); - returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; - } - } - else - { - LogError( ( "Failed to create a wolfSSL_CTX" ) ); - returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - - -/*-----------------------------------------------------------*/ - -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ) -{ - TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; - BaseType_t socketStatus = 0; - - - if( ( pNetworkContext == NULL ) || - ( pHostName == NULL ) || - ( pNetworkCredentials == NULL ) ) - { - LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " - "pHostName=%p, pNetworkCredentials=%p.", - pNetworkContext, - pHostName, - pNetworkCredentials ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - else if( ( pNetworkCredentials->pRootCa == NULL ) ) - { - LogError( ( "pRootCa cannot be NULL." ) ); - returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; - } - - /* Establish a TCP connection with the server. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - socketStatus = Sockets_Connect( &( pNetworkContext->tcpSocket ), - pHostName, - port, - receiveTimeoutMs, - sendTimeoutMs ); - - if( socketStatus != 0 ) - { - LogError( ( "Failed to connect to %s with error %d.", - pHostName, - socketStatus ) ); - returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; - } - } - - /* Initialize tls. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = initTLS(); - } - - /* Perform TLS handshake. */ - if( returnStatus == TLS_TRANSPORT_SUCCESS ) - { - returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); - } - - /* Clean up on failure. */ - if( returnStatus != TLS_TRANSPORT_SUCCESS ) - { - if( pNetworkContext->tcpSocket != FREERTOS_INVALID_SOCKET ) - { - FreeRTOS_closesocket( pNetworkContext->tcpSocket ); - } - } - else - { - LogInfo( ( "(Network connection %p) Connection to %s established.", - pNetworkContext, - pHostName ) ); - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) -{ - WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; - WOLFSSL_CTX * pCtx = NULL; - - /* shutdown an active TLS connection */ - wolfSSL_shutdown( pSsl ); - - /* cleanup WOLFSSL object */ - wolfSSL_free( pSsl ); - pNetworkContext->sslContext.ssl = NULL; - - /* Call socket shutdown function to close connection. */ - Sockets_Disconnect( pNetworkContext->tcpSocket ); - - /* free WOLFSSL_CTX object*/ - pCtx = pNetworkContext->sslContext.ctx; - - wolfSSL_CTX_free( pCtx ); - pNetworkContext->sslContext.ctx = NULL; - - wolfSSL_Cleanup(); -} - -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ) -{ - int32_t tlsStatus = 0; - int iResult = 0; - WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; - - iResult = wolfSSL_read( pSsl, pBuffer, bytesToRecv ); - - if( iResult > 0 ) - { - tlsStatus = iResult; - } - else if( wolfSSL_want_read( pSsl ) == 1 ) - { - tlsStatus = 0; - } - else - { - tlsStatus = wolfSSL_state( pSsl ); - LogError( ( "Error from wolfSSL_read %d : %s ", - iResult, wolfSSL_ERR_reason_error_string( tlsStatus ) ) ); - } - - return tlsStatus; -} - -/*-----------------------------------------------------------*/ - -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ) -{ - int32_t tlsStatus = 0; - int iResult = 0; - WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; - - iResult = wolfSSL_write( pSsl, pBuffer, bytesToSend ); - - if( iResult > 0 ) - { - tlsStatus = iResult; - } - else if( wolfSSL_want_write( pSsl ) == 1 ) - { - tlsStatus = 0; - } - else - { - tlsStatus = wolfSSL_state( pSsl ); - LogError( ( "Error from wolfSL_write %d : %s ", - iResult, wolfSSL_ERR_reason_error_string( tlsStatus ) ) ); - } - - return tlsStatus; -} -/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.h deleted file mode 100644 index 301fe35cf..000000000 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_wolfSSL/using_wolfSSL.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * FreeRTOS V202107.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 using_wolfSSL.h - * @brief TLS transport interface header. - */ - -#ifndef USING_WOLFSSL_H -#define USING_WOLFSSL_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 Sockets. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "TlsTransport" -#endif -#ifndef LIBRARY_LOG_LEVEL - #define LIBRARY_LOG_LEVEL LOG_INFO -#endif - -#include "logging_stack.h" - -/************ End of logging configuration ****************/ - -/* FreeRTOS+TCP include. */ -#include "FreeRTOS_Sockets.h" - -/* Transport interface include. */ -#include "transport_interface.h" - -/* wolfSSL interface include. */ -#include "wolfssl/ssl.h" - -/** - * @brief Secured connection context. - */ -typedef struct SSLContext -{ - WOLFSSL_CTX* ctx; /**< @brief wolfSSL context */ - WOLFSSL* ssl; /**< @brief wolfSSL ssl session context */ -} SSLContext_t; - -/** - * @brief Definition of the network context for the transport interface - * implementation that uses mbedTLS and FreeRTOS+TLS sockets. - */ -struct NetworkContext -{ - Socket_t tcpSocket; - SSLContext_t sslContext; -}; - -/** - * @brief Contains the credentials necessary for tls connection setup. - */ -typedef struct NetworkCredentials -{ - /** - * @brief Set this to a non-NULL value to use ALPN. - * - * This string must be NULL-terminated. - * - * See [this link] - * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) - * for more information. - */ - const char * pAlpnProtos; - - /** - * @brief Disable server name indication (SNI) for a TLS session. - */ - BaseType_t disableSni; - - const unsigned char * pRootCa; /**< @brief String representing a trusted server root certificate. */ - size_t rootCaSize; /**< @brief Size associated with #IotNetworkCredentials.pRootCa. */ - const unsigned char * pClientCert; /**< @brief String representing the client certificate. */ - size_t clientCertSize; /**< @brief Size associated with #IotNetworkCredentials.pClientCert. */ - const unsigned char * pPrivateKey; /**< @brief String representing the client certificate's private key. */ - size_t privateKeySize; /**< @brief Size associated with #IotNetworkCredentials.pPrivateKey. */ - const unsigned char * pUserName; /**< @brief String representing the username for MQTT. */ - size_t userNameSize; /**< @brief Size associated with #IotNetworkCredentials.pUserName. */ - const unsigned char * pPassword; /**< @brief String representing the password for MQTT. */ - size_t passwordSize; /**< @brief Size associated with #IotNetworkCredentials.pPassword. */ -} NetworkCredentials_t; - -/** - * @brief TLS Connect / Disconnect return status. - */ -typedef enum TlsTransportStatus -{ - TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ - TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ - TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ - TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ - TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ - TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ - TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ -} TlsTransportStatus_t; - -/** - * @brief Create a TLS connection with FreeRTOS sockets. - * - * @param[out] pNetworkContext Pointer to a network context to contain the - * initialized socket handle. - * @param[in] pHostName The hostname of the remote endpoint. - * @param[in] port The destination port. - * @param[in] pNetworkCredentials Credentials for the TLS connection. - * @param[in] receiveTimeoutMs Receive socket timeout. - * @param[in] sendTimeoutMs Send socket timeout. - * - * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, - * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. - */ -TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, - const char * pHostName, - uint16_t port, - const NetworkCredentials_t * pNetworkCredentials, - uint32_t receiveTimeoutMs, - uint32_t sendTimeoutMs ); - -/** - * @brief Gracefully disconnect an established TLS connection. - * - * @param[in] pNetworkContext Network context. - */ -void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); - -/** - * @brief Receives data from an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportRecv_t function. - * - * @param[in] pNetworkContext The Network context. - * @param[out] pBuffer Buffer to receive bytes into. - * @param[in] bytesToRecv Number of bytes to receive from the network. - * - * @return Number of bytes (> 0) received if successful; - * 0 if the socket times out without reading any bytes; - * negative value on error. - */ -int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, - void * pBuffer, - size_t bytesToRecv ); - -/** - * @brief Sends data over an established TLS connection. - * - * This is the TLS version of the transport interface's - * #TransportSend_t function. - * - * @param[in] pNetworkContext The network context. - * @param[in] pBuffer Buffer containing the bytes to send. - * @param[in] bytesToSend Number of bytes to send from the buffer. - * - * @return Number of bytes (> 0) sent on success; - * 0 if the socket times out without sending any bytes; - * else a negative value to represent error. - */ -int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, - const void * pBuffer, - size_t bytesToSend ); - -#endif /* ifndef USING_WOLFSSL_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.c new file mode 100644 index 000000000..c335e75c5 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.c @@ -0,0 +1,931 @@ +/* + * Amazon FreeRTOS CELLULAR Preview Release + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/* Standard includes. */ +#include +#include +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "event_groups.h" + +/* Sockets wrapper includes. */ +#include "sockets_wrapper.h" + +/* FreeRTOS Cellular Library api includes. */ +#include "cellular_config.h" +#include "cellular_config_defaults.h" +#include "cellular_api.h" + +/* Configure logs for the functions in this file. */ +#include "logging_levels.h" +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "CELLULAR_SOCKETS" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#endif +#include "logging_stack.h" + +/*-----------------------------------------------------------*/ + +/* Cellular socket wrapper needs application provide the cellular handle and pdn context id. */ +/* User of cellular socket wrapper should provide this variable. */ +/* coverity[misra_c_2012_rule_8_6_violation] */ +extern CellularHandle_t CellularHandle; + +/* User of cellular socket wrapper should provide this variable. */ +/* coverity[misra_c_2012_rule_8_6_violation] */ +extern uint8_t CellularSocketPdnContextId; + +/*-----------------------------------------------------------*/ + +/* Windows simulator implementation. */ +#if defined( _WIN32 ) || defined( _WIN64 ) + #define strtok_r strtok_s +#endif + +#define CELLULAR_SOCKET_OPEN_FLAG ( 1UL << 0 ) +#define CELLULAR_SOCKET_CONNECT_FLAG ( 1UL << 1 ) + +#define SOCKET_DATA_RECEIVED_CALLBACK_BIT ( 0x00000001U ) +#define SOCKET_OPEN_CALLBACK_BIT ( 0x00000002U ) +#define SOCKET_OPEN_FAILED_CALLBACK_BIT ( 0x00000004U ) +#define SOCKET_CLOSE_CALLBACK_BIT ( 0x00000008U ) + +/* Ticks MS conversion macros. */ +#define TICKS_TO_MS( xTicks ) ( ( ( xTicks ) * 1000U ) / ( ( uint32_t ) configTICK_RATE_HZ ) ) +#define UINT32_MAX_DELAY_MS ( 0xFFFFFFFFUL ) +#define UINT32_MAX_MS_TICKS ( UINT32_MAX_DELAY_MS / ( TICKS_TO_MS( 1U ) ) ) + +/* Cellular socket access mode. */ +#define CELLULAR_SOCKET_ACCESS_MODE CELLULAR_ACCESSMODE_BUFFER + +/* Cellular socket open timeout. */ +#define CELLULAR_SOCKET_OPEN_TIMEOUT_TICKS ( portMAX_DELAY ) +#define CELLULAR_SOCKET_CLOSE_TIMEOUT_TICKS ( pdMS_TO_TICKS( 10000U ) ) + +/* Cellular socket AT command timeout. */ +#define CELLULAR_SOCKET_RECV_TIMEOUT_MS ( 1000UL ) + +/* Time conversion constants. */ +#define _MILLISECONDS_PER_SECOND ( 1000 ) /**< @brief Milliseconds per second. */ +#define _MILLISECONDS_PER_TICK ( _MILLISECONDS_PER_SECOND / configTICK_RATE_HZ ) /**< Milliseconds per FreeRTOS tick. */ + +/* Logging macros definition. */ +#define IotLogError( ... ) LogError( ( __VA_ARGS__ ) ) +#define IotLogWarn( ... ) LogWarn( ( __VA_ARGS__ ) ) +#define IotLogInfo( ... ) LogInfo( ( __VA_ARGS__ ) ) +#define IotLogDebug( ... ) LogDebug( ( __VA_ARGS__ ) ) + +/*-----------------------------------------------------------*/ + +typedef struct xSOCKET +{ + CellularSocketHandle_t cellularSocketHandle; + uint32_t ulFlags; + + TickType_t receiveTimeout; + TickType_t sendTimeout; + + EventGroupHandle_t socketEventGroupHandle; +} cellularSocketWrapper_t; + +/*-----------------------------------------------------------*/ + +/** + * @brief Get the count of milliseconds since vTaskStartScheduler was called. + * + * @return The count of milliseconds since vTaskStartScheduler was called. + */ +static uint64_t getTimeMs( void ); + +/** + * @brief Receive data from cellular socket. + * + * @param[in] pCellularSocketContext Cellular socket wrapper context for socket operations. + * @param[out] buf The data buffer for receiving data. + * @param[in] len The length of the data buffer + * + * @note This function receives data. It returns when non-zero bytes of data is received, + * when an error occurs, or when timeout occurs. Receive timeout unit is TickType_t. + * Any timeout value bigger than portMAX_DELAY will be regarded as portMAX_DELAY. + * In this case, this function waits portMAX_DELAY until non-zero bytes of data is received + * or until an error occurs. + * + * @return Positive value indicate the number of bytes received. Otherwise, error code defined + * in sockets_wrapper.h is returned. + */ +static BaseType_t prvNetworkRecvCellular( const cellularSocketWrapper_t * pCellularSocketContext, + uint8_t * buf, + size_t len ); + +/** + * @brief Callback used to inform about the status of socket open. + * + * @param[in] urcEvent URC Event that happened. + * @param[in] socketHandle Socket handle for which data is ready. + * @param[in] pCallbackContext pCallbackContext parameter in + * Cellular_SocketRegisterSocketOpenCallback function. + */ +static void prvCellularSocketOpenCallback( CellularUrcEvent_t urcEvent, + CellularSocketHandle_t socketHandle, + void * pCallbackContext ); + +/** + * @brief Callback used to inform that data is ready for reading on a socket. + * + * @param[in] socketHandle Socket handle for which data is ready. + * @param[in] pCallbackContext pCallbackContext parameter in + * Cellular_SocketRegisterDataReadyCallback function. + */ +static void prvCellularSocketDataReadyCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ); + + +/** + * @brief Callback used to inform that remote end closed the connection for a + * connected socket. + * + * @param[in] socketHandle Socket handle for which remote end closed the + * connection. + * @param[in] pCallbackContext pCallbackContext parameter in + * Cellular_SocketRegisterClosedCallback function. + */ +static void prvCellularSocketClosedCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ); + +/** + * @brief Setup socket receive timeout. + * + * @param[in] pCellularSocketContext Cellular socket wrapper context for socket operations. + * @param[out] receiveTimeout Socket receive timeout in TickType_t. + * + * @return On success, SOCKETS_ERROR_NONE is returned. If an error occurred, error code defined + * in sockets_wrapper.h is returned. + */ +static BaseType_t prvSetupSocketRecvTimeout( cellularSocketWrapper_t * pCellularSocketContext, + TickType_t receiveTimeout ); + +/** + * @brief Setup socket send timeout. + * + * @param[in] pCellularSocketContext Cellular socket wrapper context for socket operations. + * @param[out] sendTimeout Socket send timeout in TickType_t. + * + * @note Send timeout unit is TickType_t. The underlying cellular API uses miliseconds for timeout. + * Any send timeout greater than UINT32_MAX_MS_TICKS( UINT32_MAX_DELAY_MS/MS_PER_TICKS ) or + * portMAX_DELAY is regarded as UINT32_MAX_DELAY_MS for cellular API. + * + * @return On success, SOCKETS_ERROR_NONE is returned. If an error occurred, error code defined + * in sockets_wrapper.h is returned. + */ +static BaseType_t prvSetupSocketSendTimeout( cellularSocketWrapper_t * pCellularSocketContext, + TickType_t sendTimeout ); + +/** + * @brief Setup cellular socket callback function. + * + * @param[in] CellularSocketHandle_t Cellular socket handle for cellular socket operations. + * @param[in] pCellularSocketContext Cellular socket wrapper context for socket operations. + * + * @return On success, SOCKETS_ERROR_NONE is returned. If an error occurred, error code defined + * in sockets_wrapper.h is returned. + */ +static BaseType_t prvCellularSocketRegisterCallback( CellularSocketHandle_t cellularSocketHandle, + cellularSocketWrapper_t * pCellularSocketContext ); + +/** + * @brief Calculate elapsed time from current time and input parameters. + * + * @param[in] entryTimeMs The entry time to be compared with current time. + * @param[in] timeoutValueMs Timeout value for the comparison between entry time and current time. + * @param[out] pElapsedTimeMs The elapsed time if timeout condition is true. + * + * @return True if the difference between entry time and current time is bigger or + * equal to timeoutValueMs. Otherwise, return false. + */ +static bool _calculateElapsedTime( uint64_t entryTimeMs, + uint32_t timeoutValueMs, + uint64_t * pElapsedTimeMs ); + +/*-----------------------------------------------------------*/ + +static uint64_t getTimeMs( void ) +{ + TimeOut_t xCurrentTime = { 0 }; + + /* This must be unsigned because the behavior of signed integer overflow is undefined. */ + uint64_t ullTickCount = 0ULL; + + /* Get the current tick count and overflow count. vTaskSetTimeOutState() + * is used to get these values because they are both static in tasks.c. */ + vTaskSetTimeOutState( &xCurrentTime ); + + /* Adjust the tick count for the number of times a TickType_t has overflowed. */ + ullTickCount = ( uint64_t ) ( xCurrentTime.xOverflowCount ) << ( sizeof( TickType_t ) * 8 ); + + /* Add the current tick count. */ + ullTickCount += xCurrentTime.xTimeOnEntering; + + /* Return the ticks converted to milliseconds. */ + return ullTickCount * _MILLISECONDS_PER_TICK; +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvNetworkRecvCellular( const cellularSocketWrapper_t * pCellularSocketContext, + uint8_t * buf, + size_t len ) +{ + CellularSocketHandle_t cellularSocketHandle = NULL; + BaseType_t retRecvLength = 0; + uint32_t recvLength = 0; + TickType_t recvTimeout = 0; + TickType_t recvStartTime = 0; + CellularError_t socketStatus = CELLULAR_SUCCESS; + EventBits_t waitEventBits = 0; + + cellularSocketHandle = pCellularSocketContext->cellularSocketHandle; + + if( pCellularSocketContext->receiveTimeout >= portMAX_DELAY ) + { + recvTimeout = portMAX_DELAY; + } + else + { + recvTimeout = pCellularSocketContext->receiveTimeout; + } + + recvStartTime = xTaskGetTickCount(); + + ( void ) xEventGroupClearBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_DATA_RECEIVED_CALLBACK_BIT ); + socketStatus = Cellular_SocketRecv( CellularHandle, cellularSocketHandle, buf, len, &recvLength ); + + /* Calculate remain recvTimeout. */ + if( recvTimeout != portMAX_DELAY ) + { + if( ( recvStartTime + recvTimeout ) > xTaskGetTickCount() ) + { + recvTimeout = recvTimeout - ( xTaskGetTickCount() - recvStartTime ); + } + else + { + recvTimeout = 0; + } + } + + if( ( socketStatus == CELLULAR_SUCCESS ) && ( recvLength == 0U ) && + ( recvTimeout != 0U ) ) + { + waitEventBits = xEventGroupWaitBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_DATA_RECEIVED_CALLBACK_BIT | SOCKET_CLOSE_CALLBACK_BIT, + pdTRUE, + pdFALSE, + recvTimeout ); + + if( ( waitEventBits & SOCKET_CLOSE_CALLBACK_BIT ) != 0U ) + { + socketStatus = CELLULAR_SOCKET_CLOSED; + } + else if( ( waitEventBits & SOCKET_DATA_RECEIVED_CALLBACK_BIT ) != 0U ) + { + socketStatus = Cellular_SocketRecv( CellularHandle, cellularSocketHandle, buf, len, &recvLength ); + } + else + { + IotLogInfo( "prvNetworkRecv timeout" ); + socketStatus = CELLULAR_SUCCESS; + recvLength = 0; + } + } + + if( socketStatus == CELLULAR_SUCCESS ) + { + retRecvLength = ( BaseType_t ) recvLength; + } + else + { + IotLogError( "prvNetworkRecv failed %d", socketStatus ); + retRecvLength = SOCKETS_SOCKET_ERROR; + } + + IotLogDebug( "prvNetworkRecv expect %d read %d", len, recvLength ); + return retRecvLength; +} + +/*-----------------------------------------------------------*/ + +static void prvCellularSocketOpenCallback( CellularUrcEvent_t urcEvent, + CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) pCallbackContext; + + ( void ) socketHandle; + + if( pCellularSocketContext != NULL ) + { + IotLogDebug( "Socket open callback on Socket %p %d %d.", + pCellularSocketContext, socketHandle, urcEvent ); + + if( urcEvent == CELLULAR_URC_SOCKET_OPENED ) + { + pCellularSocketContext->ulFlags = pCellularSocketContext->ulFlags | CELLULAR_SOCKET_CONNECT_FLAG; + ( void ) xEventGroupSetBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_OPEN_CALLBACK_BIT ); + } + else + { + /* Socket open failed. */ + ( void ) xEventGroupSetBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_OPEN_FAILED_CALLBACK_BIT ); + } + } + else + { + IotLogError( "Spurious socket open callback." ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvCellularSocketDataReadyCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) pCallbackContext; + + ( void ) socketHandle; + + if( pCellularSocketContext != NULL ) + { + IotLogDebug( "Data ready on Socket %p", pCellularSocketContext ); + ( void ) xEventGroupSetBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_DATA_RECEIVED_CALLBACK_BIT ); + } + else + { + IotLogError( "spurious data callback" ); + } +} + +/*-----------------------------------------------------------*/ + +static void prvCellularSocketClosedCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) pCallbackContext; + + ( void ) socketHandle; + + if( pCellularSocketContext != NULL ) + { + IotLogInfo( "Socket Close on Socket %p", pCellularSocketContext ); + pCellularSocketContext->ulFlags = pCellularSocketContext->ulFlags & ( ~CELLULAR_SOCKET_CONNECT_FLAG ); + ( void ) xEventGroupSetBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_CLOSE_CALLBACK_BIT ); + } + else + { + IotLogError( "spurious socket close callback" ); + } +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvSetupSocketRecvTimeout( cellularSocketWrapper_t * pCellularSocketContext, + TickType_t receiveTimeout ) +{ + BaseType_t retSetSockOpt = SOCKETS_ERROR_NONE; + + if( pCellularSocketContext == NULL ) + { + retSetSockOpt = SOCKETS_EINVAL; + } + else + { + if( receiveTimeout >= portMAX_DELAY ) + { + pCellularSocketContext->receiveTimeout = portMAX_DELAY; + } + else + { + pCellularSocketContext->receiveTimeout = receiveTimeout; + } + } + + return retSetSockOpt; +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvSetupSocketSendTimeout( cellularSocketWrapper_t * pCellularSocketContext, + TickType_t sendTimeout ) +{ + CellularError_t socketStatus = CELLULAR_SUCCESS; + BaseType_t retSetSockOpt = SOCKETS_ERROR_NONE; + uint32_t sendTimeoutMs = 0; + CellularSocketHandle_t cellularSocketHandle = NULL; + + if( pCellularSocketContext == NULL ) + { + retSetSockOpt = SOCKETS_EINVAL; + } + else + { + cellularSocketHandle = pCellularSocketContext->cellularSocketHandle; + + if( sendTimeout >= UINT32_MAX_MS_TICKS ) + { + /* Check if the ticks cause overflow. */ + pCellularSocketContext->sendTimeout = portMAX_DELAY; + sendTimeoutMs = UINT32_MAX_DELAY_MS; + } + else if( sendTimeout >= portMAX_DELAY ) + { + IotLogWarn( "Sendtimeout %d longer than portMAX_DELAY, %d ms is used instead", + sendTimeout, UINT32_MAX_DELAY_MS ); + pCellularSocketContext->sendTimeout = portMAX_DELAY; + sendTimeoutMs = UINT32_MAX_DELAY_MS; + } + else + { + pCellularSocketContext->sendTimeout = sendTimeout; + sendTimeoutMs = TICKS_TO_MS( sendTimeout ); + } + + socketStatus = Cellular_SocketSetSockOpt( CellularHandle, + cellularSocketHandle, + CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT, + CELLULAR_SOCKET_OPTION_SEND_TIMEOUT, + ( const uint8_t * ) &sendTimeoutMs, + sizeof( uint32_t ) ); + + if( socketStatus != CELLULAR_SUCCESS ) + { + retSetSockOpt = SOCKETS_EINVAL; + } + } + + return retSetSockOpt; +} + +/*-----------------------------------------------------------*/ + +static BaseType_t prvCellularSocketRegisterCallback( CellularSocketHandle_t cellularSocketHandle, + cellularSocketWrapper_t * pCellularSocketContext ) +{ + BaseType_t retRegCallback = SOCKETS_ERROR_NONE; + CellularError_t socketStatus = CELLULAR_SUCCESS; + + if( cellularSocketHandle == NULL ) + { + retRegCallback = SOCKETS_EINVAL; + } + + if( retRegCallback == SOCKETS_ERROR_NONE ) + { + socketStatus = Cellular_SocketRegisterDataReadyCallback( CellularHandle, cellularSocketHandle, + prvCellularSocketDataReadyCallback, ( void * ) pCellularSocketContext ); + + if( socketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to SocketRegisterDataReadyCallback. Socket status %d.", socketStatus ); + retRegCallback = SOCKETS_SOCKET_ERROR; + } + } + + if( retRegCallback == SOCKETS_ERROR_NONE ) + { + socketStatus = Cellular_SocketRegisterSocketOpenCallback( CellularHandle, cellularSocketHandle, + prvCellularSocketOpenCallback, ( void * ) pCellularSocketContext ); + + if( socketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to SocketRegisterSocketOpenCallbac. Socket status %d.", socketStatus ); + retRegCallback = SOCKETS_SOCKET_ERROR; + } + } + + if( retRegCallback == SOCKETS_ERROR_NONE ) + { + socketStatus = Cellular_SocketRegisterClosedCallback( CellularHandle, cellularSocketHandle, + prvCellularSocketClosedCallback, ( void * ) pCellularSocketContext ); + + if( socketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to SocketRegisterClosedCallback. Socket status %d.", socketStatus ); + retRegCallback = SOCKETS_SOCKET_ERROR; + } + } + + return retRegCallback; +} + +/*-----------------------------------------------------------*/ + +static bool _calculateElapsedTime( uint64_t entryTimeMs, + uint32_t timeoutValueMs, + uint64_t * pElapsedTimeMs ) +{ + uint64_t currentTimeMs = getTimeMs(); + bool isExpired = false; + + /* timeoutValueMs with UINT32_MAX_DELAY_MS means wait for ever, same behavior as freertos_plus_tcp. */ + if( timeoutValueMs == UINT32_MAX_DELAY_MS ) + { + isExpired = false; + } + + /* timeoutValueMs = 0 means none blocking mode. */ + else if( timeoutValueMs == 0U ) + { + isExpired = true; + } + else + { + *pElapsedTimeMs = currentTimeMs - entryTimeMs; + + if( ( currentTimeMs - entryTimeMs ) >= timeoutValueMs ) + { + isExpired = true; + } + else + { + isExpired = false; + } + } + + return isExpired; +} + +/*-----------------------------------------------------------*/ + +BaseType_t Sockets_Connect( Socket_t * pTcpSocket, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + CellularSocketHandle_t cellularSocketHandle = NULL; + cellularSocketWrapper_t * pCellularSocketContext = NULL; + CellularError_t cellularSocketStatus = CELLULAR_INVALID_HANDLE; + + CellularSocketAddress_t serverAddress = { 0 }; + EventBits_t waitEventBits = 0; + BaseType_t retConnect = SOCKETS_ERROR_NONE; + const uint32_t defaultReceiveTimeoutMs = CELLULAR_SOCKET_RECV_TIMEOUT_MS; + + /* Create a new TCP socket. */ + cellularSocketStatus = Cellular_CreateSocket( CellularHandle, + CellularSocketPdnContextId, + CELLULAR_SOCKET_DOMAIN_AF_INET, + CELLULAR_SOCKET_TYPE_STREAM, + CELLULAR_SOCKET_PROTOCOL_TCP, + &cellularSocketHandle ); + + if( cellularSocketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to create cellular sockets. %d", cellularSocketStatus ); + retConnect = SOCKETS_SOCKET_ERROR; + } + + /* Allocate socket context. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + pCellularSocketContext = pvPortMalloc( sizeof( cellularSocketWrapper_t ) ); + + if( pCellularSocketContext == NULL ) + { + IotLogError( "Failed to allocate new socket context." ); + ( void ) Cellular_SocketClose( CellularHandle, cellularSocketHandle ); + retConnect = SOCKETS_ENOMEM; + } + else + { + /* Initialize all the members to sane values. */ + IotLogDebug( "Created CELLULAR Socket %p.", pCellularSocketContext ); + ( void ) memset( pCellularSocketContext, 0, sizeof( cellularSocketWrapper_t ) ); + pCellularSocketContext->cellularSocketHandle = cellularSocketHandle; + pCellularSocketContext->ulFlags |= CELLULAR_SOCKET_OPEN_FLAG; + pCellularSocketContext->socketEventGroupHandle = NULL; + } + } + + /* Allocate event group for callback function. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + pCellularSocketContext->socketEventGroupHandle = xEventGroupCreate(); + + if( pCellularSocketContext->socketEventGroupHandle == NULL ) + { + IotLogError( "Failed create cellular socket eventGroupHandle %p.", pCellularSocketContext ); + retConnect = SOCKETS_ENOMEM; + } + } + + /* Register cellular socket callback function. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + serverAddress.ipAddress.ipAddressType = CELLULAR_IP_ADDRESS_V4; + strncpy( serverAddress.ipAddress.ipAddress, pHostName, CELLULAR_IP_ADDRESS_MAX_SIZE ); + serverAddress.port = port; + + IotLogDebug( "Ip address %s port %d\r\n", serverAddress.ipAddress.ipAddress, serverAddress.port ); + retConnect = prvCellularSocketRegisterCallback( cellularSocketHandle, pCellularSocketContext ); + } + + /* Setup cellular socket recv AT command default timeout. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + cellularSocketStatus = Cellular_SocketSetSockOpt( CellularHandle, + cellularSocketHandle, + CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT, + CELLULAR_SOCKET_OPTION_RECV_TIMEOUT, + ( const uint8_t * ) &defaultReceiveTimeoutMs, + sizeof( uint32_t ) ); + + if( cellularSocketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to setup cellular AT command receive timeout %d.", cellularSocketStatus ); + retConnect = SOCKETS_SOCKET_ERROR; + } + } + + /* Setup cellular socket send/recv timeout. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + retConnect = prvSetupSocketSendTimeout( pCellularSocketContext, pdMS_TO_TICKS( sendTimeoutMs ) ); + } + + if( retConnect == SOCKETS_ERROR_NONE ) + { + retConnect = prvSetupSocketRecvTimeout( pCellularSocketContext, pdMS_TO_TICKS( receiveTimeoutMs ) ); + } + + /* Cellular socket connect. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + ( void ) xEventGroupClearBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_DATA_RECEIVED_CALLBACK_BIT | SOCKET_OPEN_FAILED_CALLBACK_BIT ); + cellularSocketStatus = Cellular_SocketConnect( CellularHandle, cellularSocketHandle, CELLULAR_SOCKET_ACCESS_MODE, &serverAddress ); + + if( cellularSocketStatus != CELLULAR_SUCCESS ) + { + IotLogError( "Failed to establish new connection. Socket status %d.", cellularSocketStatus ); + retConnect = SOCKETS_SOCKET_ERROR; + } + } + + /* Wait the socket connection. */ + if( retConnect == SOCKETS_ERROR_NONE ) + { + waitEventBits = xEventGroupWaitBits( pCellularSocketContext->socketEventGroupHandle, + SOCKET_OPEN_CALLBACK_BIT | SOCKET_OPEN_FAILED_CALLBACK_BIT, + pdTRUE, + pdFALSE, + CELLULAR_SOCKET_OPEN_TIMEOUT_TICKS ); + + if( waitEventBits != SOCKET_OPEN_CALLBACK_BIT ) + { + IotLogError( "Socket connect timeout." ); + retConnect = SOCKETS_ENOTCONN; + } + } + + /* Cleanup the socket if any error. */ + if( retConnect != SOCKETS_ERROR_NONE ) + { + if( cellularSocketHandle != NULL ) + { + ( void ) Cellular_SocketClose( CellularHandle, cellularSocketHandle ); + ( void ) Cellular_SocketRegisterDataReadyCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + ( void ) Cellular_SocketRegisterSocketOpenCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + ( void ) Cellular_SocketRegisterClosedCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + + if( pCellularSocketContext != NULL ) + { + pCellularSocketContext->cellularSocketHandle = NULL; + } + } + + if( ( pCellularSocketContext != NULL ) && ( pCellularSocketContext->socketEventGroupHandle != NULL ) ) + { + vEventGroupDelete( pCellularSocketContext->socketEventGroupHandle ); + pCellularSocketContext->socketEventGroupHandle = NULL; + } + + if( pCellularSocketContext != NULL ) + { + vPortFree( pCellularSocketContext ); + pCellularSocketContext = NULL; + } + } + + *pTcpSocket = pCellularSocketContext; + + return retConnect; +} + +/*-----------------------------------------------------------*/ + +void Sockets_Disconnect( Socket_t xSocket ) +{ + int32_t retClose = SOCKETS_ERROR_NONE; + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) xSocket; + CellularSocketHandle_t cellularSocketHandle = NULL; + uint32_t recvLength = 0; + uint8_t buf[ 128 ] = { 0 }; + CellularError_t cellularSocketStatus = CELLULAR_SUCCESS; + + /* xSocket need to be check against SOCKET_INVALID_SOCKET. */ + /* coverity[misra_c_2012_rule_11_4_violation] */ + if( ( pCellularSocketContext == NULL ) || ( xSocket == SOCKETS_INVALID_SOCKET ) ) + { + IotLogError( "Invalid xSocket %p", pCellularSocketContext ); + retClose = SOCKETS_EINVAL; + } + else + { + cellularSocketHandle = pCellularSocketContext->cellularSocketHandle; + } + + if( retClose == SOCKETS_ERROR_NONE ) + { + if( cellularSocketHandle != NULL ) + { + /* Receive all the data before socket close. */ + do + { + recvLength = 0; + cellularSocketStatus = Cellular_SocketRecv( CellularHandle, cellularSocketHandle, buf, 128, &recvLength ); + IotLogDebug( "%u bytes received in close", recvLength ); + } while( ( recvLength != 0 ) && ( cellularSocketStatus == CELLULAR_SUCCESS ) ); + + /* Close sockets. */ + if( Cellular_SocketClose( CellularHandle, cellularSocketHandle ) != CELLULAR_SUCCESS ) + { + IotLogWarn( "Failed to destroy connection." ); + retClose = SOCKETS_SOCKET_ERROR; + } + + ( void ) Cellular_SocketRegisterDataReadyCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + ( void ) Cellular_SocketRegisterSocketOpenCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + ( void ) Cellular_SocketRegisterClosedCallback( CellularHandle, cellularSocketHandle, NULL, NULL ); + pCellularSocketContext->cellularSocketHandle = NULL; + } + + if( pCellularSocketContext->socketEventGroupHandle != NULL ) + { + vEventGroupDelete( pCellularSocketContext->socketEventGroupHandle ); + pCellularSocketContext->socketEventGroupHandle = NULL; + } + + vPortFree( pCellularSocketContext ); + } + + IotLogDebug( "Sockets close exit with code %d", retClose ); +} + +/*-----------------------------------------------------------*/ + +int32_t Sockets_Recv( Socket_t xSocket, + void * pvBuffer, + size_t xBufferLength ) +{ + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) xSocket; + uint8_t * buf = ( uint8_t * ) pvBuffer; + BaseType_t retRecvLength = 0; + + if( pCellularSocketContext == NULL ) + { + IotLogError( "Cellular prvNetworkRecv Invalid xSocket %p", pCellularSocketContext ); + retRecvLength = ( BaseType_t ) SOCKETS_EINVAL; + } + else if( ( ( pCellularSocketContext->ulFlags & CELLULAR_SOCKET_OPEN_FLAG ) == 0U ) || + ( ( pCellularSocketContext->ulFlags & CELLULAR_SOCKET_CONNECT_FLAG ) == 0U ) ) + { + IotLogError( "Cellular prvNetworkRecv Invalid xSocket flag %p %u", + pCellularSocketContext, pCellularSocketContext->ulFlags ); + retRecvLength = ( BaseType_t ) SOCKETS_ENOTCONN; + } + else + { + retRecvLength = ( BaseType_t ) prvNetworkRecvCellular( pCellularSocketContext, buf, xBufferLength ); + } + + return retRecvLength; +} + +/*-----------------------------------------------------------*/ + +/* This function sends the data until timeout or data is completely sent to server. + * Send timeout unit is TickType_t. Any timeout value greater than UINT32_MAX_MS_TICKS + * or portMAX_DELAY will be regarded as MAX delay. In this case, this function + * will not return until all bytes of data are sent successfully or until an error occurs. */ +int32_t Sockets_Send( Socket_t xSocket, + const void * pvBuffer, + size_t xDataLength ) +{ + uint8_t * buf = ( uint8_t * ) pvBuffer; + CellularSocketHandle_t cellularSocketHandle = NULL; + BaseType_t retSendLength = 0; + uint32_t sentLength = 0; + CellularError_t socketStatus = CELLULAR_SUCCESS; + cellularSocketWrapper_t * pCellularSocketContext = ( cellularSocketWrapper_t * ) xSocket; + uint32_t bytesToSend = xDataLength; + uint64_t entryTimeMs = getTimeMs(); + uint64_t elapsedTimeMs = 0; + uint32_t sendTimeoutMs = 0; + + if( pCellularSocketContext == NULL ) + { + IotLogError( "Cellular Sockets_Send Invalid xSocket %p", pCellularSocketContext ); + retSendLength = ( BaseType_t ) SOCKETS_SOCKET_ERROR; + } + else if( ( ( pCellularSocketContext->ulFlags & CELLULAR_SOCKET_OPEN_FLAG ) == 0U ) || + ( ( pCellularSocketContext->ulFlags & CELLULAR_SOCKET_CONNECT_FLAG ) == 0U ) ) + { + IotLogError( "Cellular Sockets_Send Invalid xSocket flag %p 0x%08x", + pCellularSocketContext, pCellularSocketContext->ulFlags ); + retSendLength = ( BaseType_t ) SOCKETS_SOCKET_ERROR; + } + else + { + cellularSocketHandle = pCellularSocketContext->cellularSocketHandle; + + /* Convert ticks to ms delay. */ + if( ( pCellularSocketContext->sendTimeout >= UINT32_MAX_MS_TICKS ) || ( pCellularSocketContext->sendTimeout >= portMAX_DELAY ) ) + { + /* Check if the ticks cause overflow. */ + sendTimeoutMs = UINT32_MAX_DELAY_MS; + } + else + { + sendTimeoutMs = TICKS_TO_MS( pCellularSocketContext->sendTimeout ); + } + + /* Loop sending data until data is sent completely or timeout. */ + while( bytesToSend > 0U ) + { + socketStatus = Cellular_SocketSend( CellularHandle, + cellularSocketHandle, + &buf[ retSendLength ], + bytesToSend, + &sentLength ); + + if( socketStatus == CELLULAR_SUCCESS ) + { + retSendLength = retSendLength + ( BaseType_t ) sentLength; + bytesToSend = bytesToSend - sentLength; + } + + /* Check socket status or timeout break. */ + if( ( socketStatus != CELLULAR_SUCCESS ) || + ( _calculateElapsedTime( entryTimeMs, sendTimeoutMs, &elapsedTimeMs ) ) ) + { + if( socketStatus == CELLULAR_SOCKET_CLOSED ) + { + /* Socket already closed. No data is sent. */ + retSendLength = 0; + } + else if( socketStatus != CELLULAR_SUCCESS ) + { + retSendLength = ( BaseType_t ) SOCKETS_SOCKET_ERROR; + } + + break; + } + } + + IotLogDebug( "Sockets_Send expect %d write %d", len, sentLength ); + } + + return retSendLength; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.h new file mode 100644 index 000000000..7a5368d23 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/cellular/sockets_wrapper.h @@ -0,0 +1,136 @@ +/* + * Amazon FreeRTOS CELLULAR Preview Release + * 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. + */ + +/** + * @file sockets_wrapper.h + * @brief FreeRTOS Sockets connect and disconnect function wrapper. + */ + +#ifndef SOCKETS_WRAPPER_H +#define SOCKETS_WRAPPER_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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "Sockets" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#endif + +#include "logging_stack.h" + +/************ End of logging configuration ****************/ + +#define SOCKETS_ERROR_NONE ( 0 ) /*!< No error. */ +#define SOCKETS_SOCKET_ERROR ( -1 ) /*!< Catch-all sockets error code. */ +#define SOCKETS_EWOULDBLOCK ( -11 ) /*!< A resource is temporarily unavailable. */ +#define SOCKETS_ENOMEM ( -12 ) /*!< Memory allocation failed. */ +#define SOCKETS_EINVAL ( -22 ) /*!< Invalid argument. */ +#define SOCKETS_ENOPROTOOPT ( -109 ) /*!< A bad option was specified . */ +#define SOCKETS_ENOTCONN ( -126 ) /*!< The supplied socket is not connected. */ +#define SOCKETS_EISCONN ( -127 ) /*!< The supplied socket is already connected. */ +#define SOCKETS_ECLOSED ( -128 ) /*!< The supplied socket has already been closed. */ +#define SOCKETS_PERIPHERAL_RESET ( -1006 ) /*!< Communications peripheral has been reset. */ + +#define SOCKETS_INVALID_SOCKET ( ( Socket_t ) ~0U ) + +struct xSOCKET; +typedef struct xSOCKET * Socket_t; /**< @brief Socket handle data type. */ + +/** + * @brief Establish a connection to server. + * + * @param[out] pTcpSocket The output parameter to return the created socket descriptor. + * @param[in] pHostName Server hostname to connect to. + * @param[in] pServerInfo Server port to connect to. + * @param[in] receiveTimeoutMs Timeout (in milliseconds) for transport receive. + * @param[in] sendTimeoutMs Timeout (in milliseconds) for transport send. + * + * @note A timeout of 0 means infinite timeout. + * + * @return Non-zero value on error, 0 on success. + */ +BaseType_t Sockets_Connect( Socket_t * pTcpSocket, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief End connection to server. + * + * @param[in] tcpSocket The socket descriptor. + */ +void Sockets_Disconnect( Socket_t tcpSocket ); + +/** + * @brief Transmit data to the remote socket. + * + * The socket must have already been created using a call to Sockets_Connect(). + * + * @param[in] xSocket The handle of the sending socket. + * @param[in] pvBuffer The buffer containing the data to be sent. + * @param[in] xDataLength The length of the data to be sent. + * + * @return + * * On success, the number of bytes actually sent is returned. + * * If an error occurred, a negative value is returned. @ref SocketsErrors + */ +int32_t Sockets_Send( Socket_t xSocket, + const void * pvBuffer, + size_t xDataLength ); + +/** + * @brief Receive data from a TCP socket. + * + * The socket must have already been created using a call to Sockets_Connect(). + * + * @param[in] xSocket The handle of the socket from which data is being received. + * @param[out] pvBuffer The buffer into which the received data will be placed. + * @param[in] xBufferLength The maximum number of bytes which can be received. + * pvBuffer must be at least xBufferLength bytes long. + * + * @return + * * If the receive was successful then the number of bytes received (placed in the + * buffer pointed to by pvBuffer) is returned. + * * If a timeout occurred before data could be received then 0 is returned (timeout + * is set using @ref SOCKETS_SO_RCVTIMEO). + * * If an error occurred, a negative value is returned. @ref SocketsErrors + */ +int32_t Sockets_Recv( Socket_t xSocket, + void * pvBuffer, + size_t xBufferLength ); + +#endif /* ifndef SOCKETS_WRAPPER_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.c new file mode 100644 index 000000000..7d07ae395 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.c @@ -0,0 +1,173 @@ +/* + * FreeRTOS V202107.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 sockets_wrapper.c + * @brief FreeRTOS Sockets connect and disconnect wrapper implementation. + */ + +/* Standard includes. */ +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" + +#include "sockets_wrapper.h" + +/*-----------------------------------------------------------*/ + +/* Maximum number of times to call FreeRTOS_recv when initiating a graceful shutdown. */ +#ifndef FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS + #define FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ( 3 ) +#endif + +/* A negative error code indicating a network failure. */ +#define FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR ( -1 ) + +/*-----------------------------------------------------------*/ + +BaseType_t Sockets_Connect( Socket_t * pTcpSocket, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + Socket_t tcpSocket = FREERTOS_INVALID_SOCKET; + BaseType_t socketStatus = 0; + struct freertos_sockaddr serverAddress = { 0 }; + TickType_t transportTimeout = 0; + + /* Create a new TCP socket. */ + tcpSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP ); + + if( tcpSocket == FREERTOS_INVALID_SOCKET ) + { + LogError( ( "Failed to create new socket." ) ); + socketStatus = FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR; + } + else + { + LogDebug( ( "Created new TCP socket." ) ); + + /* Connection parameters. */ + serverAddress.sin_family = FREERTOS_AF_INET; + serverAddress.sin_port = FreeRTOS_htons( port ); + serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); + serverAddress.sin_len = ( uint8_t ) sizeof( serverAddress ); + + /* Check for errors from DNS lookup. */ + if( serverAddress.sin_addr == 0U ) + { + LogError( ( "Failed to connect to server: DNS resolution failed: Hostname=%s.", + pHostName ) ); + socketStatus = FREERTOS_SOCKETS_WRAPPER_NETWORK_ERROR; + } + } + + if( socketStatus == 0 ) + { + /* Establish connection. */ + LogDebug( ( "Creating TCP Connection to %s.", pHostName ) ); + socketStatus = FreeRTOS_connect( tcpSocket, &serverAddress, sizeof( serverAddress ) ); + + if( socketStatus != 0 ) + { + LogError( ( "Failed to connect to server: FreeRTOS_Connect failed: ReturnCode=%d," + " Hostname=%s, Port=%u.", + socketStatus, + pHostName, + port ) ); + } + } + + if( socketStatus == 0 ) + { + /* Set socket receive timeout. */ + transportTimeout = pdMS_TO_TICKS( receiveTimeoutMs ); + /* Setting the receive block time cannot fail. */ + ( void ) FreeRTOS_setsockopt( tcpSocket, + 0, + FREERTOS_SO_RCVTIMEO, + &transportTimeout, + sizeof( TickType_t ) ); + + /* Set socket send timeout. */ + transportTimeout = pdMS_TO_TICKS( sendTimeoutMs ); + /* Setting the send block time cannot fail. */ + ( void ) FreeRTOS_setsockopt( tcpSocket, + 0, + FREERTOS_SO_SNDTIMEO, + &transportTimeout, + sizeof( TickType_t ) ); + } + + /* Clean up on failure. */ + if( socketStatus != 0 ) + { + if( tcpSocket != FREERTOS_INVALID_SOCKET ) + { + ( void ) FreeRTOS_closesocket( tcpSocket ); + } + } + else + { + /* Set the socket. */ + *pTcpSocket = tcpSocket; + LogInfo( ( "Established TCP connection with %s.", pHostName ) ); + } + + return socketStatus; +} + +/*-----------------------------------------------------------*/ + +void Sockets_Disconnect( Socket_t tcpSocket ) +{ + BaseType_t waitForShutdownLoopCount = 0; + uint8_t pDummyBuffer[ 2 ]; + + if( tcpSocket != FREERTOS_INVALID_SOCKET ) + { + /* Initiate graceful shutdown. */ + ( void ) FreeRTOS_shutdown( tcpSocket, FREERTOS_SHUT_RDWR ); + + /* Wait for the socket to disconnect gracefully (indicated by FreeRTOS_recv() + * returning a FREERTOS_EINVAL error) before closing the socket. */ + while( FreeRTOS_recv( tcpSocket, pDummyBuffer, sizeof( pDummyBuffer ), 0 ) >= 0 ) + { + /* We don't need to delay since FreeRTOS_recv should already have a timeout. */ + + if( ++waitForShutdownLoopCount >= FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ) + { + break; + } + } + + ( void ) FreeRTOS_closesocket( tcpSocket ); + } +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.h new file mode 100644 index 000000000..7ca28a949 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/sockets_wrapper/freertos_plus_tcp/sockets_wrapper.h @@ -0,0 +1,104 @@ +/* + * FreeRTOS V202107.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 sockets_wrapper.h + * @brief FreeRTOS Sockets connect and disconnect function wrapper. + */ + +#ifndef SOCKETS_WRAPPER_H +#define SOCKETS_WRAPPER_H + +/* FreeRTOS+TCP includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" +#include "FreeRTOS_DNS.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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "Sockets" +#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 Establish a connection to server. + * + * @param[out] pTcpSocket The output parameter to return the created socket descriptor. + * @param[in] pHostName Server hostname to connect to. + * @param[in] pServerInfo Server port to connect to. + * @param[in] receiveTimeoutMs Timeout (in milliseconds) for transport receive. + * @param[in] sendTimeoutMs Timeout (in milliseconds) for transport send. + * + * @note A timeout of 0 means infinite timeout. + * + * @return Non-zero value on error, 0 on success. + */ +BaseType_t Sockets_Connect( Socket_t * pTcpSocket, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief End connection to server. + * + * @param[in] tcpSocket The socket descriptor. + */ +void Sockets_Disconnect( Socket_t tcpSocket ); + +#endif /* ifndef SOCKETS_WRAPPER_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.c new file mode 100644 index 000000000..fff337e2a --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.c @@ -0,0 +1,851 @@ +/* + * FreeRTOS V202107.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 tls_freertos.c + * @brief TLS transport interface implementations. This implementation uses + * mbedTLS. + */ + +/* Standard includes. */ +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" + +/* FreeRTOS+TCP includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* TLS transport header. */ +#include "using_mbedtls.h" + +/* FreeRTOS Socket wrapper include. */ +#include "sockets_wrapper.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Each compilation unit that consumes the NetworkContext must define it. + * It should contain a single pointer as seen below whenever the header file + * of this transport implementation is included to your project. + * + * @note When using multiple transports in the same compilation unit, + * define this pointer as void *. + */ +struct NetworkContext +{ + TlsTransportParams_t * pParams; +}; + +/*-----------------------------------------------------------*/ + +/** + * @brief Represents string to be logged when mbedTLS returned error + * does not contain a high-level code. + */ +static const char * pNoHighLevelMbedTlsCodeStr = ""; + +/** + * @brief Represents string to be logged when mbedTLS returned error + * does not contain a low-level code. + */ +static const char * pNoLowLevelMbedTlsCodeStr = ""; + +/** + * @brief Utility for converting the high-level code in an mbedTLS error to string, + * if the code-contains a high-level code; otherwise, using a default string. + */ +#define mbedtlsHighLevelCodeOrDefault( mbedTlsCode ) \ + ( mbedtls_high_level_strerr( mbedTlsCode ) != NULL ) ? \ + mbedtls_high_level_strerr( mbedTlsCode ) : pNoHighLevelMbedTlsCodeStr + +/** + * @brief Utility for converting the level-level code in an mbedTLS error to string, + * if the code-contains a level-level code; otherwise, using a default string. + */ +#define mbedtlsLowLevelCodeOrDefault( mbedTlsCode ) \ + ( mbedtls_low_level_strerr( mbedTlsCode ) != NULL ) ? \ + mbedtls_low_level_strerr( mbedTlsCode ) : pNoLowLevelMbedTlsCodeStr + +/*-----------------------------------------------------------*/ + +/** + * @brief Initialize the mbed TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to initialize. + */ +static void sslContextInit( SSLContext_t * pSslContext ); + +/** + * @brief Free the mbed TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to free. + */ +static void sslContextFree( SSLContext_t * pSslContext ); + +/** + * @brief Add X509 certificate to the trusted list of root certificates. + * + * OpenSSL does not provide a single function for reading and loading certificates + * from files into stores, so the file API must be called. Start with the + * root certificate. + * + * @param[out] pSslContext SSL context to which the trusted server root CA is to be added. + * @param[in] pRootCa PEM-encoded string of the trusted server root CA. + * @param[in] rootCaSize Size of the trusted server root CA. + * + * @return 0 on success; otherwise, failure; + */ +static int32_t setRootCa( SSLContext_t * pSslContext, + const uint8_t * pRootCa, + size_t rootCaSize ); + +/** + * @brief Set X509 certificate as client certificate for the server to authenticate. + * + * @param[out] pSslContext SSL context to which the client certificate is to be set. + * @param[in] pClientCert PEM-encoded string of the client certificate. + * @param[in] clientCertSize Size of the client certificate. + * + * @return 0 on success; otherwise, failure; + */ +static int32_t setClientCertificate( SSLContext_t * pSslContext, + const uint8_t * pClientCert, + size_t clientCertSize ); + +/** + * @brief Set private key for the client's certificate. + * + * @param[out] pSslContext SSL context to which the private key is to be set. + * @param[in] pPrivateKey PEM-encoded string of the client private key. + * @param[in] privateKeySize Size of the client private key. + * + * @return 0 on success; otherwise, failure; + */ +static int32_t setPrivateKey( SSLContext_t * pSslContext, + const uint8_t * pPrivateKey, + size_t privateKeySize ); + +/** + * @brief Passes TLS credentials to the OpenSSL library. + * + * Provides the root CA certificate, client certificate, and private key to the + * OpenSSL library. If the client certificate or private key is not NULL, mutual + * authentication is used when performing the TLS handshake. + * + * @param[out] pSslContext SSL context to which the credentials are to be imported. + * @param[in] pNetworkCredentials TLS credentials to be imported. + * + * @return 0 on success; otherwise, failure; + */ +static int32_t setCredentials( SSLContext_t * pSslContext, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Set optional configurations for the TLS connection. + * + * This function is used to set SNI and ALPN protocols. + * + * @param[in] pSslContext SSL context to which the optional configurations are to be set. + * @param[in] pHostName Remote host name, used for server name indication. + * @param[in] pNetworkCredentials TLS setup parameters. + */ +static void setOptionalConfigurations( SSLContext_t * pSslContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Setup TLS by initializing contexts and setting configurations. + * + * @param[in] pNetworkContext Network context. + * @param[in] pHostName Remote host name, used for server name indication. + * @param[in] pNetworkCredentials TLS setup parameters. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Perform the TLS handshake on a TCP connection. + * + * @param[in] pNetworkContext Network context. + * @param[in] pNetworkCredentials TLS setup parameters. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t tlsHandshake( NetworkContext_t * pNetworkContext, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Initialize mbedTLS. + * + * @param[out] entropyContext mbed TLS entropy context for generation of random numbers. + * @param[out] ctrDrgbContext mbed TLS CTR DRBG context for generation of random numbers. + * + * @return #TLS_TRANSPORT_SUCCESS, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t initMbedtls( mbedtls_entropy_context * pEntropyContext, + mbedtls_ctr_drbg_context * pCtrDrgbContext ); + +/*-----------------------------------------------------------*/ + +static void sslContextInit( SSLContext_t * pSslContext ) +{ + configASSERT( pSslContext != NULL ); + + mbedtls_ssl_config_init( &( pSslContext->config ) ); + mbedtls_x509_crt_init( &( pSslContext->rootCa ) ); + mbedtls_pk_init( &( pSslContext->privKey ) ); + mbedtls_x509_crt_init( &( pSslContext->clientCert ) ); + mbedtls_ssl_init( &( pSslContext->context ) ); +} +/*-----------------------------------------------------------*/ + +static void sslContextFree( SSLContext_t * pSslContext ) +{ + configASSERT( pSslContext != NULL ); + + mbedtls_ssl_free( &( pSslContext->context ) ); + mbedtls_x509_crt_free( &( pSslContext->rootCa ) ); + mbedtls_x509_crt_free( &( pSslContext->clientCert ) ); + mbedtls_pk_free( &( pSslContext->privKey ) ); + mbedtls_entropy_free( &( pSslContext->entropyContext ) ); + mbedtls_ctr_drbg_free( &( pSslContext->ctrDrgbContext ) ); + mbedtls_ssl_config_free( &( pSslContext->config ) ); +} +/*-----------------------------------------------------------*/ + +static int32_t setRootCa( SSLContext_t * pSslContext, + const uint8_t * pRootCa, + size_t rootCaSize ) +{ + int32_t mbedtlsError = -1; + + configASSERT( pSslContext != NULL ); + configASSERT( pRootCa != NULL ); + + /* Parse the server root CA certificate into the SSL context. */ + mbedtlsError = mbedtls_x509_crt_parse( &( pSslContext->rootCa ), + pRootCa, + rootCaSize ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to parse server root CA certificate: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + else + { + mbedtls_ssl_conf_ca_chain( &( pSslContext->config ), + &( pSslContext->rootCa ), + NULL ); + } + + return mbedtlsError; +} +/*-----------------------------------------------------------*/ + +static int32_t setClientCertificate( SSLContext_t * pSslContext, + const uint8_t * pClientCert, + size_t clientCertSize ) +{ + int32_t mbedtlsError = -1; + + configASSERT( pSslContext != NULL ); + configASSERT( pClientCert != NULL ); + + /* Setup the client certificate. */ + mbedtlsError = mbedtls_x509_crt_parse( &( pSslContext->clientCert ), + pClientCert, + clientCertSize ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to parse the client certificate: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + + return mbedtlsError; +} +/*-----------------------------------------------------------*/ + +static int32_t setPrivateKey( SSLContext_t * pSslContext, + const uint8_t * pPrivateKey, + size_t privateKeySize ) +{ + int32_t mbedtlsError = -1; + + configASSERT( pSslContext != NULL ); + configASSERT( pPrivateKey != NULL ); + + /* Setup the client private key. */ + mbedtlsError = mbedtls_pk_parse_key( &( pSslContext->privKey ), + pPrivateKey, + privateKeySize, + NULL, + 0 ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to parse the client key: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + + return mbedtlsError; +} +/*-----------------------------------------------------------*/ + +static int32_t setCredentials( SSLContext_t * pSslContext, + const NetworkCredentials_t * pNetworkCredentials ) +{ + int32_t mbedtlsError = -1; + + configASSERT( pSslContext != NULL ); + configASSERT( pNetworkCredentials != NULL ); + + /* Set up the certificate security profile, starting from the default value. */ + pSslContext->certProfile = mbedtls_x509_crt_profile_default; + + /* Set SSL authmode and the RNG context. */ + mbedtls_ssl_conf_authmode( &( pSslContext->config ), + MBEDTLS_SSL_VERIFY_REQUIRED ); + mbedtls_ssl_conf_rng( &( pSslContext->config ), + mbedtls_ctr_drbg_random, + &( pSslContext->ctrDrgbContext ) ); + mbedtls_ssl_conf_cert_profile( &( pSslContext->config ), + &( pSslContext->certProfile ) ); + + mbedtlsError = setRootCa( pSslContext, + pNetworkCredentials->pRootCa, + pNetworkCredentials->rootCaSize ); + + if( ( pNetworkCredentials->pClientCert != NULL ) && + ( pNetworkCredentials->pPrivateKey != NULL ) ) + { + if( mbedtlsError == 0 ) + { + mbedtlsError = setClientCertificate( pSslContext, + pNetworkCredentials->pClientCert, + pNetworkCredentials->clientCertSize ); + } + + if( mbedtlsError == 0 ) + { + mbedtlsError = setPrivateKey( pSslContext, + pNetworkCredentials->pPrivateKey, + pNetworkCredentials->privateKeySize ); + } + + if( mbedtlsError == 0 ) + { + mbedtlsError = mbedtls_ssl_conf_own_cert( &( pSslContext->config ), + &( pSslContext->clientCert ), + &( pSslContext->privKey ) ); + } + } + + return mbedtlsError; +} +/*-----------------------------------------------------------*/ + +static void setOptionalConfigurations( SSLContext_t * pSslContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ) +{ + int32_t mbedtlsError = -1; + + configASSERT( pSslContext != NULL ); + configASSERT( pHostName != NULL ); + configASSERT( pNetworkCredentials != NULL ); + + if( pNetworkCredentials->pAlpnProtos != NULL ) + { + /* Include an application protocol list in the TLS ClientHello + * message. */ + mbedtlsError = mbedtls_ssl_conf_alpn_protocols( &( pSslContext->config ), + pNetworkCredentials->pAlpnProtos ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to configure ALPN protocol in mbed TLS: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + } + + /* Enable SNI if requested. */ + if( pNetworkCredentials->disableSni == pdFALSE ) + { + mbedtlsError = mbedtls_ssl_set_hostname( &( pSslContext->context ), + pHostName ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set server name: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + } + + /* Set Maximum Fragment Length if enabled. */ + #ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + + /* Enable the max fragment extension. 4096 bytes is currently the largest fragment size permitted. + * See RFC 8449 https://tools.ietf.org/html/rfc8449 for more information. + * + * Smaller values can be found in "mbedtls/include/ssl.h". + */ + mbedtlsError = mbedtls_ssl_conf_max_frag_len( &( pSslContext->config ), MBEDTLS_SSL_MAX_FRAG_LEN_4096 ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to maximum fragment length extension: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + } + #endif /* ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + int32_t mbedtlsError = 0; + + configASSERT( pNetworkContext != NULL ); + configASSERT( pNetworkContext->pParams != NULL ); + configASSERT( pHostName != NULL ); + configASSERT( pNetworkCredentials != NULL ); + configASSERT( pNetworkCredentials->pRootCa != NULL ); + + pTlsTransportParams = pNetworkContext->pParams; + /* Initialize the mbed TLS context structures. */ + sslContextInit( &( pTlsTransportParams->sslContext ) ); + + mbedtlsError = mbedtls_ssl_config_defaults( &( pTlsTransportParams->sslContext.config ), + MBEDTLS_SSL_IS_CLIENT, + MBEDTLS_SSL_TRANSPORT_STREAM, + MBEDTLS_SSL_PRESET_DEFAULT ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set default SSL configuration: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + /* Per mbed TLS docs, mbedtls_ssl_config_defaults only fails on memory allocation. */ + returnStatus = TLS_TRANSPORT_INSUFFICIENT_MEMORY; + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + mbedtlsError = setCredentials( &( pTlsTransportParams->sslContext ), + pNetworkCredentials ); + + if( mbedtlsError != 0 ) + { + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + else + { + /* Optionally set SNI and ALPN protocols. */ + setOptionalConfigurations( &( pTlsTransportParams->sslContext ), + pHostName, + pNetworkCredentials ); + } + } + + return returnStatus; +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t tlsHandshake( NetworkContext_t * pNetworkContext, + const NetworkCredentials_t * pNetworkCredentials ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + int32_t mbedtlsError = 0; + + configASSERT( pNetworkContext != NULL ); + configASSERT( pNetworkContext->pParams != NULL ); + configASSERT( pNetworkCredentials != NULL ); + + pTlsTransportParams = pNetworkContext->pParams; + /* Initialize the mbed TLS secured connection context. */ + mbedtlsError = mbedtls_ssl_setup( &( pTlsTransportParams->sslContext.context ), + &( pTlsTransportParams->sslContext.config ) ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set up mbed TLS SSL context: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + else + { + /* Set the underlying IO for the TLS connection. */ + + /* MISRA Rule 11.2 flags the following line for casting the second + * parameter to void *. This rule is suppressed because + * #mbedtls_ssl_set_bio requires the second parameter as void *. + */ + /* coverity[misra_c_2012_rule_11_2_violation] */ + + /* These two macros MBEDTLS_SSL_SEND and MBEDTLS_SSL_RECV need to be + * defined in mbedtls_config.h according to which implementation you use. + */ + mbedtls_ssl_set_bio( &( pTlsTransportParams->sslContext.context ), + ( void * ) pTlsTransportParams->tcpSocket, + MBEDTLS_SSL_SEND, + MBEDTLS_SSL_RECV, + NULL ); + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Perform the TLS handshake. */ + do + { + mbedtlsError = mbedtls_ssl_handshake( &( pTlsTransportParams->sslContext.context ) ); + } while( ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_READ ) || + ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_WRITE ) ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to perform TLS handshake: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; + } + else + { + LogInfo( ( "(Network connection %p) TLS handshake successful.", + pNetworkContext ) ); + } + } + + return returnStatus; +} +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t initMbedtls( mbedtls_entropy_context * pEntropyContext, + mbedtls_ctr_drbg_context * pCtrDrgbContext ) +{ + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + int32_t mbedtlsError = 0; + + /* Set the mutex functions for mbed TLS thread safety. */ + mbedtls_threading_set_alt( mbedtls_platform_mutex_init, + mbedtls_platform_mutex_free, + mbedtls_platform_mutex_lock, + mbedtls_platform_mutex_unlock ); + + /* Initialize contexts for random number generation. */ + mbedtls_entropy_init( pEntropyContext ); + mbedtls_ctr_drbg_init( pCtrDrgbContext ); + + /* Add a strong entropy source. At least one is required. */ + mbedtlsError = mbedtls_entropy_add_source( pEntropyContext, + mbedtls_platform_entropy_poll, + NULL, + 32, + MBEDTLS_ENTROPY_SOURCE_STRONG ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to add entropy source: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Seed the random number generator. */ + mbedtlsError = mbedtls_ctr_drbg_seed( pCtrDrgbContext, + mbedtls_entropy_func, + pEntropyContext, + NULL, + 0 ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to seed PRNG: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + LogDebug( ( "Successfully initialized mbedTLS." ) ); + } + + return returnStatus; +} +/*-----------------------------------------------------------*/ + +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + BaseType_t socketStatus = 0; + + if( ( pNetworkContext == NULL ) || + ( pNetworkContext->pParams == NULL ) || + ( pHostName == NULL ) || + ( pNetworkCredentials == NULL ) ) + { + LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " + "pHostName=%p, pNetworkCredentials=%p.", + pNetworkContext, + pHostName, + pNetworkCredentials ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + else if( ( pNetworkCredentials->pRootCa == NULL ) ) + { + LogError( ( "pRootCa cannot be NULL." ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + else + { + /* Empty else for MISRA 15.7 compliance. */ + } + + /* Establish a TCP connection with the server. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + pTlsTransportParams = pNetworkContext->pParams; + socketStatus = Sockets_Connect( &( pTlsTransportParams->tcpSocket ), + pHostName, + port, + receiveTimeoutMs, + sendTimeoutMs ); + + if( socketStatus != 0 ) + { + LogError( ( "Failed to connect to %s with error %d.", + pHostName, + socketStatus ) ); + returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; + } + } + + /* Initialize mbedtls. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = initMbedtls( &( pTlsTransportParams->sslContext.entropyContext ), + &( pTlsTransportParams->sslContext.ctrDrgbContext ) ); + } + + /* Initialize TLS contexts and set credentials. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); + } + + /* Perform TLS handshake. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = tlsHandshake( pNetworkContext, pNetworkCredentials ); + } + + /* Clean up on failure. */ + if( returnStatus != TLS_TRANSPORT_SUCCESS ) + { + if( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ) + { + sslContextFree( &( pTlsTransportParams->sslContext ) ); + + if( pTlsTransportParams->tcpSocket != FREERTOS_INVALID_SOCKET ) + { + ( void ) FreeRTOS_closesocket( pTlsTransportParams->tcpSocket ); + } + } + } + else + { + LogInfo( ( "(Network connection %p) Connection to %s established.", + pNetworkContext, + pHostName ) ); + } + + return returnStatus; +} +/*-----------------------------------------------------------*/ + +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + BaseType_t tlsStatus = 0; + + if( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ) + { + pTlsTransportParams = pNetworkContext->pParams; + /* Attempting to terminate TLS connection. */ + tlsStatus = ( BaseType_t ) mbedtls_ssl_close_notify( &( pTlsTransportParams->sslContext.context ) ); + + /* Ignore the WANT_READ and WANT_WRITE return values. */ + if( ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_READ ) && + ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + if( tlsStatus == 0 ) + { + LogInfo( ( "(Network connection %p) TLS close-notify sent.", + pNetworkContext ) ); + } + else + { + LogError( ( "(Network connection %p) Failed to send TLS close-notify: mbedTLSError= %s : %s.", + pNetworkContext, + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + } + else + { + /* WANT_READ and WANT_WRITE can be ignored. Logging for debugging purposes. */ + LogInfo( ( "(Network connection %p) TLS close-notify sent; ", + "received %s as the TLS status can be ignored for close-notify." + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE", + pNetworkContext ) ); + } + + /* Call socket shutdown function to close connection. */ + Sockets_Disconnect( pTlsTransportParams->tcpSocket ); + + /* Free mbed TLS contexts. */ + sslContextFree( &( pTlsTransportParams->sslContext ) ); + } + + /* Clear the mutex functions for mbed TLS thread safety. */ + mbedtls_threading_free_alt(); +} +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + int32_t tlsStatus = 0; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pTlsTransportParams = pNetworkContext->pParams; + tlsStatus = ( int32_t ) mbedtls_ssl_read( &( pTlsTransportParams->sslContext.context ), + pBuffer, + bytesToRecv ); + + if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + LogDebug( ( "Failed to read data. However, a read can be retried on this error. " + "mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + + /* Mark these set of errors as a timeout. The libraries may retry read + * on these errors. */ + tlsStatus = 0; + } + else if( tlsStatus < 0 ) + { + LogError( ( "Failed to read data: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + else + { + /* Empty else marker. */ + } + + return tlsStatus; +} +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + int32_t tlsStatus = 0; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pTlsTransportParams = pNetworkContext->pParams; + tlsStatus = ( int32_t ) mbedtls_ssl_write( &( pTlsTransportParams->sslContext.context ), + pBuffer, + bytesToSend ); + + if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + LogDebug( ( "Failed to send data. However, send can be retried on this error. " + "mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + + /* Mark these set of errors as a timeout. The libraries may retry send + * on these errors. */ + tlsStatus = 0; + } + else if( tlsStatus < 0 ) + { + LogError( ( "Failed to send data: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + else + { + /* Empty else marker. */ + } + + return tlsStatus; +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.h new file mode 100644 index 000000000..25eb5074c --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls/using_mbedtls.h @@ -0,0 +1,218 @@ +/* + * FreeRTOS V202107.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 tls_freertos.h + * @brief TLS transport interface header. + */ + +#ifndef USING_MBEDTLS +#define USING_MBEDTLS + +/**************************************************/ +/******* 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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "TlsTransport" +#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 ****************/ + +/* FreeRTOS+TCP include. */ +#include "FreeRTOS_Sockets.h" + +/* Transport interface include. */ +#include "transport_interface.h" + +/* mbed TLS includes. */ +#include "mbedtls/ctr_drbg.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ssl.h" +#include "mbedtls/threading.h" +#include "mbedtls/x509.h" +#include "mbedtls/error.h" + +/** + * @brief Secured connection context. + */ +typedef struct SSLContext +{ + mbedtls_ssl_config config; /**< @brief SSL connection configuration. */ + mbedtls_ssl_context context; /**< @brief SSL connection context */ + mbedtls_x509_crt_profile certProfile; /**< @brief Certificate security profile for this connection. */ + mbedtls_x509_crt rootCa; /**< @brief Root CA certificate context. */ + mbedtls_x509_crt clientCert; /**< @brief Client certificate context. */ + mbedtls_pk_context privKey; /**< @brief Client private key context. */ + mbedtls_entropy_context entropyContext; /**< @brief Entropy context for random number generation. */ + mbedtls_ctr_drbg_context ctrDrgbContext; /**< @brief CTR DRBG context for random number generation. */ +} SSLContext_t; + +/** + * @brief Parameters for the network context of the transport interface + * implementation that uses mbedTLS and FreeRTOS+TCP sockets. + */ +typedef struct TlsTransportParams +{ + Socket_t tcpSocket; + SSLContext_t sslContext; +} TlsTransportParams_t; + +/** + * @brief Contains the credentials necessary for tls connection setup. + */ +typedef struct NetworkCredentials +{ + /** + * @brief To use ALPN, set this to a NULL-terminated list of supported + * protocols in decreasing order of preference. + * + * See [this link] + * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) + * for more information. + */ + const char ** pAlpnProtos; + + /** + * @brief Disable server name indication (SNI) for a TLS session. + */ + BaseType_t disableSni; + + const uint8_t * pRootCa; /**< @brief String representing a trusted server root certificate. */ + size_t rootCaSize; /**< @brief Size associated with #NetworkCredentials.pRootCa. */ + const uint8_t * pClientCert; /**< @brief String representing the client certificate. */ + size_t clientCertSize; /**< @brief Size associated with #NetworkCredentials.pClientCert. */ + const uint8_t * pPrivateKey; /**< @brief String representing the client certificate's private key. */ + size_t privateKeySize; /**< @brief Size associated with #NetworkCredentials.pPrivateKey. */ +} NetworkCredentials_t; + +/** + * @brief TLS Connect / Disconnect return status. + */ +typedef enum TlsTransportStatus +{ + TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ + TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ + TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ + TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ + TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ + TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ + TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ +} TlsTransportStatus_t; + +/** + * @brief Create a TLS connection with FreeRTOS sockets. + * + * @param[out] pNetworkContext Pointer to a network context to contain the + * initialized socket handle. + * @param[in] pHostName The hostname of the remote endpoint. + * @param[in] port The destination port. + * @param[in] pNetworkCredentials Credentials for the TLS connection. + * @param[in] receiveTimeoutMs Receive socket timeout. + * @param[in] sendTimeoutMs Send socket timeout. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. + */ +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief Gracefully disconnect an established TLS connection. + * + * @param[in] pNetworkContext Network context. + */ +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); + +/** + * @brief Receives data from an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportRecv_t function. + * + * @param[in] pNetworkContext The Network context. + * @param[out] pBuffer Buffer to receive bytes into. + * @param[in] bytesToRecv Number of bytes to receive from the network. + * + * @return Number of bytes (> 0) received if successful; + * 0 if the socket times out without reading any bytes; + * negative value on error. + */ +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ); + +/** + * @brief Sends data over an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportSend_t function. + * + * @param[in] pNetworkContext The network context. + * @param[in] pBuffer Buffer containing the bytes to send. + * @param[in] bytesToSend Number of bytes to send from the buffer. + * + * @return Number of bytes (> 0) sent on success; + * 0 if the socket times out without sending any bytes; + * else a negative value to represent error. + */ +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ); + +#endif /* ifndef USING_MBEDTLS */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c new file mode 100644 index 000000000..6f1d83ffb --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.c @@ -0,0 +1,1011 @@ +/* + * FreeRTOS V202107.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 tls_freertos_pkcs11.c + * @brief TLS transport interface implementations. This implementation uses + * mbedTLS. + * @note This file is derived from the tls_freertos.c source file found in the mqtt + * section of IoT Libraries source code. The file has been modified to support using + * PKCS #11 when using TLS. + */ + +/* Standard includes. */ +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" + +/* FreeRTOS+TCP includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* TLS transport header. */ +#include "using_mbedtls_pkcs11.h" + +/* FreeRTOS Socket wrapper include. */ +#include "sockets_wrapper.h" + +/* PKCS #11 includes. */ +#include "core_pkcs11_config.h" +#include "core_pkcs11.h" +#include "pkcs11.h" +#include "core_pki_utils.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Each compilation unit that consumes the NetworkContext must define it. + * It should contain a single pointer as seen below whenever the header file + * of this transport implementation is included to your project. + * + * @note When using multiple transports in the same compilation unit, + * define this pointer as void *. + */ +struct NetworkContext +{ + TlsTransportParams_t * pParams; +}; + +/*-----------------------------------------------------------*/ + +/** + * @brief Represents string to be logged when mbedTLS returned error + * does not contain a high-level code. + */ +static const char * pNoHighLevelMbedTlsCodeStr = ""; + +/** + * @brief Represents string to be logged when mbedTLS returned error + * does not contain a low-level code. + */ +static const char * pNoLowLevelMbedTlsCodeStr = ""; + +/** + * @brief Utility for converting the high-level code in an mbedTLS error to string, + * if the code-contains a high-level code; otherwise, using a default string. + */ +#define mbedtlsHighLevelCodeOrDefault( mbedTlsCode ) \ + ( mbedtls_high_level_strerr( mbedTlsCode ) != NULL ) ? \ + mbedtls_high_level_strerr( mbedTlsCode ) : pNoHighLevelMbedTlsCodeStr + +/** + * @brief Utility for converting the level-level code in an mbedTLS error to string, + * if the code-contains a level-level code; otherwise, using a default string. + */ +#define mbedtlsLowLevelCodeOrDefault( mbedTlsCode ) \ + ( mbedtls_low_level_strerr( mbedTlsCode ) != NULL ) ? \ + mbedtls_low_level_strerr( mbedTlsCode ) : pNoLowLevelMbedTlsCodeStr + +/*-----------------------------------------------------------*/ + +/** + * @brief Initialize the mbed TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to initialize. + */ +static void sslContextInit( SSLContext_t * pSslContext ); + +/** + * @brief Free the mbed TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to free. + */ +static void sslContextFree( SSLContext_t * pSslContext ); + +/** + * @brief Set up TLS on a TCP connection. + * + * @param[in] pNetworkContext Network context. + * @param[in] pHostName Remote host name, used for server name indication. + * @param[in] pNetworkCredentials TLS setup parameters. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Initialize mbedTLS. + * + * @return #TLS_TRANSPORT_SUCCESS, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t initMbedtls( void ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Callback that wraps PKCS#11 for pseudo-random number generation. + * + * @param[in] pvCtx Caller context. + * @param[in] pucRandom Byte array to fill with random data. + * @param[in] xRandomLength Length of byte array. + * + * @return Zero on success. + */ +static int32_t generateRandomBytes( void * pvCtx, + unsigned char * pucRandom, + size_t xRandomLength ); + +/** + * @brief Helper for reading the specified certificate object, if present, + * out of storage, into RAM, and then into an mbedTLS certificate context + * object. + * + * @param[in] pSslContext Caller TLS context. + * @param[in] pcLabelName PKCS #11 certificate object label. + * @param[in] xClass PKCS #11 certificate object class. + * @param[out] pxCertificateContext Certificate context. + * + * @return Zero on success. + */ +static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext, + char * pcLabelName, + CK_OBJECT_CLASS xClass, + mbedtls_x509_crt * pxCertificateContext ); + +/** + * @brief Helper for setting up potentially hardware-based cryptographic context. + * + * @param Caller context. + * + * @return Zero on success. + */ +static CK_RV initializeClientKeys( SSLContext_t * pxCtx ); + +/** + * @brief Sign a cryptographic hash with the private key. + * + * @param[in] pvContext Crypto context. + * @param[in] xMdAlg Unused. + * @param[in] pucHash Length in bytes of hash to be signed. + * @param[in] uiHashLen Byte array of hash to be signed. + * @param[out] pucSig RSA signature bytes. + * @param[in] pxSigLen Length in bytes of signature buffer. + * @param[in] piRng Unused. + * @param[in] pvRng Unused. + * + * @return Zero on success. + */ +static int32_t privateKeySigningCallback( void * pvContext, + mbedtls_md_type_t xMdAlg, + const unsigned char * pucHash, + size_t xHashLen, + unsigned char * pucSig, + size_t * pxSigLen, + int32_t ( * piRng )( void *, + unsigned char *, + size_t ), + void * pvRng ); + + +/*-----------------------------------------------------------*/ + +static void sslContextInit( SSLContext_t * pSslContext ) +{ + configASSERT( pSslContext != NULL ); + + mbedtls_ssl_config_init( &( pSslContext->config ) ); + mbedtls_x509_crt_init( &( pSslContext->rootCa ) ); + mbedtls_x509_crt_init( &( pSslContext->clientCert ) ); + mbedtls_ssl_init( &( pSslContext->context ) ); + + xInitializePkcs11Session( &( pSslContext->xP11Session ) ); + C_GetFunctionList( &( pSslContext->pxP11FunctionList ) ); +} +/*-----------------------------------------------------------*/ + +static void sslContextFree( SSLContext_t * pSslContext ) +{ + configASSERT( pSslContext != NULL ); + + mbedtls_ssl_free( &( pSslContext->context ) ); + mbedtls_x509_crt_free( &( pSslContext->rootCa ) ); + mbedtls_x509_crt_free( &( pSslContext->clientCert ) ); + mbedtls_ssl_config_free( &( pSslContext->config ) ); + + pSslContext->pxP11FunctionList->C_CloseSession( pSslContext->xP11Session ); +} + +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + int32_t mbedtlsError = 0; + CK_RV xResult = CKR_OK; + + configASSERT( pNetworkContext != NULL ); + configASSERT( pNetworkContext->pParams != NULL ); + configASSERT( pHostName != NULL ); + configASSERT( pNetworkCredentials != NULL ); + configASSERT( pNetworkCredentials->pRootCa != NULL ); + + pTlsTransportParams = pNetworkContext->pParams; + + /* Initialize the mbed TLS context structures. */ + sslContextInit( &( pTlsTransportParams->sslContext ) ); + + mbedtlsError = mbedtls_ssl_config_defaults( &( pTlsTransportParams->sslContext.config ), + MBEDTLS_SSL_IS_CLIENT, + MBEDTLS_SSL_TRANSPORT_STREAM, + MBEDTLS_SSL_PRESET_DEFAULT ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set default SSL configuration: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + /* Per mbed TLS docs, mbedtls_ssl_config_defaults only fails on memory allocation. */ + returnStatus = TLS_TRANSPORT_INSUFFICIENT_MEMORY; + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Set up the certificate security profile, starting from the default value. */ + pTlsTransportParams->sslContext.certProfile = mbedtls_x509_crt_profile_default; + + /* test.mosquitto.org only provides a 1024-bit RSA certificate, which is + * not acceptable by the default mbed TLS certificate security profile. + * For the purposes of this demo, allow the use of 1024-bit RSA certificates. + * This block should be removed otherwise. */ + if( strncmp( pHostName, "test.mosquitto.org", strlen( pHostName ) ) == 0 ) + { + pTlsTransportParams->sslContext.certProfile.rsa_min_bitlen = 1024; + } + + /* Set SSL authmode and the RNG context. */ + mbedtls_ssl_conf_authmode( &( pTlsTransportParams->sslContext.config ), + MBEDTLS_SSL_VERIFY_REQUIRED ); + mbedtls_ssl_conf_rng( &( pTlsTransportParams->sslContext.config ), + generateRandomBytes, + &pTlsTransportParams->sslContext ); + mbedtls_ssl_conf_cert_profile( &( pTlsTransportParams->sslContext.config ), + &( pTlsTransportParams->sslContext.certProfile ) ); + + /* Parse the server root CA certificate into the SSL context. */ + mbedtlsError = mbedtls_x509_crt_parse( &( pTlsTransportParams->sslContext.rootCa ), + pNetworkCredentials->pRootCa, + pNetworkCredentials->rootCaSize ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to parse server root CA certificate: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + else + { + mbedtls_ssl_conf_ca_chain( &( pTlsTransportParams->sslContext.config ), + &( pTlsTransportParams->sslContext.rootCa ), + NULL ); + } + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Setup the client private key. */ + xResult = initializeClientKeys( &( pTlsTransportParams->sslContext ) ); + + if( xResult != CKR_OK ) + { + LogError( ( "Failed to setup key handling by PKCS #11." ) ); + + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + else + { + /* Setup the client certificate. */ + xResult = readCertificateIntoContext( &( pTlsTransportParams->sslContext ), + pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS, + CKO_CERTIFICATE, + &( pTlsTransportParams->sslContext.clientCert ) ); + + if( xResult != CKR_OK ) + { + LogError( ( "Failed to get certificate from PKCS #11 module." ) ); + + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + else + { + ( void ) mbedtls_ssl_conf_own_cert( &( pTlsTransportParams->sslContext.config ), + &( pTlsTransportParams->sslContext.clientCert ), + &( pTlsTransportParams->sslContext.privKey ) ); + } + } + } + + if( ( returnStatus == TLS_TRANSPORT_SUCCESS ) && ( pNetworkCredentials->pAlpnProtos != NULL ) ) + { + /* Include an application protocol list in the TLS ClientHello + * message. */ + mbedtlsError = mbedtls_ssl_conf_alpn_protocols( &( pTlsTransportParams->sslContext.config ), + pNetworkCredentials->pAlpnProtos ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to configure ALPN protocol in mbed TLS: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Initialize the mbed TLS secured connection context. */ + mbedtlsError = mbedtls_ssl_setup( &( pTlsTransportParams->sslContext.context ), + &( pTlsTransportParams->sslContext.config ) ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set up mbed TLS SSL context: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + else + { + /* Set the underlying IO for the TLS connection. */ + + /* MISRA Rule 11.2 flags the following line for casting the second + * parameter to void *. This rule is suppressed because + * #mbedtls_ssl_set_bio requires the second parameter as void *. + */ + /* coverity[misra_c_2012_rule_11_2_violation] */ + mbedtls_ssl_set_bio( &( pTlsTransportParams->sslContext.context ), + ( void * ) pTlsTransportParams->tcpSocket, + MBEDTLS_SSL_SEND, + MBEDTLS_SSL_RECV, + NULL ); + } + } + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Enable SNI if requested. */ + if( pNetworkCredentials->disableSni == pdFALSE ) + { + mbedtlsError = mbedtls_ssl_set_hostname( &( pTlsTransportParams->sslContext.context ), + pHostName ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to set server name: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + } + } + + /* Set Maximum Fragment Length if enabled. */ + #ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Enable the max fragment extension. 4096 bytes is currently the largest fragment size permitted. + * See RFC 8449 https://tools.ietf.org/html/rfc8449 for more information. + * + * Smaller values can be found in "mbedtls/include/ssl.h". + */ + mbedtlsError = mbedtls_ssl_conf_max_frag_len( &( pTlsTransportParams->sslContext.config ), MBEDTLS_SSL_MAX_FRAG_LEN_4096 ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to maximum fragment length extension: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + } + #endif /* ifdef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + /* Perform the TLS handshake. */ + do + { + mbedtlsError = mbedtls_ssl_handshake( &( pTlsTransportParams->sslContext.context ) ); + } while( ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_READ ) || + ( mbedtlsError == MBEDTLS_ERR_SSL_WANT_WRITE ) ); + + if( mbedtlsError != 0 ) + { + LogError( ( "Failed to perform TLS handshake: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( mbedtlsError ), + mbedtlsLowLevelCodeOrDefault( mbedtlsError ) ) ); + + returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; + } + } + + if( returnStatus != TLS_TRANSPORT_SUCCESS ) + { + sslContextFree( &( pTlsTransportParams->sslContext ) ); + } + else + { + LogInfo( ( "(Network connection %p) TLS handshake successful.", + pNetworkContext ) ); + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t initMbedtls( void ) +{ + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + + /* Set the mutex functions for mbed TLS thread safety. */ + mbedtls_threading_set_alt( mbedtls_platform_mutex_init, + mbedtls_platform_mutex_free, + mbedtls_platform_mutex_lock, + mbedtls_platform_mutex_unlock ); + + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + LogDebug( ( "Successfully initialized mbedTLS." ) ); + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + +static int32_t generateRandomBytes( void * pvCtx, + unsigned char * pucRandom, + size_t xRandomLength ) +{ + /* Must cast from void pointer to conform to mbed TLS API. */ + SSLContext_t * pxCtx = ( SSLContext_t * ) pvCtx; + CK_RV xResult; + + xResult = pxCtx->pxP11FunctionList->C_GenerateRandom( pxCtx->xP11Session, pucRandom, xRandomLength ); + + if( xResult != CKR_OK ) + { + LogError( ( "Failed to generate random bytes from the PKCS #11 module." ) ); + } + + return xResult; +} + +/*-----------------------------------------------------------*/ + +static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext, + char * pcLabelName, + CK_OBJECT_CLASS xClass, + mbedtls_x509_crt * pxCertificateContext ) +{ + CK_RV xResult = CKR_OK; + CK_ATTRIBUTE xTemplate = { 0 }; + CK_OBJECT_HANDLE xCertObj = 0; + + /* Get the handle of the certificate. */ + xResult = xFindObjectWithLabelAndClass( pSslContext->xP11Session, + pcLabelName, + strlen( pcLabelName ), + xClass, + &xCertObj ); + + if( ( CKR_OK == xResult ) && ( xCertObj == CK_INVALID_HANDLE ) ) + { + xResult = CKR_OBJECT_HANDLE_INVALID; + } + + /* Query the certificate size. */ + if( CKR_OK == xResult ) + { + xTemplate.type = CKA_VALUE; + xTemplate.ulValueLen = 0; + xTemplate.pValue = NULL; + xResult = pSslContext->pxP11FunctionList->C_GetAttributeValue( pSslContext->xP11Session, + xCertObj, + &xTemplate, + 1 ); + } + + /* Create a buffer for the certificate. */ + if( CKR_OK == xResult ) + { + xTemplate.pValue = pvPortMalloc( xTemplate.ulValueLen ); + + if( NULL == xTemplate.pValue ) + { + xResult = CKR_HOST_MEMORY; + } + } + + /* Export the certificate. */ + if( CKR_OK == xResult ) + { + xResult = pSslContext->pxP11FunctionList->C_GetAttributeValue( pSslContext->xP11Session, + xCertObj, + &xTemplate, + 1 ); + } + + /* Decode the certificate. */ + if( CKR_OK == xResult ) + { + xResult = mbedtls_x509_crt_parse( pxCertificateContext, + ( const unsigned char * ) xTemplate.pValue, + xTemplate.ulValueLen ); + } + + /* Free memory. */ + vPortFree( xTemplate.pValue ); + + return xResult; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Helper for setting up potentially hardware-based cryptographic context + * for the client TLS certificate and private key. + * + * @param Caller context. + * + * @return Zero on success. + */ +static CK_RV initializeClientKeys( SSLContext_t * pxCtx ) +{ + CK_RV xResult = CKR_OK; + CK_SLOT_ID * pxSlotIds = NULL; + CK_ULONG xCount = 0; + CK_ATTRIBUTE xTemplate[ 2 ]; + mbedtls_pk_type_t xKeyAlgo = ( mbedtls_pk_type_t ) ~0; + + /* Get the PKCS #11 module/token slot count. */ + if( CKR_OK == xResult ) + { + xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_GetSlotList( CK_TRUE, + NULL, + &xCount ); + } + + /* Allocate memory to store the token slots. */ + if( CKR_OK == xResult ) + { + pxSlotIds = ( CK_SLOT_ID * ) pvPortMalloc( sizeof( CK_SLOT_ID ) * xCount ); + + if( NULL == pxSlotIds ) + { + xResult = CKR_HOST_MEMORY; + } + } + + /* Get all of the available private key slot identities. */ + if( CKR_OK == xResult ) + { + xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_GetSlotList( CK_TRUE, + pxSlotIds, + &xCount ); + } + + /* Put the module in authenticated mode. */ + if( CKR_OK == xResult ) + { + xResult = ( BaseType_t ) pxCtx->pxP11FunctionList->C_Login( pxCtx->xP11Session, + CKU_USER, + ( CK_UTF8CHAR_PTR ) configPKCS11_DEFAULT_USER_PIN, + sizeof( configPKCS11_DEFAULT_USER_PIN ) - 1 ); + } + + if( CKR_OK == xResult ) + { + /* Get the handle of the device private key. */ + xResult = xFindObjectWithLabelAndClass( pxCtx->xP11Session, + pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS, + sizeof( pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ) - 1UL, + CKO_PRIVATE_KEY, + &pxCtx->xP11PrivateKey ); + } + + if( ( CKR_OK == xResult ) && ( pxCtx->xP11PrivateKey == CK_INVALID_HANDLE ) ) + { + xResult = CK_INVALID_HANDLE; + LogError( ( "Could not find private key." ) ); + } + + /* Query the device private key type. */ + if( xResult == CKR_OK ) + { + xTemplate[ 0 ].type = CKA_KEY_TYPE; + xTemplate[ 0 ].pValue = &pxCtx->xKeyType; + xTemplate[ 0 ].ulValueLen = sizeof( CK_KEY_TYPE ); + xResult = pxCtx->pxP11FunctionList->C_GetAttributeValue( pxCtx->xP11Session, + pxCtx->xP11PrivateKey, + xTemplate, + 1 ); + } + + /* Map the PKCS #11 key type to an mbedTLS algorithm. */ + if( xResult == CKR_OK ) + { + switch( pxCtx->xKeyType ) + { + case CKK_RSA: + xKeyAlgo = MBEDTLS_PK_RSA; + break; + + case CKK_EC: + xKeyAlgo = MBEDTLS_PK_ECKEY; + break; + + default: + xResult = CKR_ATTRIBUTE_VALUE_INVALID; + break; + } + } + + /* Map the mbedTLS algorithm to its internal metadata. */ + if( xResult == CKR_OK ) + { + memcpy( &pxCtx->privKeyInfo, mbedtls_pk_info_from_type( xKeyAlgo ), sizeof( mbedtls_pk_info_t ) ); + + pxCtx->privKeyInfo.sign_func = privateKeySigningCallback; + pxCtx->privKey.pk_info = &pxCtx->privKeyInfo; + pxCtx->privKey.pk_ctx = pxCtx; + } + + /* Free memory. */ + vPortFree( pxSlotIds ); + + return xResult; +} + +/*-----------------------------------------------------------*/ + +static int32_t privateKeySigningCallback( void * pvContext, + mbedtls_md_type_t xMdAlg, + const unsigned char * pucHash, + size_t xHashLen, + unsigned char * pucSig, + size_t * pxSigLen, + int32_t ( * piRng )( void *, + unsigned char *, + size_t ), + void * pvRng ) +{ + CK_RV xResult = CKR_OK; + int32_t lFinalResult = 0; + SSLContext_t * pxTLSContext = ( SSLContext_t * ) pvContext; + CK_MECHANISM xMech = { 0 }; + CK_BYTE xToBeSigned[ 256 ]; + CK_ULONG xToBeSignedLen = sizeof( xToBeSigned ); + + /* Unreferenced parameters. */ + ( void ) ( piRng ); + ( void ) ( pvRng ); + ( void ) ( xMdAlg ); + + /* Sanity check buffer length. */ + if( xHashLen > sizeof( xToBeSigned ) ) + { + xResult = CKR_ARGUMENTS_BAD; + } + + /* Format the hash data to be signed. */ + if( CKK_RSA == pxTLSContext->xKeyType ) + { + xMech.mechanism = CKM_RSA_PKCS; + + /* mbedTLS expects hashed data without padding, but PKCS #11 C_Sign function performs a hash + * & sign if hash algorithm is specified. This helper function applies padding + * indicating data was hashed with SHA-256 while still allowing pre-hashed data to + * be provided. */ + xResult = vAppendSHA256AlgorithmIdentifierSequence( ( uint8_t * ) pucHash, xToBeSigned ); + xToBeSignedLen = pkcs11RSA_SIGNATURE_INPUT_LENGTH; + } + else if( CKK_EC == pxTLSContext->xKeyType ) + { + xMech.mechanism = CKM_ECDSA; + memcpy( xToBeSigned, pucHash, xHashLen ); + xToBeSignedLen = xHashLen; + } + else + { + xResult = CKR_ARGUMENTS_BAD; + } + + if( CKR_OK == xResult ) + { + /* Use the PKCS#11 module to sign. */ + xResult = pxTLSContext->pxP11FunctionList->C_SignInit( pxTLSContext->xP11Session, + &xMech, + pxTLSContext->xP11PrivateKey ); + } + + if( CKR_OK == xResult ) + { + *pxSigLen = sizeof( xToBeSigned ); + xResult = pxTLSContext->pxP11FunctionList->C_Sign( ( CK_SESSION_HANDLE ) pxTLSContext->xP11Session, + xToBeSigned, + xToBeSignedLen, + pucSig, + ( CK_ULONG_PTR ) pxSigLen ); + } + + if( ( xResult == CKR_OK ) && ( CKK_EC == pxTLSContext->xKeyType ) ) + { + /* PKCS #11 for P256 returns a 64-byte signature with 32 bytes for R and 32 bytes for S. + * This must be converted to an ASN.1 encoded array. */ + if( *pxSigLen != pkcs11ECDSA_P256_SIGNATURE_LENGTH ) + { + xResult = CKR_FUNCTION_FAILED; + } + + if( xResult == CKR_OK ) + { + PKI_pkcs11SignatureTombedTLSSignature( pucSig, pxSigLen ); + } + } + + if( xResult != CKR_OK ) + { + LogError( ( "Failed to sign message using PKCS #11 with error code %02X.", xResult ) ); + } + + return lFinalResult; +} + +/*-----------------------------------------------------------*/ + +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + BaseType_t socketStatus = 0; + + if( ( pNetworkContext == NULL ) || + ( pNetworkContext->pParams == NULL ) || + ( pHostName == NULL ) || + ( pNetworkCredentials == NULL ) ) + { + LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " + "pHostName=%p, pNetworkCredentials=%p.", + pNetworkContext, + pHostName, + pNetworkCredentials ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + else if( ( pNetworkCredentials->pRootCa == NULL ) ) + { + LogError( ( "pRootCa cannot be NULL." ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + else + { + /* Empty else for MISRA 15.7 compliance. */ + } + + /* Establish a TCP connection with the server. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + pTlsTransportParams = pNetworkContext->pParams; + socketStatus = Sockets_Connect( &( pTlsTransportParams->tcpSocket ), + pHostName, + port, + receiveTimeoutMs, + sendTimeoutMs ); + + if( socketStatus != 0 ) + { + LogError( ( "Failed to connect to %s with error %d.", + pHostName, + socketStatus ) ); + returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; + } + } + + /* Initialize mbedtls. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = initMbedtls(); + } + + /* Perform TLS handshake. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); + } + + /* Clean up on failure. */ + if( returnStatus != TLS_TRANSPORT_SUCCESS ) + { + if( ( pNetworkContext != NULL ) && + ( pTlsTransportParams->tcpSocket != FREERTOS_INVALID_SOCKET ) ) + { + ( void ) FreeRTOS_closesocket( pTlsTransportParams->tcpSocket ); + } + } + else + { + LogInfo( ( "(Network connection %p) Connection to %s established.", + pNetworkContext, + pHostName ) ); + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + BaseType_t tlsStatus = 0; + + if( pNetworkContext != NULL && pNetworkContext->pParams != NULL ) + { + pTlsTransportParams = pNetworkContext->pParams; + /* Attempting to terminate TLS connection. */ + tlsStatus = ( BaseType_t ) mbedtls_ssl_close_notify( &( pTlsTransportParams->sslContext.context ) ); + + /* Ignore the WANT_READ and WANT_WRITE return values. */ + if( ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_READ ) && + ( tlsStatus != ( BaseType_t ) MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + if( tlsStatus == 0 ) + { + LogInfo( ( "(Network connection %p) TLS close-notify sent.", + pNetworkContext ) ); + } + else + { + LogError( ( "(Network connection %p) Failed to send TLS close-notify: mbedTLSError= %s : %s.", + pNetworkContext, + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + } + else + { + /* WANT_READ and WANT_WRITE can be ignored. Logging for debugging purposes. */ + LogInfo( ( "(Network connection %p) TLS close-notify sent; ", + "received %s as the TLS status can be ignored for close-notify." + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE", + pNetworkContext ) ); + } + + /* Call socket shutdown function to close connection. */ + Sockets_Disconnect( pTlsTransportParams->tcpSocket ); + + /* Free mbed TLS contexts. */ + sslContextFree( &( pTlsTransportParams->sslContext ) ); + } + + /* Clear the mutex functions for mbed TLS thread safety. */ + mbedtls_threading_free_alt(); +} + +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + int32_t tlsStatus = 0; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pTlsTransportParams = pNetworkContext->pParams; + tlsStatus = ( int32_t ) mbedtls_ssl_read( &( pTlsTransportParams->sslContext.context ), + pBuffer, + bytesToRecv ); + + if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + LogDebug( ( "Failed to read data. However, a read can be retried on this error. " + "mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + + /* Mark these set of errors as a timeout. The libraries may retry read + * on these errors. */ + tlsStatus = 0; + } + else if( tlsStatus < 0 ) + { + LogError( ( "Failed to read data: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + else + { + /* Empty else marker. */ + } + + return tlsStatus; +} + +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ) +{ + TlsTransportParams_t * pTlsTransportParams = NULL; + int32_t tlsStatus = 0; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pTlsTransportParams = pNetworkContext->pParams; + tlsStatus = ( int32_t ) mbedtls_ssl_write( &( pTlsTransportParams->sslContext.context ), + pBuffer, + bytesToSend ); + + if( ( tlsStatus == MBEDTLS_ERR_SSL_TIMEOUT ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) || + ( tlsStatus == MBEDTLS_ERR_SSL_WANT_WRITE ) ) + { + LogDebug( ( "Failed to send data. However, send can be retried on this error. " + "mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + + /* Mark these set of errors as a timeout. The libraries may retry send + * on these errors. */ + tlsStatus = 0; + } + else if( tlsStatus < 0 ) + { + LogError( ( "Failed to send data: mbedTLSError= %s : %s.", + mbedtlsHighLevelCodeOrDefault( tlsStatus ), + mbedtlsLowLevelCodeOrDefault( tlsStatus ) ) ); + } + else + { + /* Empty else marker. */ + } + + return tlsStatus; +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h new file mode 100644 index 000000000..68bd50721 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h @@ -0,0 +1,231 @@ +/* + * FreeRTOS V202107.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 tls_freertos_pkcs11.h + * @brief TLS transport interface header. + * @note This file is derived from the tls_freertos.h header file found in the mqtt + * section of IoT Libraries source code. The file has been modified to support using + * PKCS #11 when using TLS. + */ + +#ifndef USING_MBEDTLS_PKCS11 +#define USING_MBEDTLS_PKCS11 + +/**************************************************/ +/******* 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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "PkcsTlsTransport" +#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 ****************/ + +/* FreeRTOS+TCP include. */ +#include "FreeRTOS_Sockets.h" + +/* Transport interface include. */ +#include "transport_interface.h" + +/* mbed TLS includes. */ +#include "mbedtls/ctr_drbg.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ssl.h" +#include "mbedtls/threading.h" +#include "mbedtls/x509.h" +#include "mbedtls/pk.h" +#include "mbedtls/pk_internal.h" +#include "mbedtls/error.h" + +/* PKCS #11 includes. */ +#include "core_pkcs11.h" + +/** + * @brief Secured connection context. + */ +typedef struct SSLContext +{ + mbedtls_ssl_config config; /**< @brief SSL connection configuration. */ + mbedtls_ssl_context context; /**< @brief SSL connection context */ + mbedtls_x509_crt_profile certProfile; /**< @brief Certificate security profile for this connection. */ + mbedtls_x509_crt rootCa; /**< @brief Root CA certificate context. */ + mbedtls_x509_crt clientCert; /**< @brief Client certificate context. */ + mbedtls_pk_context privKey; /**< @brief Client private key context. */ + mbedtls_pk_info_t privKeyInfo; /**< @brief Client private key info. */ + + /* PKCS#11. */ + CK_FUNCTION_LIST_PTR pxP11FunctionList; + CK_SESSION_HANDLE xP11Session; + CK_OBJECT_HANDLE xP11PrivateKey; + CK_KEY_TYPE xKeyType; +} SSLContext_t; + +/** + * @brief Definition of the network context for the transport interface + * implementation that uses mbedTLS and FreeRTOS+TLS sockets. + */ +typedef struct TlsTransportParams +{ + Socket_t tcpSocket; + SSLContext_t sslContext; +} TlsTransportParams_t; + +/** + * @brief Contains the credentials necessary for tls connection setup. + */ +typedef struct NetworkCredentials +{ + /** + * @brief To use ALPN, set this to a NULL-terminated list of supported + * protocols in decreasing order of preference. + * + * See [this link] + * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) + * for more information. + */ + const char ** pAlpnProtos; + + /** + * @brief Disable server name indication (SNI) for a TLS session. + */ + BaseType_t disableSni; + + const unsigned char * pRootCa; /**< @brief String representing a trusted server root certificate. */ + size_t rootCaSize; /**< @brief Size associated with #NetworkCredentials.pRootCa. */ + const unsigned char * pUserName; /**< @brief String representing the username for MQTT. */ + size_t userNameSize; /**< @brief Size associated with #NetworkCredentials.pUserName. */ + const unsigned char * pPassword; /**< @brief String representing the password for MQTT. */ + size_t passwordSize; /**< @brief Size associated with #NetworkCredentials.pPassword. */ +} NetworkCredentials_t; + +/** + * @brief TLS Connect / Disconnect return status. + */ +typedef enum TlsTransportStatus +{ + TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ + TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ + TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ + TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ + TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ + TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ + TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ +} TlsTransportStatus_t; + +/** + * @brief Create a TLS connection with FreeRTOS sockets. + * + * @param[out] pNetworkContext Pointer to a network context to contain the + * initialized socket handle. + * @param[in] pHostName The hostname of the remote endpoint. + * @param[in] port The destination port. + * @param[in] pNetworkCredentials Credentials for the TLS connection. + * @param[in] receiveTimeoutMs Receive socket timeout. + * @param[in] sendTimeoutMs Send socket timeout. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. + */ +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief Gracefully disconnect an established TLS connection. + * + * @param[in] pNetworkContext Network context. + */ +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); + +/** + * @brief Receives data from an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportRecv_t function. + * + * @param[in] pNetworkContext The Network context. + * @param[out] pBuffer Buffer to receive bytes into. + * @param[in] bytesToRecv Number of bytes to receive from the network. + * + * @return Number of bytes (> 0) received if successful; + * 0 if the socket times out without reading any bytes; + * negative value on error. + */ +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ); + +/** + * @brief Sends data over an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportSend_t function. + * + * @param[in] pNetworkContext The network context. + * @param[in] pBuffer Buffer containing the bytes to send. + * @param[in] bytesToSend Number of bytes to send from the buffer. + * + * @return Number of bytes (> 0) sent on success; + * 0 if the socket times out without sending any bytes; + * else a negative value to represent error. + */ +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ); + +#endif /* ifndef USING_MBEDTLS_PKCS11 */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.c new file mode 100644 index 000000000..62cdbb568 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.c @@ -0,0 +1,199 @@ +/* + * FreeRTOS V202107.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 + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#if ( configUSE_PREEMPTION == 0 ) + #include "task.h" +#endif + +/* FreeRTOS+TCP includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* FreeRTOS Socket wrapper include. */ +#include "sockets_wrapper.h" + +/* Transport interface include. */ +#include "using_plaintext.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Each compilation unit that consumes the NetworkContext must define it. + * It should contain a single pointer as seen below whenever the header file + * of this transport implementation is included to your project. + * + * @note When using multiple transports in the same compilation unit, + * define this pointer as void *. + */ +struct NetworkContext +{ + PlaintextTransportParams_t * pParams; +}; + +/*-----------------------------------------------------------*/ + +PlaintextTransportStatus_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + PlaintextTransportParams_t * pPlaintextTransportParams = NULL; + PlaintextTransportStatus_t plaintextStatus = PLAINTEXT_TRANSPORT_SUCCESS; + BaseType_t socketStatus = 0; + + if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) || ( pHostName == NULL ) ) + { + LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " + "pHostName=%p.", + pNetworkContext, + pHostName ) ); + plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; + } + else + { + pPlaintextTransportParams = pNetworkContext->pParams; + /* Establish a TCP connection with the server. */ + socketStatus = Sockets_Connect( &( pPlaintextTransportParams->tcpSocket ), + pHostName, + port, + receiveTimeoutMs, + sendTimeoutMs ); + + /* A non zero status is an error. */ + if( socketStatus != 0 ) + { + LogError( ( "Failed to connect to %s with error %d.", + pHostName, + socketStatus ) ); + plaintextStatus = PLAINTEXT_TRANSPORT_CONNECT_FAILURE; + } + } + + return plaintextStatus; +} + +PlaintextTransportStatus_t Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext ) +{ + PlaintextTransportParams_t * pPlaintextTransportParams = NULL; + PlaintextTransportStatus_t plaintextStatus = PLAINTEXT_TRANSPORT_SUCCESS; + + if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) ) + { + LogError( ( "pNetworkContext cannot be NULL." ) ); + plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; + } + else if( pNetworkContext->pParams->tcpSocket == FREERTOS_INVALID_SOCKET ) + { + LogError( ( "pPlaintextTransportParams->tcpSocket cannot be an invalid socket." ) ); + plaintextStatus = PLAINTEXT_TRANSPORT_INVALID_PARAMETER; + } + else + { + pPlaintextTransportParams = pNetworkContext->pParams; + /* Call socket disconnect function to close connection. */ + Sockets_Disconnect( pPlaintextTransportParams->tcpSocket ); + } + + return plaintextStatus; +} + +int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ) +{ + PlaintextTransportParams_t * pPlaintextTransportParams = NULL; + int32_t socketStatus = 1; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pPlaintextTransportParams = pNetworkContext->pParams; + + /* The TCP socket may have a receive block time. If bytesToRecv is greater + * than 1 then a frame is likely already part way through reception and + * blocking to wait for the desired number of bytes to be available is the + * most efficient thing to do. If bytesToRecv is 1 then this may be a + * speculative call to read to find the start of a new frame, in which case + * blocking is not desirable as it could block an entire protocol agent + * task for the duration of the read block time and therefore negatively + * impact performance. So if bytesToRecv is 1 then don't call recv unless + * it is known that bytes are already available. */ + if( bytesToRecv == 1 ) + { + socketStatus = ( int32_t ) FreeRTOS_recvcount( pPlaintextTransportParams->tcpSocket ); + } + + if( socketStatus > 0 ) + { + socketStatus = FreeRTOS_recv( pPlaintextTransportParams->tcpSocket, + pBuffer, + bytesToRecv, + 0 ); + } + + return socketStatus; +} + +int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ) +{ + PlaintextTransportParams_t * pPlaintextTransportParams = NULL; + int32_t socketStatus = 0; + + configASSERT( ( pNetworkContext != NULL ) && ( pNetworkContext->pParams != NULL ) ); + + pPlaintextTransportParams = pNetworkContext->pParams; + socketStatus = FreeRTOS_send( pPlaintextTransportParams->tcpSocket, + pBuffer, + bytesToSend, + 0 ); + + if( socketStatus == -pdFREERTOS_ERRNO_ENOSPC ) + { + /* The TCP buffers could not accept any more bytes so zero bytes were sent. + * This is not necessarily an error that should cause a disconnect + * unless it persists. */ + socketStatus = 0; + } + + #if ( configUSE_PREEMPTION == 0 ) + { + /* FreeRTOS_send adds the packet to be sent to the IP task's queue for later processing. + * The packet is sent later by the IP task. When FreeRTOS is used in collaborative + * mode (i.e. configUSE_PREEMPTION is 0), call taskYIELD to give IP task a chance to run + * so that the packet is actually sent before this function returns. */ + taskYIELD(); + } + #endif + + return socketStatus; +} diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.h new file mode 100644 index 000000000..10b2e2093 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_plaintext/using_plaintext.h @@ -0,0 +1,152 @@ +/* + * FreeRTOS V202107.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 USING_PLAINTEXT_H +#define USING_PLAINTEXT_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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "PlaintextTransport" +#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 ****************/ + +/* FreeRTOS+TCP include. */ +#include "FreeRTOS_Sockets.h" + +/* Transport interface include. */ +#include "transport_interface.h" + +/** + * @brief Parameters for the network context that uses FreeRTOS+TCP sockets. + */ +typedef struct PlaintextTransportParams +{ + Socket_t tcpSocket; +} PlaintextTransportParams_t; + +/** + * @brief Plain text transport Connect / Disconnect return status. + */ +typedef enum PlaintextTransportStatus +{ + PLAINTEXT_TRANSPORT_SUCCESS = 1, /**< Function successfully completed. */ + PLAINTEXT_TRANSPORT_INVALID_PARAMETER = 2, /**< At least one parameter was invalid. */ + PLAINTEXT_TRANSPORT_CONNECT_FAILURE = 3 /**< Initial connection to the server failed. */ +} PlaintextTransportStatus_t; + +/** + * @brief Create a TCP connection with FreeRTOS sockets. + * + * @param[out] pNetworkContext Pointer to a network context to contain the + * initialized socket handle. + * @param[in] pHostName The hostname of the remote endpoint. + * @param[in] port The destination port. + * @param[in] receiveTimeoutMs Receive socket timeout. + * + * @return #PLAINTEXT_TRANSPORT_SUCCESS, #PLAINTEXT_TRANSPORT_INVALID_PARAMETER, + * or #PLAINTEXT_TRANSPORT_CONNECT_FAILURE. + */ +PlaintextTransportStatus_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief Gracefully disconnect an established TCP connection. + * + * @param[in] pNetworkContext Network context containing the TCP socket handle. + * + * @return #PLAINTEXT_TRANSPORT_SUCCESS, or #PLAINTEXT_TRANSPORT_INVALID_PARAMETER. + */ +PlaintextTransportStatus_t Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext ); + +/** + * @brief Receives data from an established TCP connection. + * + * @note When the number of bytes requested is 1, the TCP socket's Rx stream + * is checked for available bytes to read. If there are none, this function + * immediately returns 0 without blocking. + * + * @param[in] pNetworkContext The network context containing the TCP socket + * handle. + * @param[out] pBuffer Buffer to receive bytes into. + * @param[in] bytesToRecv Number of bytes to receive from the network. + * + * @return Number of bytes received if successful; 0 if the socket times out; + * Negative value on error. + */ +int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ); + +/** + * @brief Sends data over an established TCP connection. + * + * @param[in] pNetworkContext The network context containing the TCP socket + * handle. + * @param[in] pBuffer Buffer containing the bytes to send. + * @param[in] bytesToSend Number of bytes to send from the buffer. + * + * @return Number of bytes sent on success; else a negative value. + */ +int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ); + +#endif /* ifndef USING_PLAINTEXT_H */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.c new file mode 100644 index 000000000..6c651f623 --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.c @@ -0,0 +1,536 @@ +/* + * FreeRTOS V202107.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 using_wolfSSL.c + * @brief TLS transport interface implementations. This implementation uses + * wolfSSL. + */ + +/* Standard includes. */ +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" + +/* FreeRTOS+TCP includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* TLS transport header. */ +#include "using_wolfSSL.h" + +/* FreeRTOS Socket wrapper include. */ +#include "sockets_wrapper.h" + + +/* wolfSSL user settings header */ +#include "user_settings.h" + +/* Demo Specific configs. */ +#include "demo_config.h" + +/** + * @brief Initialize the TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to initialize. + */ +static void sslContextInit( SSLContext_t * pSslContext ); + +/** + * @brief Free the TLS structures in a network connection. + * + * @param[in] pSslContext The SSL context to free. + */ +static void sslContextFree( SSLContext_t * pSslContext ); + +/** + * @brief Set up TLS on a TCP connection. + * + * @param[in] pNetworkContext Network context. + * @param[in] pHostName Remote host name, used for server name indication. + * @param[in] pNetworkCredentials TLS setup parameters. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * #TLS_TRANSPORT_HANDSHAKE_FAILED, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, + const char * pHostName, + const NetworkCredentials_t * pNetworkCredentials ); + +/** + * @brief Initialize TLS component. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, or #TLS_TRANSPORT_INTERNAL_ERROR. + */ +static TlsTransportStatus_t initTLS( void ); + +/* + * @brief Receive date from the socket passed as the context + * + * @param[in] ssl WOLFSSL object. + * @param[in] buf Buffer for received data + * @param[in] sz Size to receive + * @param[in] context Socket to be received from + * + * @return received size( > 0 ), #WOLFSSL_CBIO_ERR_CONN_CLOSE, #WOLFSSL_CBIO_ERR_WANT_READ. + */ +static int wolfSSL_IORecvGlue( WOLFSSL * ssl, + char * buf, + int sz, + void * context ); + +/* + * @brief Send date to the socket passed as the context + * + * @param[in] ssl WOLFSSL object. + * @param[in] buf Buffer for data to be sent + * @param[in] sz Size to send + * @param[in] context Socket to be sent to + * + * @return received size( > 0 ), #WOLFSSL_CBIO_ERR_CONN_CLOSE, #WOLFSSL_CBIO_ERR_WANT_WRITE. + */ +static int wolfSSL_IOSendGlue( WOLFSSL * ssl, + char * buf, + int sz, + void * context ); + +/* + * @brief Load credentials from file/buffer + * + * @param[in] pNetCtx NetworkContext_t + * @param[in] pNetCred NetworkCredentials_t + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INVALID_CREDENTIALS. + */ +static TlsTransportStatus_t loadCredentials( NetworkContext_t * pNetCtx, + const NetworkCredentials_t * pNetCred ); + +/*-----------------------------------------------------------*/ +static int wolfSSL_IORecvGlue( WOLFSSL * ssl, + char * buf, + int sz, + void * context ) +{ + ( void ) ssl; /* to prevent unused warning*/ + BaseType_t read = 0; + + Socket_t xSocket = ( Socket_t ) context; + + + read = FreeRTOS_recv( xSocket, ( void * ) buf, ( size_t ) sz, 0 ); + + if( ( read == 0 ) || + ( read == -pdFREERTOS_ERRNO_EWOULDBLOCK ) ) + { + read = WOLFSSL_CBIO_ERR_WANT_READ; + } + else if( read == -pdFREERTOS_ERRNO_ENOTCONN ) + { + read = WOLFSSL_CBIO_ERR_CONN_CLOSE; + } + else + { + /* do nothing */ + } + + return ( int ) read; +} +/*-----------------------------------------------------------*/ + +static int wolfSSL_IOSendGlue( WOLFSSL * ssl, + char * buf, + int sz, + void * context ) +{ + ( void ) ssl; /* to prevent unused warning*/ + Socket_t xSocket = ( Socket_t ) context; + BaseType_t sent = FreeRTOS_send( xSocket, ( void * ) buf, ( size_t ) sz, 0 ); + + if( sent == -pdFREERTOS_ERRNO_EWOULDBLOCK ) + { + sent = WOLFSSL_CBIO_ERR_WANT_WRITE; + } + else if( sent == -pdFREERTOS_ERRNO_ENOTCONN ) + { + sent = WOLFSSL_CBIO_ERR_CONN_CLOSE; + } + else + { + /* do nothing */ + } + + return ( int ) sent; +} + +/*-----------------------------------------------------------*/ +static TlsTransportStatus_t initTLS( void ) +{ + /* initialize wolfSSL */ + wolfSSL_Init(); + + #ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_ON(); + #endif + + return TLS_TRANSPORT_SUCCESS; +} + +/*-----------------------------------------------------------*/ +static TlsTransportStatus_t loadCredentials( NetworkContext_t * pNetCtx, + const NetworkCredentials_t * pNetCred ) +{ + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + + configASSERT( pNetCtx != NULL ); + configASSERT( pNetCred != NULL ); + + #if defined( democonfigCREDENTIALS_IN_BUFFER ) + if( wolfSSL_CTX_load_verify_buffer( pNetCtx->sslContext.ctx, + ( const byte * ) ( pNetCred->pRootCa ), ( long ) ( pNetCred->rootCaSize ), + SSL_FILETYPE_PEM ) == SSL_SUCCESS ) + { + if( wolfSSL_CTX_use_certificate_buffer( pNetCtx->sslContext.ctx, + ( const byte * ) ( pNetCred->pClientCert ), ( long ) ( pNetCred->clientCertSize ), + SSL_FILETYPE_PEM ) == SSL_SUCCESS ) + { + if( wolfSSL_CTX_use_PrivateKey_buffer( pNetCtx->sslContext.ctx, + ( const byte * ) ( pNetCred->pPrivateKey ), ( long ) ( pNetCred->privateKeySize ), + SSL_FILETYPE_PEM ) == SSL_SUCCESS ) + { + returnStatus = TLS_TRANSPORT_SUCCESS; + } + else + { + LogError( ( "Failed to load client-private-key from buffer" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + } + else + { + LogError( ( "Failed to load client-certificate from buffer" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + } + else + { + LogError( ( "Failed to load ca-certificate from buffer" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + + return returnStatus; + #else /* if defined( democonfigCREDENTIALS_IN_BUFFER ) */ + if( wolfSSL_CTX_load_verify_locations( pNetCtx->sslContext.ctx, + ( const char * ) ( pNetCred->pRootCa ), NULL ) == SSL_SUCCESS ) + { + if( wolfSSL_CTX_use_certificate_file( pNetCtx->sslContext.ctx, + ( const char * ) ( pNetCred->pClientCert ), SSL_FILETYPE_PEM ) + == SSL_SUCCESS ) + { + if( wolfSSL_CTX_use_PrivateKey_file( pNetCtx->sslContext.ctx, + ( const char * ) ( pNetCred->pPrivateKey ), SSL_FILETYPE_PEM ) + == SSL_SUCCESS ) + { + returnStatus = TLS_TRANSPORT_SUCCESS; + } + else + { + LogError( ( "Failed to load client-private-key file" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + } + else + { + LogError( ( "Failed to load client-certificate file" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + } + else + { + LogError( ( "Failed to load ca-certificate file" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + return returnStatus; + #endif /* if defined( democonfigCREDENTIALS_IN_BUFFER ) */ +} + +/*-----------------------------------------------------------*/ + +static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetCtx, + const char * pHostName, + const NetworkCredentials_t * pNetCred ) +{ + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + Socket_t xSocket = { 0 }; + + configASSERT( pNetCtx != NULL ); + configASSERT( pHostName != NULL ); + configASSERT( pNetCred != NULL ); + configASSERT( pNetCred->pRootCa != NULL ); + configASSERT( pNetCtx->tcpSocket != NULL ); + + if( pNetCtx->sslContext.ctx == NULL ) + { + /* Attempt to create a context that uses the TLS 1.3 or 1.2 */ + pNetCtx->sslContext.ctx = + wolfSSL_CTX_new( wolfSSLv23_client_method_ex( NULL ) ); + } + + if( pNetCtx->sslContext.ctx != NULL ) + { + /* load credentials from file */ + if( loadCredentials( pNetCtx, pNetCred ) == TLS_TRANSPORT_SUCCESS ) + { + /* create a ssl object */ + pNetCtx->sslContext.ssl = + wolfSSL_new( pNetCtx->sslContext.ctx ); + + if( pNetCtx->sslContext.ssl != NULL ) + { + xSocket = pNetCtx->tcpSocket; + + /* set Recv/Send glue functions to the WOLFSSL object */ + wolfSSL_SSLSetIORecv( pNetCtx->sslContext.ssl, + wolfSSL_IORecvGlue ); + wolfSSL_SSLSetIOSend( pNetCtx->sslContext.ssl, + wolfSSL_IOSendGlue ); + + /* set socket as a context of read/send glue funcs */ + wolfSSL_SetIOReadCtx( pNetCtx->sslContext.ssl, xSocket ); + wolfSSL_SetIOWriteCtx( pNetCtx->sslContext.ssl, xSocket ); + + /* let wolfSSL perform tls handshake */ + if( wolfSSL_connect( pNetCtx->sslContext.ssl ) + == SSL_SUCCESS ) + { + returnStatus = TLS_TRANSPORT_SUCCESS; + } + else + { + wolfSSL_shutdown( pNetCtx->sslContext.ssl ); + wolfSSL_free( pNetCtx->sslContext.ssl ); + pNetCtx->sslContext.ssl = NULL; + wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); + pNetCtx->sslContext.ctx = NULL; + + LogError( ( "Failed to establish a TLS connection" ) ); + returnStatus = TLS_TRANSPORT_HANDSHAKE_FAILED; + } + } + else + { + wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); + pNetCtx->sslContext.ctx = NULL; + + LogError( ( "Failed to create wolfSSL object" ) ); + returnStatus = TLS_TRANSPORT_INTERNAL_ERROR; + } + } + else + { + wolfSSL_CTX_free( pNetCtx->sslContext.ctx ); + pNetCtx->sslContext.ctx = NULL; + + LogError( ( "Failed to load credentials" ) ); + returnStatus = TLS_TRANSPORT_INVALID_CREDENTIALS; + } + } + else + { + LogError( ( "Failed to create a wolfSSL_CTX" ) ); + returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + + +/*-----------------------------------------------------------*/ + +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ) +{ + TlsTransportStatus_t returnStatus = TLS_TRANSPORT_SUCCESS; + BaseType_t socketStatus = 0; + + + if( ( pNetworkContext == NULL ) || + ( pHostName == NULL ) || + ( pNetworkCredentials == NULL ) ) + { + LogError( ( "Invalid input parameter(s): Arguments cannot be NULL. pNetworkContext=%p, " + "pHostName=%p, pNetworkCredentials=%p.", + pNetworkContext, + pHostName, + pNetworkCredentials ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + else if( ( pNetworkCredentials->pRootCa == NULL ) ) + { + LogError( ( "pRootCa cannot be NULL." ) ); + returnStatus = TLS_TRANSPORT_INVALID_PARAMETER; + } + + /* Establish a TCP connection with the server. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + socketStatus = Sockets_Connect( &( pNetworkContext->tcpSocket ), + pHostName, + port, + receiveTimeoutMs, + sendTimeoutMs ); + + if( socketStatus != 0 ) + { + LogError( ( "Failed to connect to %s with error %d.", + pHostName, + socketStatus ) ); + returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; + } + } + + /* Initialize tls. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = initTLS(); + } + + /* Perform TLS handshake. */ + if( returnStatus == TLS_TRANSPORT_SUCCESS ) + { + returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); + } + + /* Clean up on failure. */ + if( returnStatus != TLS_TRANSPORT_SUCCESS ) + { + if( pNetworkContext->tcpSocket != FREERTOS_INVALID_SOCKET ) + { + FreeRTOS_closesocket( pNetworkContext->tcpSocket ); + } + } + else + { + LogInfo( ( "(Network connection %p) Connection to %s established.", + pNetworkContext, + pHostName ) ); + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ) +{ + WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; + WOLFSSL_CTX * pCtx = NULL; + + /* shutdown an active TLS connection */ + wolfSSL_shutdown( pSsl ); + + /* cleanup WOLFSSL object */ + wolfSSL_free( pSsl ); + pNetworkContext->sslContext.ssl = NULL; + + /* Call socket shutdown function to close connection. */ + Sockets_Disconnect( pNetworkContext->tcpSocket ); + + /* free WOLFSSL_CTX object*/ + pCtx = pNetworkContext->sslContext.ctx; + + wolfSSL_CTX_free( pCtx ); + pNetworkContext->sslContext.ctx = NULL; + + wolfSSL_Cleanup(); +} + +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ) +{ + int32_t tlsStatus = 0; + int iResult = 0; + WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; + + iResult = wolfSSL_read( pSsl, pBuffer, bytesToRecv ); + + if( iResult > 0 ) + { + tlsStatus = iResult; + } + else if( wolfSSL_want_read( pSsl ) == 1 ) + { + tlsStatus = 0; + } + else + { + tlsStatus = wolfSSL_state( pSsl ); + LogError( ( "Error from wolfSSL_read %d : %s ", + iResult, wolfSSL_ERR_reason_error_string( tlsStatus ) ) ); + } + + return tlsStatus; +} + +/*-----------------------------------------------------------*/ + +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ) +{ + int32_t tlsStatus = 0; + int iResult = 0; + WOLFSSL * pSsl = pNetworkContext->sslContext.ssl; + + iResult = wolfSSL_write( pSsl, pBuffer, bytesToSend ); + + if( iResult > 0 ) + { + tlsStatus = iResult; + } + else if( wolfSSL_want_write( pSsl ) == 1 ) + { + tlsStatus = 0; + } + else + { + tlsStatus = wolfSSL_state( pSsl ); + LogError( ( "Error from wolfSL_write %d : %s ", + iResult, wolfSSL_ERR_reason_error_string( tlsStatus ) ) ); + } + + return tlsStatus; +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.h new file mode 100644 index 000000000..301fe35cf --- /dev/null +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/using_mbedtls/using_wolfSSL/using_wolfSSL.h @@ -0,0 +1,199 @@ +/* + * FreeRTOS V202107.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 using_wolfSSL.h + * @brief TLS transport interface header. + */ + +#ifndef USING_WOLFSSL_H +#define USING_WOLFSSL_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 Sockets. */ +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "TlsTransport" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_INFO +#endif + +#include "logging_stack.h" + +/************ End of logging configuration ****************/ + +/* FreeRTOS+TCP include. */ +#include "FreeRTOS_Sockets.h" + +/* Transport interface include. */ +#include "transport_interface.h" + +/* wolfSSL interface include. */ +#include "wolfssl/ssl.h" + +/** + * @brief Secured connection context. + */ +typedef struct SSLContext +{ + WOLFSSL_CTX* ctx; /**< @brief wolfSSL context */ + WOLFSSL* ssl; /**< @brief wolfSSL ssl session context */ +} SSLContext_t; + +/** + * @brief Definition of the network context for the transport interface + * implementation that uses mbedTLS and FreeRTOS+TLS sockets. + */ +struct NetworkContext +{ + Socket_t tcpSocket; + SSLContext_t sslContext; +}; + +/** + * @brief Contains the credentials necessary for tls connection setup. + */ +typedef struct NetworkCredentials +{ + /** + * @brief Set this to a non-NULL value to use ALPN. + * + * This string must be NULL-terminated. + * + * See [this link] + * (https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) + * for more information. + */ + const char * pAlpnProtos; + + /** + * @brief Disable server name indication (SNI) for a TLS session. + */ + BaseType_t disableSni; + + const unsigned char * pRootCa; /**< @brief String representing a trusted server root certificate. */ + size_t rootCaSize; /**< @brief Size associated with #IotNetworkCredentials.pRootCa. */ + const unsigned char * pClientCert; /**< @brief String representing the client certificate. */ + size_t clientCertSize; /**< @brief Size associated with #IotNetworkCredentials.pClientCert. */ + const unsigned char * pPrivateKey; /**< @brief String representing the client certificate's private key. */ + size_t privateKeySize; /**< @brief Size associated with #IotNetworkCredentials.pPrivateKey. */ + const unsigned char * pUserName; /**< @brief String representing the username for MQTT. */ + size_t userNameSize; /**< @brief Size associated with #IotNetworkCredentials.pUserName. */ + const unsigned char * pPassword; /**< @brief String representing the password for MQTT. */ + size_t passwordSize; /**< @brief Size associated with #IotNetworkCredentials.pPassword. */ +} NetworkCredentials_t; + +/** + * @brief TLS Connect / Disconnect return status. + */ +typedef enum TlsTransportStatus +{ + TLS_TRANSPORT_SUCCESS = 0, /**< Function successfully completed. */ + TLS_TRANSPORT_INVALID_PARAMETER, /**< At least one parameter was invalid. */ + TLS_TRANSPORT_INSUFFICIENT_MEMORY, /**< Insufficient memory required to establish connection. */ + TLS_TRANSPORT_INVALID_CREDENTIALS, /**< Provided credentials were invalid. */ + TLS_TRANSPORT_HANDSHAKE_FAILED, /**< Performing TLS handshake with server failed. */ + TLS_TRANSPORT_INTERNAL_ERROR, /**< A call to a system API resulted in an internal error. */ + TLS_TRANSPORT_CONNECT_FAILURE /**< Initial connection to the server failed. */ +} TlsTransportStatus_t; + +/** + * @brief Create a TLS connection with FreeRTOS sockets. + * + * @param[out] pNetworkContext Pointer to a network context to contain the + * initialized socket handle. + * @param[in] pHostName The hostname of the remote endpoint. + * @param[in] port The destination port. + * @param[in] pNetworkCredentials Credentials for the TLS connection. + * @param[in] receiveTimeoutMs Receive socket timeout. + * @param[in] sendTimeoutMs Send socket timeout. + * + * @return #TLS_TRANSPORT_SUCCESS, #TLS_TRANSPORT_INSUFFICIENT_MEMORY, #TLS_TRANSPORT_INVALID_CREDENTIALS, + * #TLS_TRANSPORT_HANDSHAKE_FAILED, #TLS_TRANSPORT_INTERNAL_ERROR, or #TLS_TRANSPORT_CONNECT_FAILURE. + */ +TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, + const char * pHostName, + uint16_t port, + const NetworkCredentials_t * pNetworkCredentials, + uint32_t receiveTimeoutMs, + uint32_t sendTimeoutMs ); + +/** + * @brief Gracefully disconnect an established TLS connection. + * + * @param[in] pNetworkContext Network context. + */ +void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext ); + +/** + * @brief Receives data from an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportRecv_t function. + * + * @param[in] pNetworkContext The Network context. + * @param[out] pBuffer Buffer to receive bytes into. + * @param[in] bytesToRecv Number of bytes to receive from the network. + * + * @return Number of bytes (> 0) received if successful; + * 0 if the socket times out without reading any bytes; + * negative value on error. + */ +int32_t TLS_FreeRTOS_recv( NetworkContext_t * pNetworkContext, + void * pBuffer, + size_t bytesToRecv ); + +/** + * @brief Sends data over an established TLS connection. + * + * This is the TLS version of the transport interface's + * #TransportSend_t function. + * + * @param[in] pNetworkContext The network context. + * @param[in] pBuffer Buffer containing the bytes to send. + * @param[in] bytesToSend Number of bytes to send from the buffer. + * + * @return Number of bytes (> 0) sent on success; + * 0 if the socket times out without sending any bytes; + * else a negative value to represent error. + */ +int32_t TLS_FreeRTOS_send( NetworkContext_t * pNetworkContext, + const void * pBuffer, + size_t bytesToSend ); + +#endif /* ifndef USING_WOLFSSL_H */ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface new file mode 160000 index 000000000..d35316b3c --- /dev/null +++ b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface @@ -0,0 +1 @@ +Subproject commit d35316b3c7f46e79a776bae954ee79556d41ea7b diff --git a/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_cellular.c b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_cellular.c new file mode 100644 index 000000000..7c4d916aa --- /dev/null +++ b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_cellular.c @@ -0,0 +1,96 @@ +/* + * FreeRTOS V202107.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 mbedtls_bio_freertos_cellular.c + * @brief Implements mbed TLS platform send/receive functions for cellular. + */ + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "FreeRTOS_Sockets.h" + +/* mbed TLS includes. */ +#include "mbedtls_config.h" +#include "threading_alt.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ssl.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Sends data over cellular sockets. + * + * @param[in] ctx The network context containing the socket handle. + * @param[in] buf Buffer containing the bytes to send. + * @param[in] len Number of bytes to send from the buffer. + * + * @return Number of bytes sent on success; else a negative value. + */ +int mbedtls_cellular_send( void * ctx, + const unsigned char * buf, + size_t len ) +{ + configASSERT( ctx != NULL ); + configASSERT( buf != NULL ); + + return Sockets_Send( ( Socket_t ) ctx, buf, len ); +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Receives data from cellular socket. + * + * @param[in] ctx The network context containing the socket handle. + * @param[out] buf Buffer to receive bytes into. + * @param[in] len Number of bytes to receive from the network. + * + * @return Number of bytes received if successful; Negative value on error. + */ +int mbedtls_cellular_recv( void * ctx, + unsigned char * buf, + size_t len ) +{ + int recvStatus = 0; + int returnStatus = -1; + + configASSERT( ctx != NULL ); + configASSERT( buf != NULL ); + + recvStatus = Sockets_Recv( ( Socket_t ) ctx, buf, len ); + + if( recvStatus < 0 ) + { + returnStatus = MBEDTLS_ERR_SSL_INTERNAL_ERROR; + } + else + { + returnStatus = recvStatus; + } + + return returnStatus; +} diff --git a/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_plus_tcp.c b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_plus_tcp.c new file mode 100644 index 000000000..4cc1e3cb3 --- /dev/null +++ b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_bio_freertos_plus_tcp.c @@ -0,0 +1,136 @@ +/* + * FreeRTOS V202107.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 mbedtls_bio_freertos_plus_tcp.c + * @brief Implements mbed TLS platform send/receive functions for freertos plus tcp. + */ + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "FreeRTOS_Sockets.h" + +/* mbed TLS includes. */ +#include "mbedtls_config.h" +#include "threading_alt.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ssl.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Sends data over FreeRTOS+TCP sockets. + * + * @param[in] ctx The network context containing the socket handle. + * @param[in] buf Buffer containing the bytes to send. + * @param[in] len Number of bytes to send from the buffer. + * + * @return Number of bytes sent on success; else a negative value. + */ +int mbedtls_platform_send( void * ctx, + const unsigned char * buf, + size_t len ) +{ + BaseType_t sendStatus = 0; + int returnStatus = -1; + + configASSERT( ctx != NULL ); + configASSERT( buf != NULL ); + + sendStatus = FreeRTOS_send( ( Socket_t ) ctx, buf, len, 0 ); + + switch( sendStatus ) + { + /* Socket was closed or just got closed. */ + case -pdFREERTOS_ERRNO_ENOTCONN: + /* Not enough memory for the socket to create either an Rx or Tx stream. */ + case -pdFREERTOS_ERRNO_ENOMEM: + /* Socket is not valid, is not a TCP socket, or is not bound. */ + case -pdFREERTOS_ERRNO_EINVAL: + /* Socket received a signal, causing the read operation to be aborted. */ + case -pdFREERTOS_ERRNO_EINTR: + returnStatus = MBEDTLS_ERR_SSL_INTERNAL_ERROR; + break; + + /* A timeout occurred before any data could be sent. */ + case -pdFREERTOS_ERRNO_ENOSPC: + returnStatus = MBEDTLS_ERR_SSL_TIMEOUT; + break; + + default: + returnStatus = ( int ) sendStatus; + break; + } + + return returnStatus; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Receives data from FreeRTOS+TCP socket. + * + * @param[in] ctx The network context containing the socket handle. + * @param[out] buf Buffer to receive bytes into. + * @param[in] len Number of bytes to receive from the network. + * + * @return Number of bytes received if successful; Negative value on error. + */ +int mbedtls_platform_recv( void * ctx, + unsigned char * buf, + size_t len ) +{ + BaseType_t recvStatus = 0; + int returnStatus = -1; + + configASSERT( ctx != NULL ); + configASSERT( buf != NULL ); + + recvStatus = FreeRTOS_recv( ( Socket_t ) ctx, buf, len, 0 ); + + switch( recvStatus ) + { + /* No data could be sent because the socket was or just got closed. */ + case -pdFREERTOS_ERRNO_ENOTCONN: + /* No data could be sent because there was insufficient memory. */ + case -pdFREERTOS_ERRNO_ENOMEM: + /* No data could be sent because xSocket was not a valid TCP socket. */ + case -pdFREERTOS_ERRNO_EINVAL: + returnStatus = MBEDTLS_ERR_SSL_INTERNAL_ERROR; + break; + + /* A timeout occurred before any data could be received. */ + case 0: + returnStatus = MBEDTLS_ERR_SSL_WANT_READ; + break; + + default: + returnStatus = ( int ) recvStatus; + break; + } + + return returnStatus; +} diff --git a/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_freertos_port.c b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_freertos_port.c index 9b1c37020..fd6aa7133 100644 --- a/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_freertos_port.c +++ b/FreeRTOS-Plus/Source/Utilities/mbedtls_freertos/mbedtls_freertos_port.c @@ -98,107 +98,6 @@ void mbedtls_platform_free( void * ptr ) /*-----------------------------------------------------------*/ -/** - * @brief Sends data over FreeRTOS+TCP sockets. - * - * @param[in] ctx The network context containing the socket handle. - * @param[in] buf Buffer containing the bytes to send. - * @param[in] len Number of bytes to send from the buffer. - * - * @return Number of bytes sent on success; else a negative value. - */ -int mbedtls_platform_send( void * ctx, - const unsigned char * buf, - size_t len ) -{ - Socket_t socket; - BaseType_t sendStatus = 0; - int returnStatus = -1; - - configASSERT( ctx != NULL ); - configASSERT( buf != NULL ); - - socket = ( Socket_t ) ctx; - sendStatus = FreeRTOS_send( socket, buf, len, 0 ); - - switch( sendStatus ) - { - /* Socket was closed or just got closed. */ - case -pdFREERTOS_ERRNO_ENOTCONN: - /* Not enough memory for the socket to create either an Rx or Tx stream. */ - case -pdFREERTOS_ERRNO_ENOMEM: - /* Socket is not valid, is not a TCP socket, or is not bound. */ - case -pdFREERTOS_ERRNO_EINVAL: - /* Socket received a signal, causing the read operation to be aborted. */ - case -pdFREERTOS_ERRNO_EINTR: - returnStatus = MBEDTLS_ERR_SSL_INTERNAL_ERROR; - break; - - /* A timeout occurred before any data could be sent. */ - case -pdFREERTOS_ERRNO_ENOSPC: - returnStatus = MBEDTLS_ERR_SSL_TIMEOUT; - break; - - default: - returnStatus = ( int ) sendStatus; - break; - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - -/** - * @brief Receives data from FreeRTOS+TCP socket. - * - * @param[in] ctx The network context containing the socket handle. - * @param[out] buf Buffer to receive bytes into. - * @param[in] len Number of bytes to receive from the network. - * - * @return Number of bytes received if successful; Negative value on error. - */ -int mbedtls_platform_recv( void * ctx, - unsigned char * buf, - size_t len ) -{ - Socket_t socket; - BaseType_t recvStatus = 0; - int returnStatus = -1; - - configASSERT( ctx != NULL ); - configASSERT( buf != NULL ); - - socket = ( Socket_t ) ctx; - - recvStatus = FreeRTOS_recv( socket, buf, len, 0 ); - - switch( recvStatus ) - { - /* No data could be sent because the socket was or just got closed. */ - case -pdFREERTOS_ERRNO_ENOTCONN: - /* No data could be sent because there was insufficient memory. */ - case -pdFREERTOS_ERRNO_ENOMEM: - /* No data could be sent because xSocket was not a valid TCP socket. */ - case -pdFREERTOS_ERRNO_EINVAL: - returnStatus = MBEDTLS_ERR_SSL_INTERNAL_ERROR; - break; - - /* A timeout occurred before any data could be received. */ - case 0: - returnStatus = MBEDTLS_ERR_SSL_WANT_READ; - break; - - default: - returnStatus = ( int ) recvStatus; - break; - } - - return returnStatus; -} - -/*-----------------------------------------------------------*/ - /** * @brief Creates a mutex. * diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSConfig.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSConfig.h new file mode 100644 index 000000000..6813adb5a --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSConfig.h @@ -0,0 +1,209 @@ +/* + * FreeRTOS V202107.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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.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 ( 1L ) + +/* 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 0x6a + +/* 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/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h new file mode 100644 index 000000000..12c57c3d6 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h @@ -0,0 +1,309 @@ +/* + * FreeRTOS V202107.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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + */ + + +/***************************************************************************** +* +* See the following URL for configuration information. +* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ + +#ifndef FREERTOS_IP_CONFIG_H +#define FREERTOS_IP_CONFIG_H + +/* Prototype for the function used to print out. In this case it prints to the + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 1 +#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) + #define FreeRTOS_debug_printf( X ) printf 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 ) printf 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 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/Test/FreeRTOS-Cellular-Interface/Integration/FreeRTOS-Cellular-Interface-Integration.sln b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/FreeRTOS-Cellular-Interface-Integration.sln new file mode 100644 index 000000000..f907d968a --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/FreeRTOS-Cellular-Interface-Integration.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}" +EndProject +Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_declare.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_declare.h new file mode 100644 index 000000000..fb442f889 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_declare.h @@ -0,0 +1,44 @@ +/* + * FreeRTOS+TCP V2.2.1 + * Copyright (C) 2019 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +#ifndef _FREERTOS_TCP_TEST_ACCESS_DECLARE_H_ +#define _FREERTOS_TCP_TEST_ACCESS_DECLARE_H_ + +#include +#include "FreeRTOS.h" +#include "FreeRTOS_IP_Private.h" +#include "FreeRTOS_IP.h" +#include "portmacro.h" + +uint32_t TEST_FreeRTOS_TCP_prvParseDNSReply( uint8_t * pucUDPPayloadBuffer, + size_t xBufferLength, + TickType_t xIdentifier ); + +void TEST_FreeRTOS_TCP_prvCheckOptions( FreeRTOS_Socket_t * pxSocket, + NetworkBufferDescriptor_t * pxNetworkBuffer ); + +void TEST_FreeRTOS_TCP_prvTCPCreateWindow( FreeRTOS_Socket_t * pxSocket ); + +#endif /* ifndef _FREERTOS_TCP_TEST_ACCESS_DECLARE_H_ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_dns_define.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_dns_define.h new file mode 100644 index 000000000..14edf71ed --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_dns_define.h @@ -0,0 +1,48 @@ +/* + * FreeRTOS+TCP V2.2.1 + * Copyright (C) 2019 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file aws_ota_pal_test_access_define.h + * @brief Function wrappers that access private methods in aws_ota_pal.c. + * + * Needed for testing private functions. + */ + +#ifndef _FREERTOS_TCP_TEST_ACCESS_DNS_DEFINE_H_ +#define _FREERTOS_TCP_TEST_ACCESS_DNS_DEFINE_H_ + +#include "freertos_tcp_test_access_declare.h" + +/*-----------------------------------------------------------*/ + +uint32_t TEST_FreeRTOS_TCP_prvParseDNSReply( uint8_t * pucUDPPayloadBuffer, + size_t xBufferLength, + TickType_t xIdentifier ) +{ + return prvParseDNSReply( pucUDPPayloadBuffer, xBufferLength, xIdentifier ); +} +/*-----------------------------------------------------------*/ + +#endif /* ifndef _AWS_FREERTOS_TCP_TEST_ACCESS_DNS_DEFINE_H_ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_tcp_define.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_tcp_define.h new file mode 100644 index 000000000..5debdb7b6 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/freertos_tcp_test_access_tcp_define.h @@ -0,0 +1,53 @@ +/* + * FreeRTOS+TCP V2.2.1 + * Copyright (C) 2019 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file aws_ota_pal_test_access_define.h + * @brief Function wrappers that access private methods in aws_ota_pal.c. + * + * Needed for testing private functions. + */ + +#ifndef _FREERTOS_TCP_TEST_ACCESS_TCP_DEFINE_H_ +#define _FREERTOS_TCP_TEST_ACCESS_TCP_DEFINE_H_ + +#include "freertos_tcp_test_access_declare.h" + +/*-----------------------------------------------------------*/ + +void TEST_FreeRTOS_TCP_prvCheckOptions( FreeRTOS_Socket_t * pxSocket, + NetworkBufferDescriptor_t * pxNetworkBuffer ) +{ + prvCheckOptions( pxSocket, pxNetworkBuffer ); +} +/*-----------------------------------------------------------*/ + +void TEST_FreeRTOS_TCP_prvTCPCreateWindow( FreeRTOS_Socket_t * pxSocket ) +{ + prvTCPCreateWindow( pxSocket ); +} +/*-----------------------------------------------------------*/ + +#endif /* ifndef _AWS_FREERTOS_TCP_TEST_ACCESS_TCP_DEFINE_H_ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/test_freertos_tcp.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/test_freertos_tcp.c new file mode 100644 index 000000000..aa00e4671 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Cases/test_freertos_tcp.c @@ -0,0 +1,369 @@ +/* + * FreeRTOS+TCP V2.2.1 + * Copyright (C) 2019 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/* Standard includes. */ +#include +#include +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "list.h" +#include "FreeRTOS_IP.h" +#include "FreeRTOS_IP_Private.h" +#include "FreeRTOS_DNS.h" + +/* Test includes. */ +#include "unity_fixture.h" +#include "unity.h" +#include "freertos_tcp_test_access_declare.h" + +/** + * @brief Configuration for this test group. + */ + +/* + * @brief Test group definition. + */ +TEST_GROUP( Full_FREERTOS_TCP ); + +TEST_SETUP( Full_FREERTOS_TCP ) +{ +} + +TEST_TEAR_DOWN( Full_FREERTOS_TCP ) +{ +} + +TEST_GROUP_RUNNER( Full_FREERTOS_TCP ) +{ + /* Run a parser test. */ + RUN_TEST_CASE( Full_FREERTOS_TCP, prvParseDnsResponse ); + RUN_TEST_CASE( Full_FREERTOS_TCP, ulDNSHandlePacket ); + + /* prvCheckOptions test. */ + RUN_TEST_CASE( Full_FREERTOS_TCP, prvCheckOptions ); + + /* xProcessReceivedUDPPacket test. */ + RUN_TEST_CASE( Full_FREERTOS_TCP, UDPPacketLength ); +} + +TEST( Full_FREERTOS_TCP, prvParseDnsResponse ) +{ + uint8_t ucGoodDnsResponse[] = + { + 0xd7, 0x66, 0x81, 0x80, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x61, 0x33, 0x37, + 0x62, 0x78, 0x76, 0x31, 0x63, 0x62, 0x64, 0x61, 0x33, 0x6a, 0x67, 0x03, 0x69, 0x6f, 0x74, 0x09, + 0x75, 0x73, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x2d, 0x32, 0x09, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, + 0x61, 0x77, 0x73, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, + 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x1e, 0x0c, 0x69, 0x6f, 0x74, 0x6d, 0x6f, 0x6f, 0x6e, + 0x72, 0x61, 0x6b, 0x65, 0x72, 0x09, 0x75, 0x73, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x2d, 0x32, 0x04, + 0x70, 0x72, 0x6f, 0x64, 0xc0, 0x1b, 0xc0, 0x48, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xec, + 0x00, 0x45, 0x09, 0x64, 0x75, 0x61, 0x6c, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2a, 0x69, 0x6f, 0x74, + 0x6d, 0x6f, 0x6f, 0x6e, 0x72, 0x61, 0x6b, 0x65, 0x72, 0x2d, 0x75, 0x2d, 0x65, 0x6c, 0x62, 0x2d, + 0x31, 0x77, 0x38, 0x71, 0x6e, 0x77, 0x31, 0x33, 0x33, 0x36, 0x7a, 0x71, 0x2d, 0x31, 0x31, 0x38, + 0x36, 0x33, 0x34, 0x38, 0x30, 0x39, 0x32, 0x09, 0x75, 0x73, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x2d, + 0x32, 0x03, 0x65, 0x6c, 0x62, 0xc0, 0x29, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x22, 0xd3, 0x41, 0xdb, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x22, 0xd3, 0x53, 0xe4, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x22, 0xd3, 0xb6, 0x17, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x22, 0xd6, 0xf5, 0xf0, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x22, 0xd7, 0xe6, 0xa4, 0xc0, 0x72, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x04, 0x36, 0x95, 0x5e, 0x45 + }; + const uint32_t ulExpectedAddress = 0xf0f5d622; + uint8_t ucBadDnsResponseA[] = + { + 0x3b, 0x6a, 0x81, 0x83, 0x01, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x69, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x08, 0x75, 0x73, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x32, 0x09, + 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x61, 0x77, 0x73, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, + 0x00, 0x01, 0xc0, 0x1f, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x33, 0x0e, 0x64, + 0x6e, 0x73, 0x2d, 0x64, 0x79, 0x6e, 0x2d + }; + uint8_t ucBadDnsResponseB[] = + { + 0xf0, 0x23, 0x81, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x05, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, + 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x01, 0x7c, 0x00, 0x1b, 0x03, 0x77, 0x77, 0x77, 0x05, + 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x07, 0x65, 0x64, 0x67, 0x65, 0x6b, 0x65, + 0x79, 0x03, 0x6e, 0x65, 0x74, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x1a, 0xd5, + 0x00, 0x2f, 0x03, 0x77, 0x77, 0x77, 0x05, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, + 0x07, 0x65, 0x64, 0x67, 0x65, 0x6b, 0x65, 0x79, 0x03, 0x6e, 0x65, 0x74, 0x0b, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x06, 0x61, 0x6b, 0x61, 0x64, 0x6e, 0x73, 0xc0, + 0x41, 0xc0, 0x52, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x08, 0xb3, 0x00, 0x19, 0x05, 0x65, 0x36, + 0x38, 0x35, 0x38, 0x05, 0x64, 0x73, 0x63, 0x65, 0x39, 0x0a, 0x61, 0x6b, 0x61, 0x6d, 0x61, 0x69, + 0x65, 0x64, 0x67, 0x65, 0xc0, 0x41, 0xc0, 0x8d, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, + 0x00, 0x04, 0x17, 0x4a, 0x3e, 0x96 + }; + uint8_t ucBadDnsResponseC[] = + { + 0x3b, 0xa3, 0x81, 0x80, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x09, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66 + }; + uint8_t ucBadDnsResponseD[] = + { + 0x95, 0x1e, 0x81, 0x80, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x03, 0x63, 0x6e, 0x6e, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x1b, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x72, + 0x2d, 0x74, 0x6c, 0x73, 0x03, 0x6d, 0x61, 0x70, 0x06, 0x66, 0x61, 0x73, 0x74, 0x6c, 0x79, 0x03, + 0x6e, 0x65, 0x74, 0x00, 0xc0, 0x29, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, + 0x97, 0x65, 0x35, 0x43 + }; + uint8_t ucBadDnsResponseE[] = + { + 0xa8, 0x6d, 0x81, 0x80, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x05, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, + 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x03, 0x77, 0x77, 0x77, 0x05, + 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x07, 0x65, 0x64, 0x67, 0x65, 0x6b, 0x65, + 0x79, 0x03, 0x6e, 0x65, 0x74, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x1c, 0x2c, + 0x00, 0x2f, 0x03, 0x77, 0x77, 0x77, 0x05, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, + 0x07, 0x65, 0x64, 0x67, 0x65, 0x6b, 0x65, 0x79, 0x03, 0x6e, 0x65, 0x74, 0x0b, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x06, 0x61, 0x6b, 0x61, 0x64, 0x6e, 0x73, 0xc0, + 0x41, 0xc0, 0x52, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x03, 0xd7, 0x00, 0x19, 0x05, 0x65, 0x36, + 0x38, 0x35, 0x38, 0x05, 0x64, 0x73, 0x63, 0x65, 0x39, 0x0a, 0x61, 0x6b, 0x61, 0x6d, 0x61, 0x69, + 0x65, 0x64, 0x67, 0x65, 0xc0, 0x41, 0xc0, 0x8d, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, + 0x00, 0x04, 0x17, 0x4b, 0xba, 0x13 + }; + uint8_t ucBadDnsResponseF[] = + { + 0x6c, 0x1e, 0x81, 0x80, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x06, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, + 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x01, 0x57, 0x00, 0x0a, 0x03, 0x77, 0x77, 0x77, + 0x03, 0x63, 0x64, 0x6e, 0xc0, 0x10, 0x41, 0x41, 0xc0, 0x2c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x17, 0x00, 0x1f, 0x0e, 0x64, 0x33, 0x61, 0x67, 0x34, 0x68, 0x75, 0x6b, 0x6b, 0x68, 0x36, + 0x32, 0x79, 0x6e, 0x0a, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x03, 0x6e, + 0x65, 0x74, 0x00, 0xc0, 0x42, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x04, 0x0d, + 0x20, 0xa7, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x9a, 0x3a, 0x01, 0x5c, 0x31, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + }; + uint8_t ucBadDnsResponseG[] = + { + 0x73, 0xe1, 0x81, 0x80, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, + 0x06, 0x22, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x04, 0xd8, 0x3a, 0xd8, 0x84, 0x00, 0x34, 0x02, 0x41, 0x01, + 0x2c, 0xb2, 0x1a, 0x01, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + }; + uint8_t ucBadDnsResponseH[] = /* Regress crash in prvReadNameField. */ + { + 0x10, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x35, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + uint8_t ucBadDnsResponseI[] = /* Regress crash in prvSkipNameField. */ + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x35, + 0x0a, 0xf8, 0xf8, 0xf8, 0x27, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x16, 0x16, 0x21, 0x16, + 0x16, 0x16, 0x16, 0x16, 0x16, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, + 0x27, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x16, 0x16, 0x16, 0x16, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x16, 0x5a, + 0x00, 0x16, 0x00, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x21 + }; + uint32_t ulAddress = 0; + + /* Parsing a valid packet should succeed. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucGoodDnsResponse, + sizeof( ucGoodDnsResponse ), + *( uint16_t * ) ucGoodDnsResponse ); + TEST_ASSERT_EQUAL_UINT32( ulExpectedAddress, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseA, + sizeof( ucBadDnsResponseA ), + *( uint16_t * ) ucBadDnsResponseA ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseB, + sizeof( ucBadDnsResponseB ), + *( uint16_t * ) ucBadDnsResponseB ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseC, + sizeof( ucBadDnsResponseC ), + *( uint16_t * ) ucBadDnsResponseC ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseD, + sizeof( ucBadDnsResponseD ), + *( uint16_t * ) ucBadDnsResponseD ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseE, + sizeof( ucBadDnsResponseE ), + *( uint16_t * ) ucBadDnsResponseE ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseF, + sizeof( ucBadDnsResponseF ), + *( uint16_t * ) ucBadDnsResponseF ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseG, + sizeof( ucBadDnsResponseG ), + *( uint16_t * ) ucBadDnsResponseG ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseH, + sizeof( ucBadDnsResponseH ), + *( uint16_t * ) ucBadDnsResponseH ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ + + /* Parsing a bad packet should fail gracefully. */ + ulAddress = TEST_FreeRTOS_TCP_prvParseDNSReply( + ucBadDnsResponseI, + sizeof( ucBadDnsResponseI ), + *( uint16_t * ) ucBadDnsResponseI ); + TEST_ASSERT_EQUAL_UINT32( 0, ulAddress ); + /* End test. */ +} + +TEST( Full_FREERTOS_TCP, ulDNSHandlePacket ) +{ + NetworkBufferDescriptor_t xNetworkBuffer = { 0 }; + uint8_t ucPartialUdpPacket[ sizeof( ipSIZE_OF_UDP_HEADER ) - 1 ] = { 0xFF }; + uint32_t ulResult = 0; + + /* Attempting to parse a packet that's shorter than a UDP header should be + * a no-op. */ + xNetworkBuffer.pucEthernetBuffer = ucPartialUdpPacket; + xNetworkBuffer.xDataLength = sizeof( ucPartialUdpPacket ); + ulResult = ulDNSHandlePacket( &xNetworkBuffer ); + TEST_ASSERT_EQUAL_UINT32( 0, ulResult ); +} + +TEST( Full_FREERTOS_TCP, prvCheckOptions ) +{ + uint8_t ucDivideByZero[] = + { + 0x6f, 0xff, 0xff, 0xff, 0x0a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x6f, 0x6f, 0x6d, + 0x6f, 0xff, 0xff, 0xff, 0x0a, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x6f, 0x6f, + 0x6f, 0x6f, 0x6f, 0x6b, 0xbf, 0x6f, 0x03, 0xff, 0x04, 0x01, 0xb7, 0xff, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, + 0x02, 0x02, 0xf8, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x05 + }; + + FreeRTOS_Socket_t xSocket; + NetworkBufferDescriptor_t xNetworkBuffer; + + xNetworkBuffer.pucEthernetBuffer = ucDivideByZero; + xNetworkBuffer.xDataLength = sizeof( ucDivideByZero ); + + TEST_FreeRTOS_TCP_prvTCPCreateWindow( &xSocket ); + TEST_FreeRTOS_TCP_prvCheckOptions( &xSocket, &xNetworkBuffer ); +} + +TEST( Full_FREERTOS_TCP, UDPPacketLength ) +{ + uint8_t ucBadUdpPacketA[] = + { + 0xff, 0xff + }; + + uint8_t ucBadUdpPacketB[] = + { + 0x0a, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x54, 0xbf, 0xbf, 0xbf, 0xff, 0xbf, + 0x0a, 0xbf, 0xbf, 0xbf, 0x3f, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0x88, 0x00, 0xbf, 0xbf, 0xbf, 0x00, 0x32, 0xbf, 0xbf, 0xbf, 0x00, 0x35, + 0x0a, 0xbf, 0xbf, 0x3a, 0xbf, 0xbf, 0xbf + }; + + BaseType_t xReturn = pdPASS; + uint16_t usPort = 65535; + NetworkBufferDescriptor_t xNetworkBuffer; + + /* This test fails now since there is an assert + * checking for NULL pucEthernetBuffer. Also, the + * next tests do not run and this whole test case + * is scrapped. + * + * xNetworkBuffer.pucEthernetBuffer = NULL; + * xNetworkBuffer.xDataLength = 0; + * + * xReturn = xProcessReceivedUDPPacket( &xNetworkBuffer, usPort ); + * TEST_ASSERT_EQUAL_UINT32_MESSAGE( pdFAIL, xReturn, "Failed to parse 0 size packet" ); + */ + + + xNetworkBuffer.pucEthernetBuffer = ucBadUdpPacketA; + xNetworkBuffer.xDataLength = sizeof( ucBadUdpPacketA ); + xReturn = xProcessReceivedUDPPacket( &xNetworkBuffer, usPort ); + TEST_ASSERT_EQUAL_UINT32_MESSAGE( pdFAIL, xReturn, "Failed to parse 2 bytes packet" ); + + xNetworkBuffer.pucEthernetBuffer = ucBadUdpPacketB; + xNetworkBuffer.xDataLength = sizeof( ucBadUdpPacketB ); + xReturn = xProcessReceivedUDPPacket( &xNetworkBuffer, usPort ); + TEST_ASSERT_EQUAL_UINT32( pdFAIL, xReturn ); +} diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.c new file mode 100644 index 000000000..4b0386b61 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.c @@ -0,0 +1,108 @@ +/* + * FreeRTOS V202107.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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file aws_test_runner.c + * @brief The function to be called to run all the tests. + */ + +/* Test runner interface includes. */ +#include "test_runner.h" + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unity framework includes. */ +#include "unity_fixture.h" +#include "unity_internals.h" + +char cBuffer[ testrunnerBUFFER_SIZE ]; + +/* Heap leak variables. */ +unsigned int xHeapBefore; +unsigned int xHeapAfter; +/*-----------------------------------------------------------*/ + +/* This function will be generated by the test automation framework, + * do not change the signature of it. You could, however, add or remove + * RUN_TEST_GROUP statements. + */ +static void RunTests( void ) +{ + RUN_TEST_GROUP( Full_FREERTOS_TCP ); +} +/*-----------------------------------------------------------*/ + +void TEST_RUNNER_RunTests_task( void * pvParameters ) +{ + /* Disable unused parameter warning. */ + ( void ) pvParameters; + + /* Initialize unity. */ + UnityFixture.Verbose = 1; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = testrunnerTEST_FILTER; + UnityFixture.RepeatCount = 1; + + UNITY_BEGIN(); + + /* Give the print buffer time to empty */ + vTaskDelay( pdMS_TO_TICKS( 500 ) ); + /* Measure the heap size before any tests are run. */ + #if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 ) + xHeapBefore = xPortGetFreeHeapSize(); + #endif + + RunTests(); + + #if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 ) + + /* Measure the heap size after tests are done running. + * This test must run last. */ + + /* Perform any global resource cleanup necessary to avoid memory leaks. */ + #ifdef testrunnerMEMORYLEAK_CLEANUP + testrunnerMEMORYLEAK_CLEANUP(); + #endif + + /* Give the print buffer time to empty */ + vTaskDelay( pdMS_TO_TICKS( 500 ) ); + xHeapAfter = xPortGetFreeHeapSize(); + RUN_TEST_GROUP( Full_MemoryLeak ); + #endif /* if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 ) */ + + /* Currently disabled. Will be enabled after cleanup. */ + UNITY_END(); + + #ifdef CODE_COVERAGE + exit( 0 ); + #endif + + /* This task has finished. FreeRTOS does not allow a task to run off the + * end of its implementing function, so the task must be deleted. */ + vTaskDelete( NULL ); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.h new file mode 100644 index 000000000..d422d5b98 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner.h @@ -0,0 +1,77 @@ +/* + * FreeRTOS V202107.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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file aws_test_runner.h + * @brief The function to be called to run all the tests. + */ + +#ifndef _TEST_RUNNER_H_ +#define _TEST_RUNNER_H_ + +#include "test_runner_config.h" + +/* + * @brief If set to 1, will run DQP_FR tests only. + */ +#ifdef testrunnerAFQP_ENABLED + #define testrunnerTEST_FILTER "AFQP" +#else + #define testrunnerTEST_FILTER 0 +#endif + +/** + * @brief Size of shared array. + * + */ +#define testrunnerBUFFER_SIZE ( 4000 ) + +/** + * @brief Buffer used for all tests. + * + * Since tests are run in series, they can use the same memory array. + * This makes significant heap savings. + */ +extern char cBuffer[ testrunnerBUFFER_SIZE ]; + +/** + * @brief FreeRTOS heap measurement taken before tests are run. + */ +extern unsigned int xHeapBefore; + +/** + * @brief FreeRTOS heap measurement taken after all tests are run. + */ +extern unsigned int xHeapAfter; + + +/** + * @brief Runs all the tests. + */ +void TEST_RUNNER_RunTests_task( void * pvParameters ); + + + +#endif /* _AWS_TEST_RUNNER_H_ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner_config.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner_config.h new file mode 100644 index 000000000..2af2e5af2 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/Test_Runner/test_runner_config.h @@ -0,0 +1,76 @@ +/* + * FreeRTOS V202107.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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +#ifndef AWS_TEST_RUNNER_CONFIG_H +#define AWS_TEST_RUNNER_CONFIG_H + +/* Uncomment this line if you want to run DQP_FR tests only. */ +/* #define testrunnerAFQP_ENABLED */ + +#define testrunnerUNSUPPORTED 0 + +#define FREERTOS_ENABLE_UNIT_TESTS 1 + +/* Unsupported tests. */ +#define testrunnerFULL_WIFI_ENABLED testrunnerUNSUPPORTED +#define testrunnerFULL_BLE_ENABLED testrunnerUNSUPPORTED +#define testrunnerFULL_BLE_END_TO_END_TEST_ENABLED testrunnerUNSUPPORTED + +/* Supported tests. 0 = Disabled, 1 = Enabled */ +#define testrunnerFULL_TASKPOOL_ENABLED 0 +#define testrunnerFULL_CRYPTO_ENABLED 0 +#define testrunnerFULL_FREERTOS_TCP_ENABLED 1 +#define testrunnerFULL_DEFENDER_ENABLED 0 +#define testrunnerFULL_GGD_ENABLED 0 +#define testrunnerFULL_GGD_HELPER_ENABLED 0 +#define testrunnerFULL_MQTT_AGENT_ENABLED 0 +#define testrunnerFULL_MQTT_ALPN_ENABLED 0 +#define testrunnerFULL_MQTT_STRESS_TEST_ENABLED 0 +#define testrunnerFULL_MQTTv4_ENABLED 0 +#define testrunnerFULL_PKCS11_ENABLED 0 +#define testrunnerFULL_PKCS11_MODEL_ENABLED 0 +#define testrunnerFULL_POSIX_ENABLED 0 +#define testrunnerFULL_SHADOW_ENABLED 0 +#define testrunnerFULL_SHADOWv4_ENABLED 0 +#define testrunnerFULL_TCP_ENABLED 0 +#define testrunnerFULL_TLS_ENABLED 0 +#define testrunnerFULL_MEMORYLEAK_ENABLED 0 +#define testrunnerFULL_OTA_CBOR_ENABLED 0 +#define testrunnerFULL_OTA_AGENT_ENABLED 0 +#define testrunnerFULL_OTA_PAL_ENABLED 0 +#define testrunnerFULL_SERIALIZER_ENABLED 0 +#define testrunnerUTIL_PLATFORM_CLOCK_ENABLED 0 +#define testrunnerUTIL_PLATFORM_THREADS_ENABLED 0 +#define testrunnerFULL_HTTPS_CLIENT_ENABLED 0 + +/* On systems using FreeRTOS+TCP (such as this one) the TCP segments must be + * cleaned up before running the memory leak check. */ +#if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 ) + extern void vTCPSegmentCleanup(); + #define testrunnerMEMORYLEAK_CLEANUP() vTCPSegmentCleanup() +#endif + +#endif /* AWS_TEST_RUNNER_CONFIG_H */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_cellular_api.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_cellular_api.c new file mode 100644 index 000000000..b1f438fc1 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_cellular_api.c @@ -0,0 +1,2819 @@ +/* + * FreeRTOS Cellular Release + * Copyright (C) 2021 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/* stdlib includes. */ +#include "string.h" +#include "stdio.h" + +/* Cellular include. */ +#include "cellular_config.h" +#include "cellular_config_defaults.h" +#include "cellular_platform.h" +#include "cellular_api.h" +#include "cellular_types.h" +#include "cellular_comm_interface.h" + +/* Testing variable includes. */ +#include "test_config.h" + +/* Unity framework includes. */ +#include "unity_fixture.h" + +/*-----------------------------------------------------------*/ + +/* Testing configurations definitions. */ + +/* Retry until SIM is ready. */ +#ifndef CELLULAR_MAX_SIM_RETRY + #define CELLULAR_MAX_SIM_RETRY ( 5U ) +#endif + +/* + * 2 GSM + * 3 UTRAN + * 4 LTE Cat M1 + * 5 LTE Cat NB1 + */ +#ifndef testCELLULAR_EDRX_RAT + #define testCELLULAR_EDRX_RAT ( 4 ) +#endif + +#ifndef testCELLULAR_SOCKET_CONNECTION_TIMEOUT_MS + #define testCELLULAR_SOCKET_CONNECTION_TIMEOUT_MS ( 150000U ) +#endif + +#ifndef testCELLULAR_SOCKET_SEND_TIMEOUT_MS + #define testCELLULAR_SOCKET_SEND_TIMEOUT_MS ( 60000U ) +#endif + +#ifndef testCELLULAR_SOCKET_CLOSE_TIMEOUT_MS + #define testCELLULAR_SOCKET_CLOSE_TIMEOUT_MS ( 60000U ) +#endif + +#ifndef testCELLULAR_SOCKET_RECEIVE_TIMEOUT_MS + #define testCELLULAR_SOCKET_RECEIVE_TIMEOUT_MS ( 5000U ) +#endif + +#ifndef testCELLULAR_MAX_NETWORK_REGISTER_RETRY + #define testCELLULAR_MAX_NETWORK_REGISTER_RETRY ( 40U ) +#endif + +#ifndef testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS + #define testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS ( 500U ) +#endif + +/* Retry until SIM is ready. */ +#ifndef testCELLULAR_MAX_SIM_RETRY + #define testCELLULAR_MAX_SIM_RETRY ( 5U ) +#endif + +#ifndef testCELLULAR_SIM_RETRY_INTERVAL_MS + #define testCELLULAR_SIM_RETRY_INTERVAL_MS ( 500U ) +#endif + +#ifndef testCELLULAR_MAX_GET_PSM_RETRY + #define testCELLULAR_MAX_GET_PSM_RETRY ( 5U ) +#endif + +#ifndef testCELLULAR_GET_PSM_RETRY_INTERVAL_MS + #define testCELLULAR_GET_PSM_RETRY_INTERVAL_MS ( 500U ) +#endif + +#ifndef testCELLULAR_SOCKET_WAIT_INTERVAL_MS + #define testCELLULAR_SOCKET_WAIT_INTERVAL_MS ( 2000UL ) +#endif + +#ifndef testCELLULAR_GET_RAT_RETRY + #define testCELLULAR_GET_RAT_RETRY ( 5UL ) +#endif + +#ifndef testCELLULAR_GET_RAT_RETRY_INTERVAL_MS + #define testCELLULAR_GET_RAT_RETRY_INTERVAL_MS ( 200U ) +#endif + +#ifndef testCELLULAR_WAIT_PSM_ENTER_EVENT_RETRY + #define testCELLULAR_WAIT_PSM_ENTER_EVENT_RETRY ( 2U ) +#endif + +#ifndef testCELLULAR_MAX_PDN_STATSU_NUM + #define testCELLULAR_MAX_PDN_STATSU_NUM ( CELLULAR_PDN_CONTEXT_ID_MAX - CELLULAR_PDN_CONTEXT_ID_MIN + 1U ) +#endif + +/* Custom CELLULAR Test asserts. */ +#define TEST_CELLULAR_ASSERT_REQUIRED_API( condition, result ) \ + if( result == CELLULAR_UNSUPPORTED ) \ + { \ + TEST_FAIL_MESSAGE( "Required CELLULAR API is not implemented." ); \ + } \ + else \ + { \ + TEST_ASSERT( condition ); \ + } + +#define TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( condition, result, message ) \ + if( result == CELLULAR_UNSUPPORTED ) \ + { \ + TEST_FAIL_MESSAGE( "Required CELLULAR API is not implemented." ); \ + } \ + else \ + { \ + TEST_ASSERT_MESSAGE( condition, message ); \ + } + +#define TEST_CELLULAR_ASSERT_OPTIONAL_API( condition, result ) \ + if( result == CELLULAR_UNSUPPORTED ) \ + { \ + TEST_ASSERT( 1 ); \ + } \ + else \ + { \ + TEST_ASSERT( condition ); \ + } + +#define TEST_CELLULAR_ASSERT_OPTIONAL_API_MSG( condition, result, message ) \ + if( result == CELLULAR_UNSUPPORTED ) \ + { \ + TEST_ASSERT( 1 ); \ + } \ + else \ + { \ + TEST_ASSERT_MESSAGE( condition, message ); \ + } + +#define TEST_INVALID_CELLULAR_APN "VZWINTERNETVZWINTERNETVZWINTERNETVZWINTERNETVZWINTERNETVZWINTERN" + +#define SOCKET_DATA_RECEIVED_CALLBACK_BIT ( 0x00000001U ) +#define SOCKET_OPEN_CALLBACK_BIT ( 0x00000002U ) +#define SOCKET_OPEN_FAILED_CALLBACK_BIT ( 0x00000004U ) +#define SOCKET_CLOSED_CALLBACK_BIT ( 0x00000008U ) + +#define ECHO_SERVER_DATA_SEND_INTERVAL_MS ( 30000UL ) + +#define MODEM_EVENT_BOOTUP_OR_REBOOT_BIT ( 0x00000001U ) +#define MODEM_EVENT_POWERED_DOWN_BIT ( 0x00000002U ) +#define MODEM_EVENT_PSM_ENTER_BIT ( 0x00000004U ) + +#define SOCKET_OPEN_STATUS_UNKNOWN ( 0U ) +#define SOCKET_OPEN_STATUS_OPENED ( 1U ) +#define SOCKET_OPEN_STATUS_FAILED ( 2U ) + +#define SOCKET_OPERATION_POLLING_TIMES ( 4U ) + +#define MESSAGE_BUFFER_LENGTH ( 256U ) + +/* APN for the test network. */ +#define testCELLULAR_APN CELLULAR_APN + +/* PDN context id for cellular network. */ +#define testCELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID ) + +/* The number of times to loop in the CELLULARConnectionLoop test. */ +#define testCELLULARCONNECTION_LOOP_TIMES ( CELLULAR_NUM_SOCKET_MAX + 3U ) + +#define testCELLULARDATA_TRANSFER_LOOP_TIMES ( 10U ) + +/* RAT priority count for testing. This value should larger or equal to + * CELLULAR_MAX_RAT_PRIORITY_COUNT. */ +#define TEST_MAX_RAT_PRIORITY_COUNT ( 3U ) +#if CELLULAR_MAX_RAT_PRIORITY_COUNT > TEST_MAX_RAT_PRIORITY_COUNT + #error "TEST_MAX_RAT_PRIORITY_COUNT should not larger or equal to CELLULAR_MAX_RAT_PRIORITY_COUNT" +#endif + +#ifndef testCELLULAR_DNS_SERVER_ADDRESS + #error "testCELLULAR_DNS_SERVER_ADDRESS is not defined" +#endif + +#ifndef testCELLULAR_HOST_NAME + #error "testCELLULAR_HOST_NAME is not defined" +#endif + +#ifndef testCELLULAR_HOST_NAME_ADDRESS + #error "testCELLULAR_HOST_NAME_ADDRESS is not defined" +#endif + +#ifndef testCELLULAR_ECHO_SERVER_ADDRESS + #error "testCELLULAR_ECHO_SERVER_ADDRESS is not defined" +#endif + +#ifndef testCELLULAR_ECHO_SERVER_PORT + #error "testCELLULAR_ECHO_SERVER_PORT is not defined" +#endif + +#ifndef testCELLULAR_EDRX_ECHO_SERVER_ADDRESS + #error "testCELLULAR_EDRX_ECHO_SERVER_ADDRESS is not defined" +#endif + +#ifndef testCELLULAR_EDRX_ECHO_SERVER_PORT + #error "testCELLULAR_EDRX_ECHO_SERVER_PORT is not defined" +#endif + +#ifndef testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS + #error "testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS is not defined" +#endif + +/*-----------------------------------------------------------*/ + +/** + * @brief the default Cellular comm interface in system. + */ +extern CellularCommInterface_t CellularCommInterface; + +/*-----------------------------------------------------------*/ + +/* Test state variables. */ +static uint8_t _dataReady = 0; +static CellularHandle_t _cellularHandle = NULL; +static bool _genericUrcCalled = false; +static PlatformEventGroupHandle_t _socketEventGroup = NULL; +static PlatformEventGroupHandle_t _modemEventGroup = NULL; + +/* The callback context to check. */ +static void * _socketDataReadyContext = NULL; +static void * _socketOpenContext = NULL; +static void * _socketClosedContext = NULL; + +/* Socket data send pattern. */ +static const char _socketDataSend[] = "hello from SJC31"; + +/*-----------------------------------------------------------*/ + +/* Network registration callback function. */ +static void prvNetworkRegistrationCallback( CellularUrcEvent_t urcEvent, + const CellularServiceStatus_t * pServiceStatus, + void * pCallbackContext ) +{ + TEST_ASSERT( pCallbackContext == _cellularHandle ); + + if( pServiceStatus != NULL ) + { + if( ( urcEvent == CELLULAR_URC_EVENT_NETWORK_CS_REGISTRATION ) || + ( urcEvent == CELLULAR_URC_EVENT_NETWORK_PS_REGISTRATION ) ) + { + configPRINTF( ( "Network CS registration status received: %d. \r\n", pServiceStatus->csRegistrationStatus ) ); + configPRINTF( ( "Network PS registration status received: %d. \r\n", pServiceStatus->psRegistrationStatus ) ); + } + } +} + +/*-----------------------------------------------------------*/ + +/* Signal strength changed callback function. */ +static void prvSignalStrengthChangedCallback( CellularUrcEvent_t urcEvent, + const CellularSignalInfo_t * pSignalInfo, + void * pCallbackContext ) +{ + TEST_ASSERT( pCallbackContext == _cellularHandle ); + + if( ( pSignalInfo != NULL ) && ( urcEvent == CELLULAR_URC_EVENT_SIGNAL_CHANGED ) ) + { + if( pSignalInfo->rssi != CELLULAR_INVALID_SIGNAL_VALUE ) + { + configPRINTF( ( "RSSI received: %d. \r\n", pSignalInfo->rssi ) ); + } + else + { + configPRINTF( ( "RSSI received: UNKNOWN. \r\n" ) ); + } + + if( pSignalInfo->rsrp != CELLULAR_INVALID_SIGNAL_VALUE ) + { + configPRINTF( ( "RSRP received: %d. \r\n", pSignalInfo->rsrp ) ); + } + else + { + configPRINTF( ( "RSRP received: UNKNOWN. \r\n" ) ); + } + + if( pSignalInfo->rsrq != CELLULAR_INVALID_SIGNAL_VALUE ) + { + configPRINTF( ( "RSRQ received: %d. \r\n", pSignalInfo->rsrq ) ); + } + else + { + configPRINTF( ( "RSRQ received: UNKNOWN. \r\n" ) ); + } + + if( pSignalInfo->ber != CELLULAR_INVALID_SIGNAL_VALUE ) + { + configPRINTF( ( "BER received: %d. \r\n", pSignalInfo->ber ) ); + } + else + { + configPRINTF( ( "BER received: UNKNOWN. \r\n" ) ); + } + + if( pSignalInfo->bars != CELLULAR_INVALID_SIGNAL_BAR_VALUE ) + { + configPRINTF( ( "BARS received: %u. \r\n", pSignalInfo->bars ) ); + } + else + { + configPRINTF( ( "BARS received: UNKNOWN. \r\n" ) ); + } + } +} + +/*-----------------------------------------------------------*/ + +/* Generic callback function to test Cellular_RegisterUrcGenericCallback API. */ +static void prvGenericCallback( const char * pRawData, + void * pCallbackContext ) +{ + TEST_ASSERT( pCallbackContext == _cellularHandle ); + + configPRINTF( ( "prvGenericCallback : %s \r\n", pRawData ) ); + _genericUrcCalled = true; +} + +/*-----------------------------------------------------------*/ + +/* PDN event callback function. */ +static void prvPdnEventCallback( CellularUrcEvent_t urcEvent, + uint8_t contextId, + void * pCallbackContext ) +{ + TEST_ASSERT( pCallbackContext == _cellularHandle ); + + if( contextId == testCELLULAR_PDN_CONTEXT_ID ) + { + if( ( urcEvent == CELLULAR_URC_EVENT_PDN_ACTIVATED ) || ( urcEvent == CELLULAR_URC_EVENT_PDN_DEACTIVATED ) ) + { + configPRINTF( ( "PDP Status changed. context ID %u event %d\r\n", contextId, urcEvent ) ); + } + } +} + +/*-----------------------------------------------------------*/ + +/* Callback functions for testing. */ +static void prvCellularSocketDataReadyCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + PlatformEventGroupHandle_t eventGroupHandle = ( PlatformEventGroupHandle_t ) pCallbackContext; + + TEST_ASSERT( socketHandle != NULL ); + + configPRINTF( ( "Data Ready on Socket \r\n" ) ); + _dataReady = 1; + + if( eventGroupHandle != NULL ) + { + ( void ) PlatformEventGroup_SetBits( eventGroupHandle, SOCKET_DATA_RECEIVED_CALLBACK_BIT ); + } + + _socketDataReadyContext = pCallbackContext; +} + +/*-----------------------------------------------------------*/ + +/* Socket close event callback function. */ +static void prvSocketClosedCallback( CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + PlatformEventGroupHandle_t eventGroupHandle = ( PlatformEventGroupHandle_t ) pCallbackContext; + + TEST_ASSERT( socketHandle != NULL ); + + configPRINTF( ( "Socket is closed. \r\n" ) ); + + if( eventGroupHandle != NULL ) + { + ( void ) PlatformEventGroup_SetBits( eventGroupHandle, SOCKET_CLOSED_CALLBACK_BIT ); + } + + _socketClosedContext = pCallbackContext; +} + +/*-----------------------------------------------------------*/ + +/* Socket open event callback function. */ +static void prvCellularSocketOpenCallback( CellularUrcEvent_t urcEvent, + CellularSocketHandle_t socketHandle, + void * pCallbackContext ) +{ + PlatformEventGroupHandle_t eventGroupHandle = ( PlatformEventGroupHandle_t ) pCallbackContext; + + TEST_ASSERT( socketHandle != NULL ); + + if( eventGroupHandle != NULL ) + { + if( urcEvent == CELLULAR_URC_SOCKET_OPENED ) + { + configPRINTF( ( "Socket open callback, Success\r\n" ) ); + ( void ) PlatformEventGroup_SetBits( eventGroupHandle, SOCKET_OPEN_CALLBACK_BIT ); + } + else + { + configPRINTF( ( "Socket open callback, Failure\r\n" ) ); + ( void ) PlatformEventGroup_SetBits( eventGroupHandle, SOCKET_OPEN_FAILED_CALLBACK_BIT ); + } + } + + _socketOpenContext = pCallbackContext; +} + +/*-----------------------------------------------------------*/ + +/* Modem event callback function. */ +static void prvCellularModemEventCallback( CellularModemEvent_t modemEvent, + void * pCallbackContext ) +{ + ( void ) pCallbackContext; + + if( _modemEventGroup != NULL ) + { + switch( modemEvent ) + { + case CELLULAR_MODEM_EVENT_BOOTUP_OR_REBOOT: + ( void ) PlatformEventGroup_SetBits( _modemEventGroup, MODEM_EVENT_BOOTUP_OR_REBOOT_BIT ); + break; + + case CELLULAR_MODEM_EVENT_POWERED_DOWN: + ( void ) PlatformEventGroup_SetBits( _modemEventGroup, MODEM_EVENT_POWERED_DOWN_BIT ); + break; + + case CELLULAR_MODEM_EVENT_PSM_ENTER: + ( void ) PlatformEventGroup_SetBits( _modemEventGroup, MODEM_EVENT_PSM_ENTER_BIT ); + break; + + default: + break; + } + } +} + +/*-----------------------------------------------------------*/ + +/* Helper function to check sim card ready. */ +static bool prvWaitSimCardReady( void ) +{ + bool simReady = false; + uint32_t tries = 0; + CellularSimCardStatus_t simStatus = { 0 }; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + for( tries = 0; tries < testCELLULAR_MAX_SIM_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetSimCardStatus( _cellularHandle, &simStatus ); + + if( ( CELLULAR_SUCCESS == xCellularStatus ) && + ( simStatus.simCardState == CELLULAR_SIM_CARD_INSERTED ) && + ( simStatus.simCardLockState == CELLULAR_SIM_CARD_READY ) ) + { + simReady = true; + break; + } + + Platform_Delay( testCELLULAR_SIM_RETRY_INTERVAL_MS ); + } + + return simReady; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Connect to the CELLULAR and verify success. + */ +static BaseType_t prvConnectCellular( void ) +{ + BaseType_t xResult = pdPASS; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularServiceStatus_t serviceStatus = { 0 }; + CellularCommInterface_t * pCommIntf = &CellularCommInterface; + CellularPdnConfig_t pdnConfig = { CELLULAR_PDN_CONTEXT_IPV4, CELLULAR_PDN_AUTH_NONE, testCELLULAR_APN, "", "" }; + CellularPdnStatus_t PdnStatusBuffers[ testCELLULAR_MAX_PDN_STATSU_NUM ] = { 0 }; + char localIP[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; + uint32_t timeoutCount = 0; + uint8_t NumStatus = 0; + bool simReady = false; + CellularPsmSettings_t psmSettings = { 0 }; + CellularEidrxSettings_t eidrxSettings = { 0 }; + uint32_t i = 0; + + /* Clean up the cellular handle before init. */ + if( _cellularHandle != NULL ) + { + ( void ) Cellular_Cleanup( _cellularHandle ); + _cellularHandle = NULL; + } + + /* Initialize Cellular Comm Interface. */ + xCellularStatus = Cellular_Init( &_cellularHandle, pCommIntf ); + + if( xCellularStatus != CELLULAR_SUCCESS ) + { + configPRINTF( ( ">>> Cellular module can't initialized <<<\r\n" ) ); + xResult = pdFAIL; + } + else + { + xResult = pdPASS; + } + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + /* Wait until SIM is ready. */ + simReady = prvWaitSimCardReady(); + + if( simReady == false ) + { + xResult = pdFAIL; + } + } + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + /* Setup PDN for EPS Network Registration. */ + xCellularStatus = Cellular_SetPdnConfig( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, &pdnConfig ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xResult = pdPASS; + } + else + { + xResult = pdFAIL; + } + } + + /* Rescan network. */ + if( xCellularStatus == CELLULAR_SUCCESS ) + { + ( void ) Cellular_RfOff( _cellularHandle ); + xCellularStatus = Cellular_RfOn( _cellularHandle ); + } + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + /* Check network register status. */ + xResult = pdFAIL; + + for( timeoutCount = 0; timeoutCount < testCELLULAR_MAX_NETWORK_REGISTER_RETRY; timeoutCount++ ) + { + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, &serviceStatus ); + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && + ( ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_REGISTERED_HOME ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ) ) ) + { + xResult = pdPASS; + break; + } + + Platform_Delay( testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS ); + } + + if( xResult == pdFAIL ) + { + configPRINTF( ( ">>> Cellular module can't be registered <<<\r\n" ) ); + } + } + + /* Disable PSM and EIDRX. */ + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + psmSettings.mode = 0; + psmSettings.periodicTauValue = 0; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = 0; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + } + + /* Disable the EDRX mode. */ + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + eidrxSettings.mode = 0; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + } + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + xCellularStatus = Cellular_RegisterUrcNetworkRegistrationEventCallback( _cellularHandle, &prvNetworkRegistrationCallback, _cellularHandle ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_RegisterUrcPdnEventCallback( _cellularHandle, &prvPdnEventCallback, _cellularHandle ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_SetPdnConfig( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, &pdnConfig ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_ActivatePdn( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_GetIPAddress( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, localIP, sizeof( localIP ) ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, PdnStatusBuffers, testCELLULAR_MAX_PDN_STATSU_NUM, &NumStatus ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_SetDns( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, testCELLULAR_DNS_SERVER_ADDRESS ); + + /* Modem use dynamic DNS. */ + if( xCellularStatus == CELLULAR_UNSUPPORTED ) + { + xCellularStatus = CELLULAR_SUCCESS; + } + } + } + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( xResult == pdPASS ) ) + { + for( i = 0; i < NumStatus; i++ ) + { + if( ( PdnStatusBuffers[ i ].contextId == testCELLULAR_PDN_CONTEXT_ID ) && ( PdnStatusBuffers[ i ].state == 1 ) ) + { + break; + } + } + + if( i != NumStatus ) + { + xResult = pdPASS; + } + } + else + { + xResult = pdFAIL; + } + + return xResult; +} + +/*-----------------------------------------------------------*/ + +/* Helper function to check if cellular network connected. */ +static BaseType_t prvIsConnectedCellular( void ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularPdnStatus_t PdnStatusBuffers[ testCELLULAR_MAX_PDN_STATSU_NUM ] = { 0 }; + uint8_t NumStatus = 0; + BaseType_t xResult = pdFAIL; + uint32_t i = 0; + + if( _cellularHandle != NULL ) + { + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, + PdnStatusBuffers, + testCELLULAR_MAX_PDN_STATSU_NUM, + &NumStatus ); + + /* State 0 = Deactivated, 1 = Activated. */ + if( xCellularStatus == CELLULAR_SUCCESS ) + { + for( i = 0; i < NumStatus; i++ ) + { + if( ( PdnStatusBuffers[ i ].contextId == testCELLULAR_PDN_CONTEXT_ID ) && ( PdnStatusBuffers[ i ].state == 1 ) ) + { + xResult = pdPASS; + break; + } + } + } + } + else + { + xResult = pdFAIL; + } + + return xResult; +} + +/*-----------------------------------------------------------*/ + +/* Finish test help function. */ +static BaseType_t prvFinishCellularTesting( void ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + BaseType_t xResult = pdPASS; + + if( _cellularHandle != NULL ) + { + xCellularStatus = Cellular_Cleanup( _cellularHandle ); + } + + if( xCellularStatus != CELLULAR_SUCCESS ) + { + configPRINTF( ( ">>> Cellular module cleanup failed <<<\r\n" ) ); + xResult = pdFAIL; + } + else + { + _cellularHandle = NULL; + xResult = pdPASS; + } + + return xResult; +} + +/*-----------------------------------------------------------*/ + +/* Setup socket connection. */ +static CellularSocketHandle_t prvSocketConnectionSetup( uint16_t serverPort, + char * pServerAddress, + PlatformEventGroupHandle_t * pSocketEventGroup ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSocketAddress_t remoteSocketAddress = { 0 }; + CellularSocketHandle_t socketHandle = NULL; + uint32_t sendTimeout = testCELLULAR_SOCKET_SEND_TIMEOUT_MS; + EventBits_t waitEventBits = 0; + PlatformEventGroupHandle_t socketEventGroup = NULL; + + /* Setup the event group. */ + socketEventGroup = xEventGroupCreate(); + TEST_ASSERT_MESSAGE( socketEventGroup != NULL, "event group create failed" ); + *pSocketEventGroup = socketEventGroup; + xEventGroupClearBits( socketEventGroup, + SOCKET_OPEN_CALLBACK_BIT | SOCKET_OPEN_FAILED_CALLBACK_BIT | SOCKET_DATA_RECEIVED_CALLBACK_BIT ); + + /* Setup the tcp connection. */ + /* Create Socket. */ + xCellularStatus = Cellular_CreateSocket( _cellularHandle, + testCELLULAR_PDN_CONTEXT_ID, + CELLULAR_SOCKET_DOMAIN_AF_INET, + CELLULAR_SOCKET_TYPE_DGRAM, + CELLULAR_SOCKET_PROTOCOL_TCP, + &socketHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Modify Socket. */ + xCellularStatus = Cellular_SocketSetSockOpt( _cellularHandle, + socketHandle, + CELLULAR_SOCKET_OPTION_LEVEL_TRANSPORT, + CELLULAR_SOCKET_OPTION_SEND_TIMEOUT, + ( uint8_t * ) &sendTimeout, + sizeof( sendTimeout ) ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Data and Socket Event call back enabled. */ + xCellularStatus = Cellular_SocketRegisterDataReadyCallback( _cellularHandle, + socketHandle, + &prvCellularSocketDataReadyCallback, + socketEventGroup ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_SocketRegisterSocketOpenCallback( _cellularHandle, + socketHandle, + &prvCellularSocketOpenCallback, + socketEventGroup ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_SocketRegisterClosedCallback( _cellularHandle, + socketHandle, + &prvSocketClosedCallback, + socketEventGroup ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Connect Socket. */ + remoteSocketAddress.port = serverPort; + remoteSocketAddress.ipAddress.ipAddressType = CELLULAR_IP_ADDRESS_V4; + strncpy( remoteSocketAddress.ipAddress.ipAddress, pServerAddress, CELLULAR_IP_ADDRESS_MAX_SIZE ); + xCellularStatus = Cellular_SocketConnect( _cellularHandle, + socketHandle, + CELLULAR_ACCESSMODE_BUFFER, + &remoteSocketAddress ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + waitEventBits = xEventGroupWaitBits( socketEventGroup, + SOCKET_OPEN_CALLBACK_BIT | SOCKET_OPEN_FAILED_CALLBACK_BIT, + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( testCELLULAR_SOCKET_CONNECTION_TIMEOUT_MS ) ); + TEST_ASSERT_MESSAGE( ( waitEventBits & SOCKET_OPEN_CALLBACK_BIT ) != 0, "Socket connection timeout or failed" ); + + return socketHandle; +} + + +/*-----------------------------------------------------------*/ + +/* Close socket connection. */ +static void prvSocketConnectionClose( CellularSocketHandle_t socketHandle, + PlatformEventGroupHandle_t socketEventGroup, + bool waitCallback ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + PlatformEventGroup_EventBits waitEventBits = 0; + + /* Close the socket. */ + xCellularStatus = Cellular_SocketRegisterDataReadyCallback( _cellularHandle, + socketHandle, + NULL, + NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + xCellularStatus = Cellular_SocketRegisterSocketOpenCallback( _cellularHandle, + socketHandle, + NULL, + NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( waitCallback == false ) + { + xCellularStatus = Cellular_SocketRegisterClosedCallback( _cellularHandle, + socketHandle, + NULL, + NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + + xCellularStatus = Cellular_SocketClose( _cellularHandle, socketHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( ( waitCallback == true ) && ( socketEventGroup != NULL ) ) + { + waitEventBits = PlatformEventGroup_WaitBits( socketEventGroup, + SOCKET_CLOSED_CALLBACK_BIT, + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( testCELLULAR_SOCKET_CLOSE_TIMEOUT_MS ) ); + TEST_ASSERT_MESSAGE( ( waitEventBits & SOCKET_CLOSED_CALLBACK_BIT ) != 0, "Socket close timeout or failed" ); + } + + if( socketEventGroup != NULL ) + { + vEventGroupDelete( socketEventGroup ); + } +} + +/*-----------------------------------------------------------*/ + +/* EDRX receive count test function. */ +static uint32_t prvTestSocketReceiveCount( const uint32_t testTimeMs, + const uint32_t dataReceiveIntervalMs ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSocketHandle_t socketHandle = NULL; + uint32_t dataReceivedCount = 0; + uint32_t sentDataLen = 0; + uint8_t receiveBuff[ 100 ] = { 0 }; + uint32_t receivedDataLen = 0; + uint32_t totalReceivedDataLen = 0; + TickType_t recvStartTime = 0; + PlatformEventGroupHandle_t socketEventGroup = NULL; + + /* Setup the socket connection. */ + socketHandle = prvSocketConnectionSetup( testCELLULAR_EDRX_ECHO_SERVER_PORT, + testCELLULAR_EDRX_ECHO_SERVER_ADDRESS, + &socketEventGroup ); + + /* Send a byte to the server to start echo in time interval. */ + xCellularStatus = Cellular_SocketSend( _cellularHandle, + socketHandle, + ( const uint8_t * ) _socketDataSend, + strlen( _socketDataSend ), + &sentDataLen ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + recvStartTime = xTaskGetTickCount(); + /* Echo server will send data after received data. Wait 5 seconds for the first data. */ + configPRINTF( ( "start receive time %d, test time ms %d\r\n", recvStartTime, testTimeMs ) ); + Platform_Delay( 5000UL ); + + while( 1 ) + { + totalReceivedDataLen = 0; + + while( 1 ) + { + xCellularStatus = Cellular_SocketRecv( _cellularHandle, + socketHandle, + receiveBuff, + sizeof( receiveBuff ), + &receivedDataLen ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( receivedDataLen == 0 ) + { + break; + } + + totalReceivedDataLen = totalReceivedDataLen + receivedDataLen; + } + + if( totalReceivedDataLen != 0 ) + { + configPRINTF( ( "Bytes received %d\r\n", totalReceivedDataLen ) ); + dataReceivedCount = dataReceivedCount + 1; + } + + if( ( xTaskGetTickCount() - recvStartTime ) > pdMS_TO_TICKS( testTimeMs ) ) + { + break; + } + + Platform_Delay( dataReceiveIntervalMs ); + } + + prvSocketConnectionClose( socketHandle, socketEventGroup, false ); + + return dataReceivedCount; +} + +/*-----------------------------------------------------------*/ + +/* Unity TEST initializations. */ +TEST_GROUP( Full_CELLULAR_API ); + +/*-----------------------------------------------------------*/ + +TEST_SETUP( Full_CELLULAR_API ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularModemInfo_t modemInfo = { 0 }; + CellularSimCardInfo_t simCardInfo = { 0 }; + CellularSimCardStatus_t simStatus = { 0 }; + CellularSignalInfo_t signalInfo = { 0 }; + char localIP[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; + CellularPlmnInfo_t networkInfo = { 0 }; + CellularServiceStatus_t serviceStatus = { 0 }; + CellularTime_t networkTime = { 0 }; + CellularPsmSettings_t psmSettings = { 0 }; + CellularEidrxSettingsList_t eidrxSettingsList = { 0 }; + CellularRat_t pRatPriorities[ CELLULAR_MAX_RAT_PRIORITY_COUNT ] = { CELLULAR_RAT_INVALID }; + uint8_t receivedRatPrioritiesLength = 0; + uint32_t ratIndex = 0; + + configPRINTF( ( "\r\n==================================================================================\r\n" ) ); + + xCellularStatus = Cellular_GetModemInfo( _cellularHandle, &modemInfo ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( + ( " FW: %s \r\n IMEI: %s \r\n MfrID/ModId: %s/%s \r\n", modemInfo.firmwareVersion, modemInfo.imei, modemInfo.manufactureId, modemInfo.modelId ) ); + } + else + { + configPRINTF( ( " FW: \r\n IMEI: \r\n MfrID/ModId: \r\n" ) ); + } + + xCellularStatus = Cellular_GetSimCardInfo( _cellularHandle, &simCardInfo ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( + ( " ICCID: %s \r\n IMSI: %s \r\n HPLMN: %s-%s \r\n", simCardInfo.iccid, simCardInfo.imsi, simCardInfo.plmn.mcc, simCardInfo.plmn.mnc ) ); + } + else + { + configPRINTF( ( " ICCID: \r\n IMSI: \r\n HPLMN: \r\n" ) ); + } + + xCellularStatus = Cellular_GetSimCardStatus( _cellularHandle, &simStatus ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( ( " SIM Status: %d \r\n SIM Lock: %d \r\n", simStatus.simCardState, simStatus.simCardLockState ) ); + } + else + { + configPRINTF( ( " SIM Status: \r\n SIM Lock: \r\n" ) ); + } + + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, &serviceStatus ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( + ( " rat: %d \r\n cs: %d \r\n ps: %d \r\n mode: %d \r\n csRej: %d \r\n psRej: %d \r\n plmn: %s%s \r\n", serviceStatus.rat, serviceStatus.csRegistrationStatus, serviceStatus.psRegistrationStatus, serviceStatus.networkRegistrationMode, serviceStatus.csRejectionCause, serviceStatus.psRejectionCause, serviceStatus.plmnInfo.mcc, serviceStatus.plmnInfo.mnc ) ); + } + else + { + configPRINTF( ( " rat: \r\n cs: \r\n ps: \r\n mode: \r\n csRej: \r\n psRej: \r\n plmn: \r\n" ) ); + } + + xCellularStatus = Cellular_GetRegisteredNetwork( _cellularHandle, &networkInfo ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( ( " Network: %s-%s \r\n", networkInfo.mcc, networkInfo.mnc ) ); + } + else + { + configPRINTF( ( " Network: \r\n" ) ); + } + + /* Cellular_GetSignalInfo should be called after Cellular_GetServiceStatus to set libAtData.rat to get correct bar level. */ + xCellularStatus = Cellular_GetSignalInfo( _cellularHandle, &signalInfo ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( + ( " Signal Bars: %d \r\n Signal RSSI: %d \r\n Signal RSRP: %d \r\n Signal RSRQ: %d \r\n", signalInfo.bars, signalInfo.rssi, signalInfo.rsrp, signalInfo.rsrq ) ); + } + else + { + configPRINTF( + ( " Signal Bars: N/A\r\n Signal RSSI: N/A\r\n Signal RSRP: N/A\r\n Signal RSRQ: N/A\r\n" ) ); + } + + xCellularStatus = Cellular_GetNetworkTime( _cellularHandle, &networkTime ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( + ( " Network time: %d/%d/%d %d:%d:%d \r\n", networkTime.month, networkTime.day, networkTime.year, networkTime.hour, networkTime.minute, networkTime.second ) ); + } + else + { + configPRINTF( ( " Network time: \r\n" ) ); + } + + xCellularStatus = Cellular_GetRatPriority( _cellularHandle, + pRatPriorities, CELLULAR_MAX_RAT_PRIORITY_COUNT, &receivedRatPrioritiesLength ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + for( ratIndex = 0; ratIndex < receivedRatPrioritiesLength; ratIndex++ ) + { + configPRINTF( ( " RAT Priority: %u %u\r\n", ratIndex, pRatPriorities[ ratIndex ] ) ); + } + } + + xCellularStatus = Cellular_GetIPAddress( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, localIP, sizeof( localIP ) ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( ( " IP address: %s \r\n", localIP ) ); + } + else + { + configPRINTF( ( " IP address: \r\n" ) ); + } + + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( ( " PSM mode: %d \r\n PSM TAU Value: %d \r\n PSM RAU Value: %d \r\n PSM GPRS Timer: %d \r\n PSM Active Value: %d \r\n", + psmSettings.mode, + psmSettings.periodicTauValue, + psmSettings.periodicRauValue, + psmSettings.gprsReadyTimer, + psmSettings.activeTimeValue ) ); + } + else + { + configPRINTF( + ( " PSM mode: \r\n PSM TAU Value: \r\n PSM RAU Value: \r\n PSM GPRS Timer: \r\n PSM Active Value: \r\n" ) ); + } + + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, &eidrxSettingsList ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + for( int i = 0; i < eidrxSettingsList.count; i++ ) + { + configPRINTF( ( " eDRX index: %d eDRX mode: %d eDRX rat:%d eDRX UE Value:%d eDRX NW value:%d \r\n", + i, + eidrxSettingsList.eidrxList[ i ].mode, + eidrxSettingsList.eidrxList[ i ].rat, + eidrxSettingsList.eidrxList[ i ].requestedEdrxVaue, + eidrxSettingsList.eidrxList[ i ].nwProvidedEdrxVaue ) ); + } + } + else + { + configPRINTF( ( " eDRX index: eDRX mode: eDRX rat: eDRX UE Value: eDRX NW value: \r\n" ) ); + } + + configPRINTF( ( "\r\n==================================================================================\r\n" ) ); +} + +/*-----------------------------------------------------------*/ + +TEST_TEAR_DOWN( Full_CELLULAR_API ) +{ + configPRINTF( ( "\r\n==================================================================================\r\n" ) ); +} + +/*-----------------------------------------------------------*/ + +TEST_GROUP_RUNNER( Full_CELLULAR_API ) +{ + /* List of all tests under this group */ + /* In sequence tests. */ + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_Configure ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_Activate ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetNetworkTime ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetHostByName ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_TCPDataTransfer ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_EidrxSettings ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_PsmSettings ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_RatPriority ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_AtCommandRawAndGenericUrc ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_AirplaneMode ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_Deactivate ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_UnConfigure ); + + /* Null parameter tests. */ + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetModemInfo_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetSimCardInfo_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetSimCardStatus_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetServiceStatus_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetSignalInfo_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetRegisteredNetwork_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetPsmSettings_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetEidrxSettings_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetPdnStatus_NullParameters ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_GetIPAddress_NullParameters ); + + /* Invalid parameters tests. */ + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_SetRatPriority_InvalidMode ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_SetPsmSettings_InvalidMode ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_SetEidrxSettings_InvalidMode ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_SetPdnConfig_InvalidMode ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_SetDns_InvalidMode ); + + /* Stability tests. */ + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_Data_Loop ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_MultipleSocketConnection ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_AirplaneMode_Loop ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_Power_Loop ); + + /* PSM and eDRX tests. */ + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_EidrxEchoTimes ); + RUN_TEST_CASE( Full_CELLULAR_API, Cellular_PsmStatus ); + + prvFinishCellularTesting(); +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Configure CELLULAR. + */ +TEST( Full_CELLULAR_API, Cellular_Configure ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSimCardStatus_t simStatus = { 0 }; + CellularCommInterface_t * pCommIntf = &CellularCommInterface; + uint8_t tries = 0; + uint8_t simReady = 0; + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_Init( &_cellularHandle, pCommIntf ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular module can't be initialized <<<" ); + + /* Wait until SIM is ready. */ + for( tries = 0; tries < testCELLULAR_MAX_SIM_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetSimCardStatus( _cellularHandle, &simStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular SIM failure <<<" ); + + if( ( simStatus.simCardState == CELLULAR_SIM_CARD_INSERTED ) && + ( simStatus.simCardLockState == CELLULAR_SIM_CARD_READY ) ) + { + simReady = 1; + break; + } + + Platform_Delay( testCELLULAR_SIM_RETRY_INTERVAL_MS ); + } + + TEST_ASSERT( simReady != 0 ); + + /* Enable Callbacks. */ + xCellularStatus = Cellular_RegisterUrcSignalStrengthChangedCallback( _cellularHandle, &prvSignalStrengthChangedCallback, _cellularHandle ); + TEST_CELLULAR_ASSERT_OPTIONAL_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_RegisterUrcNetworkRegistrationEventCallback( _cellularHandle, &prvNetworkRegistrationCallback, _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_RegisterUrcPdnEventCallback( _cellularHandle, &prvPdnEventCallback, _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR Activate. + */ +TEST( Full_CELLULAR_API, Cellular_Activate ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularServiceStatus_t serviceStatus = { 0 }; + CellularPdnConfig_t pdnConfig = + { CELLULAR_PDN_CONTEXT_IPV4, CELLULAR_PDN_AUTH_NONE, testCELLULAR_APN, "", "" }; + CellularPdnStatus_t PdnStatusBuffers[ testCELLULAR_MAX_PDN_STATSU_NUM ] = { 0 }; + char localIP[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; + uint32_t timeoutCount = 0; + uint8_t numStatus = 0; + CellularPsmSettings_t psmSettings = { 0 }; + CellularEidrxSettings_t eidrxSettings = { 0 }; + uint32_t i = 0; + + if( TEST_PROTECT() ) + { + /* Setup PDN for EPS Network Registration. */ + xCellularStatus = Cellular_SetPdnConfig( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, &pdnConfig ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> PDN configuration failed <<<" ); + + /* Rescan network. */ + if( xCellularStatus == CELLULAR_SUCCESS ) + { + xCellularStatus = Cellular_RfOff( _cellularHandle ); + } + + Platform_Delay( 5000 ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + for( timeoutCount = 0; timeoutCount < testCELLULAR_MAX_NETWORK_REGISTER_RETRY; timeoutCount++ ) + { + xCellularStatus = Cellular_RfOn( _cellularHandle ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + break; + } + } + } + + TEST_ASSERT( xCellularStatus == CELLULAR_SUCCESS ); + + /* Verify registration. */ + for( timeoutCount = 0; timeoutCount < testCELLULAR_MAX_NETWORK_REGISTER_RETRY; timeoutCount++ ) + { + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, &serviceStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular module can't be registered <<<" ); + + if( ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_REGISTERED_HOME ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ) ) + { + break; + } + + Platform_Delay( testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS ); + } + + if( timeoutCount >= testCELLULAR_MAX_NETWORK_REGISTER_RETRY ) + { + TEST_FAIL_MESSAGE( ">>> Cellular module can't be registered <<<" ); + } + + /* Configure and Activate PDN, set DNS and verify IP. */ + xCellularStatus = Cellular_ActivatePdn( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular module can't be activated <<<" ); + + /* Get PDN & IP and verify. */ + xCellularStatus = Cellular_GetIPAddress( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, localIP, sizeof( localIP ) ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, + PdnStatusBuffers, + testCELLULAR_MAX_PDN_STATSU_NUM, + &numStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + for( i = 0; i < numStatus; i++ ) + { + if( PdnStatusBuffers[ i ].contextId == testCELLULAR_PDN_CONTEXT_ID ) + { + TEST_ASSERT_EQUAL_INT32_MESSAGE( 1, PdnStatusBuffers[ i ].state, + ">>> Cellular module failed to be activated <<<" ); + break; + } + } + + TEST_ASSERT_MESSAGE( i != numStatus, ">>> Cellular module failed to be activated, no activate PDN found <<<" ); + + /* Set DNS. */ + xCellularStatus = Cellular_SetDns( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, testCELLULAR_DNS_SERVER_ADDRESS ); + TEST_CELLULAR_ASSERT_OPTIONAL_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> DNS configuration failed <<<" ); + + /* Disable PSM and eDRX for the following tests. */ + psmSettings.mode = 0; + psmSettings.periodicTauValue = 0; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = 0; + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Disable PSM failed <<<" ); + + eidrxSettings.mode = 0; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Disable EDRX failed <<<" ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Get network time. + */ +TEST( Full_CELLULAR_API, Cellular_GetNetworkTime ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularTime_t networkTime = { 0 }; + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetNetworkTime( _cellularHandle, &networkTime ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Get network time failed <<<" ); + + /* Verify the value range. */ + TEST_ASSERT_MESSAGE( ( ( networkTime.month >= 1 ) && ( networkTime.month <= 12 ) ), + ">>> Get network time month value error <<<" ); + TEST_ASSERT_MESSAGE( ( ( networkTime.day >= 1 ) && ( networkTime.day <= 31 ) ), + ">>> Get network time day value error <<<" ); + TEST_ASSERT_MESSAGE( ( ( networkTime.hour >= 0 ) && ( networkTime.hour <= 24 ) ), + ">>> Get network time hour value error <<<" ); + TEST_ASSERT_MESSAGE( ( ( networkTime.minute >= 0 ) && ( networkTime.minute <= 59 ) ), + ">>> Get network time minute value error <<<" ); + TEST_ASSERT_MESSAGE( ( ( networkTime.second >= 0 ) && ( networkTime.second <= 59 ) ), + ">>> Get network time second value error <<<" ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Host name resolve test. + */ +TEST( Full_CELLULAR_API, Cellular_GetHostByName ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + char pIpAddress[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; + + if( TEST_PROTECT() ) + { + /* DNS query IP. */ + xCellularStatus = Cellular_GetHostByName( + _cellularHandle, + testCELLULAR_PDN_CONTEXT_ID, + testCELLULAR_HOST_NAME, + pIpAddress ); + TEST_CELLULAR_ASSERT_OPTIONAL_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> DNS query IP failed <<<" ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + TEST_ASSERT_MESSAGE( strncmp( pIpAddress, testCELLULAR_HOST_NAME_ADDRESS, CELLULAR_IP_ADDRESS_MAX_SIZE ) == 0, + ">>> DNS query IP incorrect <<<" ); + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief TCP Data Transfer. + */ +TEST( Full_CELLULAR_API, Cellular_TCPDataTransfer ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSocketHandle_t socketHandle = NULL; + uint8_t tries = 0; + uint32_t sentDataLen = 0; + char receiveBuff[ 100 ] = { 0 }; + uint32_t receivedDataLen = 0; + + if( TEST_PROTECT() ) + { + /* Setup the test variable. */ + _dataReady = 0; + _socketOpenContext = NULL; + _socketDataReadyContext = NULL; + _socketClosedContext = NULL; + + /* Setup server connection. */ + socketHandle = prvSocketConnectionSetup( testCELLULAR_ECHO_SERVER_PORT, + testCELLULAR_ECHO_SERVER_ADDRESS, + &_socketEventGroup ); + TEST_ASSERT_MESSAGE( _socketOpenContext == _socketEventGroup, "Socket open context check failed" ); + + /* Send Data on Socket. */ + for( tries = 0; tries < SOCKET_OPERATION_POLLING_TIMES; tries++ ) + { + xCellularStatus = Cellular_SocketSend( _cellularHandle, + socketHandle, + ( const uint8_t * ) _socketDataSend, + strlen( _socketDataSend ), + &sentDataLen ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + break; + } + } + + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Receive Data on Socket in polling method. */ + for( tries = 0; tries < SOCKET_OPERATION_POLLING_TIMES; tries++ ) + { + Platform_Delay( testCELLULAR_SOCKET_WAIT_INTERVAL_MS ); + + if( _dataReady == 1 ) + { + xCellularStatus = Cellular_SocketRecv( _cellularHandle, + socketHandle, + ( uint8_t * ) receiveBuff, + sizeof( receiveBuff ), + &receivedDataLen ); + TEST_ASSERT_MESSAGE( _socketDataReadyContext == _socketEventGroup, "Socket data ready context check failed" ); + break; + } + } + + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Compare Data on Socket. */ + TEST_ASSERT_MESSAGE( strncmp( _socketDataSend, receiveBuff, strlen( _socketDataSend ) ) == 0, + "Cellular_TCPDataTransfer received data compare failed" ); + + /* Close Socket. */ + #ifdef CELLULAR_ASYNC_SOCKET_CLOSE + prvSocketConnectionClose( socketHandle, _socketEventGroup, true ); + TEST_ASSERT_MESSAGE( _socketClosedContext == _socketEventGroup, "Socket close context check failed" ); + #else + prvSocketConnectionClose( socketHandle, _socketEventGroup, false ); + #endif + _socketEventGroup = NULL; + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Enable CELLULAR Idle Discontinuous Reception. + */ +TEST( Full_CELLULAR_API, Cellular_EidrxSettings ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularEidrxSettings_t eidrxSettings = { 0 }; + CellularEidrxSettingsList_t eidrxSettingsList = { 0 }; + uint8_t drxValue = 5; /* 5 = ( 0 1 0 1 ) 81.92 seconds. */ + int i = 0; + + if( TEST_PROTECT() ) + { + /* Disable the EDRX mode. */ + eidrxSettings.mode = 0; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Enabling the EDRX mode and verify. */ + eidrxSettings.mode = 1; /* Enable the use of e-I-DRX. */ + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = drxValue; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, &eidrxSettingsList ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + TEST_ASSERT_MESSAGE( eidrxSettingsList.count > 0, "eidrxSettingsList count is 0" ); + + for( i = 0; i < eidrxSettingsList.count; i++ ) + { + if( eidrxSettingsList.eidrxList[ i ].rat == testCELLULAR_EDRX_RAT ) + { + TEST_ASSERT_EQUAL_INT32( eidrxSettingsList.eidrxList[ i ].requestedEdrxVaue, drxValue ); + } + } + + /* Disabling the EDRX mode and verify. */ + eidrxSettings.mode = 3; /* Disable the use of e-I-DRX and discard all parameters for e-I-DRX or, + * if available, reset to the manufacturer specific default values. */ + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, &eidrxSettingsList ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Enable CELLULAR Power Saving Mode attributes. + */ +TEST( Full_CELLULAR_API, Cellular_PsmSettings ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularPsmSettings_t psmSettings = { 0 }; + uint32_t psmTau = 4; /* 4 * 10 minutes = 40 minutes. */ + uint32_t psmTimer = 14; /* 14 * 2 seconds = 28 Seconds. */ + uint32_t tries = 0; + + if( TEST_PROTECT() ) + { + /* Disabling the PSM mode if ON. */ + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( psmSettings.mode == 1 ) + { + psmSettings.mode = 0; + psmSettings.periodicTauValue = 0; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = 0; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + + /* Enabling the PSM mode and verify. */ + psmSettings.mode = 1; + psmSettings.periodicTauValue = psmTau; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = psmTimer; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + for( tries = 0; tries < testCELLULAR_MAX_GET_PSM_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( psmSettings.mode == 1 ) ) + { + break; + } + + Platform_Delay( testCELLULAR_GET_PSM_RETRY_INTERVAL_MS ); + } + + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + TEST_ASSERT_EQUAL_INT32( psmSettings.mode, 1 ); + + /* Disabling the PSM mode and verify. */ + psmSettings.mode = 0; + psmSettings.periodicTauValue = 0; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = 0; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + for( tries = 0; tries < testCELLULAR_MAX_GET_PSM_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + + if( ( xCellularStatus == CELLULAR_SUCCESS ) && ( psmSettings.mode == 0 ) ) + { + break; + } + + Platform_Delay( testCELLULAR_GET_PSM_RETRY_INTERVAL_MS ); + } + + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + TEST_ASSERT_EQUAL_INT32( psmSettings.mode, 0 ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Setting and checking CELLULAR RAT priority. + */ +TEST( Full_CELLULAR_API, Cellular_RatPriority ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + const CellularRat_t pRatPriorities1[ TEST_MAX_RAT_PRIORITY_COUNT ] = + { CELLULAR_RAT_NBIOT, CELLULAR_RAT_CATM1, CELLULAR_RAT_GSM }; + const CellularRat_t pRatPriorities2[ TEST_MAX_RAT_PRIORITY_COUNT ] = + { CELLULAR_RAT_CATM1, CELLULAR_RAT_NBIOT, CELLULAR_RAT_GSM }; + CellularRat_t pRatPriorities[ TEST_MAX_RAT_PRIORITY_COUNT ] = { CELLULAR_RAT_INVALID }; + uint8_t receivedRatPrioritiesLength = 0; + int i = 0; + uint32_t tries = 0; + bool ratFlag = true; + + if( TEST_PROTECT() ) + { + /* Set the first priority and verify. */ + xCellularStatus = Cellular_SetRatPriority( _cellularHandle, + ( const CellularRat_t * ) pRatPriorities1, + CELLULAR_MAX_RAT_PRIORITY_COUNT ); + TEST_CELLULAR_ASSERT_OPTIONAL_API_MSG( ( CELLULAR_SUCCESS == xCellularStatus ) || ( CELLULAR_NOT_ALLOWED == xCellularStatus ), + xCellularStatus, + "Set RAT priority failed" ); + + /* Set RAT priority may not be supported in the cellular module. */ + if( xCellularStatus == CELLULAR_SUCCESS ) + { + for( tries = 0; tries < testCELLULAR_GET_RAT_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetRatPriority( _cellularHandle, + pRatPriorities, + CELLULAR_MAX_RAT_PRIORITY_COUNT, + &receivedRatPrioritiesLength ); + TEST_ASSERT_MESSAGE( CELLULAR_SUCCESS == xCellularStatus, "Get RAT priority failed" ); + + /* Check the return priority length if RAT priority is supported. */ + if( xCellularStatus == CELLULAR_SUCCESS ) + { + TEST_ASSERT_MESSAGE( receivedRatPrioritiesLength > 0, "Get RAT priority failed" ); + ratFlag = true; + + for( i = 0; i < receivedRatPrioritiesLength; i++ ) + { + if( pRatPriorities1[ i ] != pRatPriorities[ i ] ) + { + configPRINTF( ( "%d : Set RAT [%d] != Get RAT [ %d ]\r\n", + i, pRatPriorities1[ i ], pRatPriorities[ i ] ) ); + ratFlag = false; + break; + } + } + + if( ratFlag == true ) + { + break; + } + } + else + { + break; + } + + Platform_Delay( testCELLULAR_GET_RAT_RETRY_INTERVAL_MS ); + } + + TEST_ASSERT_MESSAGE( ratFlag == true, "RATs priority compare failed" ); + + /* Restore the second priority. */ + xCellularStatus = Cellular_SetRatPriority( _cellularHandle, + ( const CellularRat_t * ) pRatPriorities2, + CELLULAR_MAX_RAT_PRIORITY_COUNT ); + TEST_ASSERT_MESSAGE( CELLULAR_SUCCESS == xCellularStatus, "Set RAT priority failed" ); + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Send AT command with receive the generic URC. + */ +TEST( Full_CELLULAR_API, Cellular_AtCommandRawAndGenericUrc ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( TEST_PROTECT() ) + { + _genericUrcCalled = false; + xCellularStatus = Cellular_RegisterUrcGenericCallback( _cellularHandle, + prvGenericCallback, _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( xCellularStatus == CELLULAR_SUCCESS, xCellularStatus, + "Register URC generic callback failed" ); + + /* Send the 3GPP get network time AT command. + * The returned network time string is handled in generic URC handler. */ + xCellularStatus = Cellular_ATCommandRaw( _cellularHandle, + NULL, + "AT+CCLK?", + CELLULAR_AT_NO_RESULT, + NULL, + NULL, + 0U ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( xCellularStatus == CELLULAR_SUCCESS, xCellularStatus, + "Send AT command raw failed" ); + + /* The maximum response time is 300ms. */ + Platform_Delay( 300U ); + TEST_ASSERT_MESSAGE( _genericUrcCalled == true, "Generic URC is not called" ); + + xCellularStatus = Cellular_RegisterUrcGenericCallback( _cellularHandle, + NULL, + NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( xCellularStatus == CELLULAR_SUCCESS, xCellularStatus, + "Register URC generic callback failed" ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Setting CELLULAR Airplane Mode On and off. + */ +TEST( Full_CELLULAR_API, Cellular_AirplaneMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularServiceStatus_t serviceStatus = { 0 }; + bool simReady = false; + uint32_t tries = 0; + + if( TEST_PROTECT() ) + { + /* RF Off. */ + xCellularStatus = Cellular_RfOff( _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Wait until SIM is ready. */ + simReady = prvWaitSimCardReady(); + TEST_ASSERT( simReady == true ); + + /* Check network registration status. Airplane mode the register status should be + * CELLULAR_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED_NOT_SEARCHING */ + for( tries = 0; tries < testCELLULAR_MAX_NETWORK_REGISTER_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, &serviceStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( ( serviceStatus.psRegistrationStatus != REGISTRATION_STATUS_REGISTERED_HOME ) && + ( serviceStatus.psRegistrationStatus != REGISTRATION_STATUS_ROAMING_REGISTERED ) ) + { + break; + } + + Platform_Delay( testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS ); + } + + configPRINTF( ( "serviceStatus.psRegistrationStatus %d\r\n", serviceStatus.psRegistrationStatus ) ); + + /* Add also psRegistrationStatus=4 if +CGREG: 2,0 and +CEREG: 2,4. */ + TEST_ASSERT_MESSAGE( ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_NO_REGISTERED_SEARCHING ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_UNKNOWN ), + "Airplane mode network registration check failed" ); + + /* RF On. */ + xCellularStatus = Cellular_RfOn( _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Wait until SIM is ready. */ + simReady = prvWaitSimCardReady(); + TEST_ASSERT( simReady == true ); + + /* Check network registration status. Airplane mode the register status should be + * CELLULAR_NETWORK_REGISTRATION_STATUS_REGISTERED_HOME or + * CELLULAR_NETWORK_REGISTRATION_STATUS_REGISTERED_ROAMING */ + for( tries = 0; tries < testCELLULAR_MAX_NETWORK_REGISTER_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, &serviceStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_REGISTERED_HOME ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ) ) + { + break; + } + + Platform_Delay( testCELLULAR_NETWORK_REGISTER_RETRY_INTERVAL_MS ); + } + + configPRINTF( ( "serviceStatus.psRegistrationStatus %d\r\n", serviceStatus.psRegistrationStatus ) ); + TEST_ASSERT_MESSAGE( + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_REGISTERED_HOME ) || + ( serviceStatus.psRegistrationStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ), + "Airplane mode network registration check failed\r\n" ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Deactivate CELLULAR. + */ +TEST( Full_CELLULAR_API, Cellular_Deactivate ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularPdnStatus_t pdnStatusBuffers[ testCELLULAR_MAX_PDN_STATSU_NUM ] = { 0 }; + uint8_t numStatus = 0; + uint32_t i = 0; + + if( TEST_PROTECT() ) + { + /* Activate PDN for deactivate test. */ + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, + pdnStatusBuffers, + testCELLULAR_MAX_PDN_STATSU_NUM, + &numStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + for( i = 0; i < numStatus; i++ ) + { + if( pdnStatusBuffers[ i ].contextId == testCELLULAR_PDN_CONTEXT_ID ) + { + if( pdnStatusBuffers[ testCELLULAR_PDN_CONTEXT_ID ].state == 1 ) + { + break; + } + } + } + + if( i == numStatus ) + { + xCellularStatus = Cellular_ActivatePdn( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + + /* Deactivate PDN and verify. */ + xCellularStatus = Cellular_DeactivatePdn( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID ); + + /* Check also if in LTE network, modem allows default bearer context to be deactivated. */ + TEST_CELLULAR_ASSERT_REQUIRED_API( ( CELLULAR_SUCCESS == xCellularStatus ) || + ( CELLULAR_NOT_ALLOWED == xCellularStatus ), xCellularStatus ); + + if( xCellularStatus != CELLULAR_NOT_ALLOWED ) + { + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, + pdnStatusBuffers, + testCELLULAR_MAX_PDN_STATSU_NUM, + &numStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( numStatus != 0 ) + { + for( i = 0; i < numStatus; i++ ) + { + if( pdnStatusBuffers[ i ].contextId == testCELLULAR_PDN_CONTEXT_ID ) + { + TEST_ASSERT_MESSAGE( ( pdnStatusBuffers[ i ].state == 0 ), "Deactive PDN should return 0" ); + break; + } + } + + TEST_ASSERT_MESSAGE( i != numStatus, "No deactivated PDN context found" ); + } + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR unconfigure. + */ +TEST( Full_CELLULAR_API, Cellular_UnConfigure ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( TEST_PROTECT() ) + { + /* Remove call backs. */ + xCellularStatus = Cellular_RegisterUrcSignalStrengthChangedCallback( _cellularHandle, NULL, NULL ); + TEST_CELLULAR_ASSERT_OPTIONAL_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_RegisterUrcNetworkRegistrationEventCallback( _cellularHandle, NULL, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_RegisterUrcPdnEventCallback( _cellularHandle, NULL, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_RegisterModemEventCallback( _cellularHandle, NULL, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Clean up. */ + xCellularStatus = Cellular_Cleanup( _cellularHandle ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + _cellularHandle = NULL; + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetModemInfo( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetModemInfo_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetModemInfo( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_Cellular_GetSimCardInfo( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetSimCardInfo_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetSimCardInfo( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetSimCardStatus( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetSimCardStatus_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetSimCardStatus( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetServiceStatus( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetServiceStatus_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetServiceStatus( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetSignalInfo( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetSignalInfo_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetSignalInfo( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetRegisteredNetwork( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetRegisteredNetwork_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetRegisteredNetwork( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetPsmSettings( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetPsmSettings_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetEidrxSettings( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetEidrxSettings_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetPdnStatus( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetPdnStatus_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + uint8_t numStatus = 0; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetPdnStatus( _cellularHandle, NULL, testCELLULAR_PDN_CONTEXT_ID, &numStatus ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_GetIPAddress( _cellularHandle ) with Null parameters and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_GetIPAddress_NullParameters ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_GetIPAddress( _cellularHandle, + testCELLULAR_PDN_CONTEXT_ID, + NULL, + CELLULAR_IP_ADDRESS_MAX_SIZE ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_SetRatPriority( _cellularHandle ) with an invalid mode and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_SetRatPriority_InvalidMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + const CellularRat_t ratPriorities[ TEST_MAX_RAT_PRIORITY_COUNT ] = { 9, 8, 1 }; /* Invalid value 1. */ + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_SetRatPriority( _cellularHandle, + ( const CellularRat_t * ) &ratPriorities, + 5 /* Invalid value. */ ); + TEST_CELLULAR_ASSERT_OPTIONAL_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_SetPsmSettings( _cellularHandle ) with an invalid mode and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_SetPsmSettings_InvalidMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularPsmSettings_t psmSettings = { 0 }; + + psmSettings.activeTimeValue = 28; + psmSettings.gprsReadyTimer = 0; + psmSettings.mode = 2; /* Invalid value. */ + psmSettings.periodicRauValue = 0; + psmSettings.periodicTauValue = 4; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_SetEidrxSettings( _cellularHandle ) with an invalid mode and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_SetEidrxSettings_InvalidMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularEidrxSettings_t eidrxSettings = { 0 }; + + eidrxSettings.mode = 1; + eidrxSettings.rat = 6; /* invalid value. */ + eidrxSettings.requestedEdrxVaue = 1; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_SetPdnConfig( _cellularHandle ) with an invalid mode and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_SetPdnConfig_InvalidMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + /* Set the invalid PDN context type. */ + CellularPdnConfig_t pdnConfig = + { CELLULAR_PDN_CONTEXT_TYPE_MAX, CELLULAR_PDN_AUTH_NONE, TEST_INVALID_CELLULAR_APN, "", "" }; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_SetPdnConfig( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, &pdnConfig ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Call Cellular_SetDns( _cellularHandle ) with an invalid mode and verify failure. + */ +TEST( Full_CELLULAR_API, Cellular_SetDns_InvalidMode ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + xCellularStatus = Cellular_SetDns( _cellularHandle, testCELLULAR_PDN_CONTEXT_ID, "123" ); + TEST_CELLULAR_ASSERT_OPTIONAL_API( CELLULAR_SUCCESS != xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR data transfer loop. + */ +TEST( Full_CELLULAR_API, Cellular_Data_Loop ) +{ + uint8_t index = 0; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSocketHandle_t socketHandle = NULL; + uint32_t sentDataLen = 0; + char receiveBuff[ 100 ] = { 0 }; + uint32_t receivedDataLen = 0; + char cBuffer[ MESSAGE_BUFFER_LENGTH ] = { '\0' }; + PlatformEventGroupHandle_t socketEventGroup = NULL; + PlatformEventGroup_EventBits eventBits = 0; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + for( index = 0; index < testCELLULARCONNECTION_LOOP_TIMES; ++index ) + { + socketHandle = prvSocketConnectionSetup( testCELLULAR_ECHO_SERVER_PORT, + testCELLULAR_ECHO_SERVER_ADDRESS, + &socketEventGroup ); + + /* Send Data on Socket. */ + xCellularStatus = Cellular_SocketSend( _cellularHandle, socketHandle, ( const uint8_t * ) _socketDataSend, strlen( _socketDataSend ), + &sentDataLen ); + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_SocketSend( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Receive Data on Socket. */ + eventBits = PlatformEventGroup_WaitBits( socketEventGroup, + SOCKET_DATA_RECEIVED_CALLBACK_BIT, + true, + false, + pdMS_TO_TICKS( testCELLULAR_SOCKET_RECEIVE_TIMEOUT_MS ) ); + TEST_ASSERT( ( eventBits & SOCKET_DATA_RECEIVED_CALLBACK_BIT ) != 0 ); + xCellularStatus = Cellular_SocketRecv( _cellularHandle, + socketHandle, + ( uint8_t * ) receiveBuff, + sizeof( receiveBuff ), + &receivedDataLen ); + + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_SocketRecv( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Compare Data on Socket. */ + TEST_ASSERT_MESSAGE( strncmp( _socketDataSend, receiveBuff, strlen( _socketDataSend ) ) == 0, + "Cellular_Data_Loop received data compare failed" ); + + /* Close Socket. */ + #ifdef CELLULAR_ASYNC_SOCKET_CLOSE + if( index < ( CELLULAR_NUM_SOCKET_MAX - 1 ) ) + { + prvSocketConnectionClose( socketHandle, socketEventGroup, false ); + } + else + { + prvSocketConnectionClose( socketHandle, socketEventGroup, true ); + } + #else + prvSocketConnectionClose( socketHandle, socketEventGroup, false ); + #endif + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR data transfer multiple connection. + */ +TEST( Full_CELLULAR_API, Cellular_MultipleSocketConnection ) +{ + uint8_t index = 0; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularSocketHandle_t socketHandles[ CELLULAR_NUM_SOCKET_MAX ] = { 0 }; + uint32_t sentDataLen = 0; + char receiveBuff[ 100 ] = { 0 }; + uint32_t receivedDataLen = 0; + char cBuffer[ MESSAGE_BUFFER_LENGTH ] = { '\0' }; + PlatformEventGroupHandle_t socketEventGroups[ CELLULAR_NUM_SOCKET_MAX ] = { 0 }; + PlatformEventGroup_EventBits eventBits = 0; + uint32_t loopCount = 0; + + /* This test needs all the available socket. Reinitialize the cellular modem. */ + TEST_ASSERT( prvConnectCellular() == pdPASS ); + + if( TEST_PROTECT() ) + { + /* Open sockets. */ + for( index = 0; index < CELLULAR_NUM_SOCKET_MAX; ++index ) + { + socketHandles[ index ] = prvSocketConnectionSetup( testCELLULAR_ECHO_SERVER_PORT, + testCELLULAR_ECHO_SERVER_ADDRESS, + &socketEventGroups[ index ] ); + } + + /* Do more data transfer. */ + for( loopCount = 0; loopCount < testCELLULARDATA_TRANSFER_LOOP_TIMES; loopCount++ ) + { + for( index = 0; index < CELLULAR_NUM_SOCKET_MAX; ++index ) + { + /* Send Data on Socket. */ + xCellularStatus = Cellular_SocketSend( _cellularHandle, + socketHandles[ index ], + ( const uint8_t * ) _socketDataSend, + strlen( _socketDataSend ), + &sentDataLen ); + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_SocketSend( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Receive Data on Socket. */ + eventBits = PlatformEventGroup_WaitBits( socketEventGroups[ index ], + SOCKET_DATA_RECEIVED_CALLBACK_BIT, + true, + false, + pdMS_TO_TICKS( testCELLULAR_SOCKET_RECEIVE_TIMEOUT_MS ) ); + TEST_ASSERT( ( eventBits & SOCKET_DATA_RECEIVED_CALLBACK_BIT ) != 0 ); + xCellularStatus = Cellular_SocketRecv( _cellularHandle, + socketHandles[ index ], + ( uint8_t * ) receiveBuff, + sizeof( receiveBuff ), + &receivedDataLen ); + + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_SocketRecv( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Compare Data on Socket. */ + TEST_ASSERT_MESSAGE( strncmp( _socketDataSend, receiveBuff, strlen( _socketDataSend ) ) == 0, + "Cellular_Data_Loop received data compare failed" ); + } + } + + /* Close Socket. */ + for( index = 0; index < CELLULAR_NUM_SOCKET_MAX; ++index ) + { + prvSocketConnectionClose( socketHandles[ index ], socketEventGroups[ index ], false ); + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR airplane mode loop. + */ +TEST( Full_CELLULAR_API, Cellular_AirplaneMode_Loop ) +{ + char cBuffer[ MESSAGE_BUFFER_LENGTH ] = { '\0' }; + uint8_t index = 0; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + bool simReady = false; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + for( index = 0; index < testCELLULARCONNECTION_LOOP_TIMES; ++index ) + { + /* RF Off. */ + xCellularStatus = Cellular_RfOff( _cellularHandle ); + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_RfOff( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Wait until SIM is ready. */ + simReady = prvWaitSimCardReady(); + TEST_ASSERT( simReady == true ); + + /* RF On. */ + xCellularStatus = Cellular_RfOn( _cellularHandle ); + snprintf( cBuffer, sizeof( cBuffer ), "Failed Cellular_RfOn( _cellularHandle ) in iteration %d", index ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, cBuffer ); + + /* Wait until SIM is ready. */ + simReady = prvWaitSimCardReady(); + TEST_ASSERT( simReady == true ); + } + + ( void ) Cellular_Cleanup( _cellularHandle ); + _cellularHandle = NULL; + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief CELLULAR power cycle loop. + */ +TEST( Full_CELLULAR_API, Cellular_Power_Loop ) +{ + uint8_t index = 0; + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularCommInterface_t * pCommIntf = &CellularCommInterface; + + if( TEST_PROTECT() ) + { + /* Clean previous setting. */ + ( void ) Cellular_Cleanup( _cellularHandle ); + _cellularHandle = NULL; + + for( index = 0; index < testCELLULARCONNECTION_LOOP_TIMES; ++index ) + { + xCellularStatus = Cellular_Init( &_cellularHandle, pCommIntf ); + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular module can't be initialized <<<" ); + + /* Clean up. */ + xCellularStatus = Cellular_Cleanup( _cellularHandle ); + _cellularHandle = NULL; + TEST_CELLULAR_ASSERT_REQUIRED_API_MSG( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus, + ">>> Cellular module can't be cleanup <<<" ); + } + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Test eDRX settings on echo server received times. + * + * ------------------------------|-------------------------------- + * t1 | t2 + * EDRX = 0 | EDRX = 1 + * ( RX is on ) | ( RX is off periodically ) + * ( Data reception is normal ) | ( Data reception is delayed ) + * ------------------------------|-------------------------------- + */ +TEST( Full_CELLULAR_API, Cellular_EidrxEchoTimes ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularEidrxSettings_t eidrxSettings = { 0 }; + CellularEidrxSettingsList_t eidrxSettingsList = { 0 }; + uint8_t drxValue = 5; /* 5 = ( 0 1 0 1 ) 81.92 seconds. */ + const uint32_t testTimoutMs = 80000U; /* Test waiting socket receive time. */ + uint32_t normalReceiveTimes = 0; + uint32_t edrxReceiveTimes = 0; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + /* Disable the EDRX mode. */ + eidrxSettings.mode = 0; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Send the data to the server and wait for response. */ + normalReceiveTimes = prvTestSocketReceiveCount( testTimoutMs, testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS ); + configPRINTF( ( "Normal echo test receive times %d\r\n", normalReceiveTimes ) ); + Platform_Delay( testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS ); + + /* Enabling the EDRX mode and verify. */ + eidrxSettings.mode = 1; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = drxValue; + + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, &eidrxSettingsList ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Send the data to the server and wait for response. + * Data receive times is less in eDRX mode. */ + edrxReceiveTimes = prvTestSocketReceiveCount( testTimoutMs, testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS ); + configPRINTF( ( "EDRX echo test receive times %d\r\n", edrxReceiveTimes ) ); + TEST_ASSERT_MESSAGE( ( edrxReceiveTimes < normalReceiveTimes ), + "EDRX receive more times than normal" ); + + /* Disabling the EDRX mode. */ + eidrxSettings.mode = 3; + eidrxSettings.rat = testCELLULAR_EDRX_RAT; + eidrxSettings.requestedEdrxVaue = 0; + + configPRINTF( ( "Disable and reset EDRX settings\r\n" ) ); + xCellularStatus = Cellular_SetEidrxSettings( _cellularHandle, &eidrxSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + xCellularStatus = Cellular_GetEidrxSettings( _cellularHandle, &eidrxSettingsList ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + else + { + TEST_FAIL(); + } +} + +/*-----------------------------------------------------------*/ + +/* + * @brief Check cellular power saving mode status. + * + * --------------------|--------------------- + * t1 | t2 + * PSM = 0 | PSM = 1 + * (at cmd works) | (at cmd fails) + * --------------------|--------------------- + */ +TEST( Full_CELLULAR_API, Cellular_PsmStatus ) +{ + CellularError_t xCellularStatus = CELLULAR_SUCCESS; + CellularPsmSettings_t psmSettings = { 0 }; + uint32_t psmTau = 4; /* 4 * 10 minutes = 40 minutes. */ + uint32_t psmTimer = 14; /* 14 * 2 seconds = 28 Seconds. */ + uint32_t tries = 0; + EventBits_t waitEventBits = 0; + + if( prvIsConnectedCellular() == pdFAIL ) + { + TEST_ASSERT( prvConnectCellular() == pdPASS ); + } + + if( TEST_PROTECT() ) + { + /* Setup the modem event. */ + _modemEventGroup = xEventGroupCreate(); + TEST_ASSERT_MESSAGE( _modemEventGroup != NULL, "Create event group fail" ); + xEventGroupClearBits( _modemEventGroup, + MODEM_EVENT_BOOTUP_OR_REBOOT_BIT | MODEM_EVENT_POWERED_DOWN_BIT | MODEM_EVENT_PSM_ENTER_BIT ); + + xCellularStatus = Cellular_RegisterModemEventCallback( _cellularHandle, prvCellularModemEventCallback, NULL ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + /* Disabling the PSM mode if ON. */ + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + if( psmSettings.mode == 1 ) + { + psmSettings.mode = 0; + psmSettings.periodicTauValue = 0; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = 0; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + } + + /* Enabling the PSM mode and verify. */ + psmSettings.mode = 1; + psmSettings.periodicTauValue = psmTau; + psmSettings.periodicRauValue = 0; + psmSettings.gprsReadyTimer = 0; + psmSettings.activeTimeValue = psmTimer; + + xCellularStatus = Cellular_SetPsmSettings( _cellularHandle, &psmSettings ); + TEST_CELLULAR_ASSERT_REQUIRED_API( CELLULAR_SUCCESS == xCellularStatus, xCellularStatus ); + + for( tries = 0; tries < testCELLULAR_MAX_GET_PSM_RETRY; tries++ ) + { + xCellularStatus = Cellular_GetPsmSettings( _cellularHandle, &psmSettings ); + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + configPRINTF( ( "PSM mode polling %u\r\n", psmSettings.mode ) ); + + if( psmSettings.mode == 1 ) + { + break; + } + } + + Platform_Delay( testCELLULAR_GET_PSM_RETRY_INTERVAL_MS ); + } + + if( xCellularStatus == CELLULAR_SUCCESS ) + { + TEST_ASSERT_EQUAL_INT32( psmSettings.mode, 1 ); + configPRINTF( ( "PSM active time %u\r\n", psmSettings.activeTimeValue ) ); + } + + /* Wait until active timer expired. */ + for( tries = 0; tries < testCELLULAR_WAIT_PSM_ENTER_EVENT_RETRY; tries++ ) + { + configPRINTF( ( "Waiting PSM enter event %u\r\n", tries ) ); + waitEventBits = xEventGroupWaitBits( _modemEventGroup, + MODEM_EVENT_PSM_ENTER_BIT, + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( psmSettings.activeTimeValue * 1000UL ) ); + + if( ( waitEventBits & MODEM_EVENT_PSM_ENTER_BIT ) != 0 ) + { + break; + } + } + + /* Wait 5 seconds after PSM mode entered. */ + Platform_Delay( 5000 ); + + /* Send the AT command to cellular module should return error. */ + xCellularStatus = Cellular_ATCommandRaw( _cellularHandle, + NULL, + "AT", + CELLULAR_AT_NO_RESULT, + NULL, + NULL, + 0U ); + + if( CELLULAR_SUCCESS == xCellularStatus ) + { + configPRINTF( ( "Cellular modem still reply to AT. Ignore this test. \r\n" ) ); + TEST_IGNORE(); + } + } + else + { + TEST_FAIL(); + } + + if( _modemEventGroup != NULL ) + { + vEventGroupDelete( _modemEventGroup ); + _modemEventGroup = NULL; + } +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_config.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_config.h new file mode 100644 index 000000000..3ab14ee35 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Test_code/test_config.h @@ -0,0 +1,84 @@ +/* + * FreeRTOS Cellular Preview Release + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +#ifndef TEST_CONFIG_H +#define TEST_CONFIG_H + +/** + * @brief test cellular APIs. + */ +#define testCELLULAR_API ( 1 ) + +/** + * DNS server address. + * #define testCELLULAR_DNS_SERVER_ADDRESS "...insert here..." + */ + +/** + * Host name to resolve. The host name should only has one IP address. + * #define testCELLULAR_HOST_NAME "...insert here..." + */ + +/** + * Host name resolved address. The resolved address should be the IP address of + * testCELLULAR_HOST_NAME. + * #define testCELLULAR_HOST_NAME_ADDRESS "...insert here..." + */ + +/** + * Echo server address for tcp connection test. + * #define testCELLULAR_ECHO_SERVER_ADDRESS "...insert here..." + */ + +/** + * Echo server port for tcp connection test. + * #define testCELLULAR_ECHO_SERVER_PORT ( ...insert here... ) + */ + +/** + * Repeat echo server address for EDRX echo times test. + * #define testCELLULAR_EDRX_ECHO_SERVER_ADDRESS "...insert here..." + */ + +/** + * Repeat echo server port for EDRX echo times test. + * #define testCELLULAR_EDRX_ECHO_SERVER_PORT ( ...insert here... ) + */ + +/** + * Repeat echo server send interfal for EDRX echo times test. + * This settings should align with your repeat echo server settings. + * #define testCELLULAR_EDRX_ECHO_SERVER_DATA_SEND_INTERVAL_MS ( ...insert here... ) + */ + + +#define testconfigTEST_STACKSIZE ( 1024 ) + +#define testconfigTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/* UNITY test config. */ +#define UNITY_EXCLUDE_SETJMP_H + +#endif /* TEST_CONFIG_H */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj new file mode 100644 index 000000000..597c4a7b9 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj @@ -0,0 +1,1755 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} + FreeRTOS-Cellular-Interface-Integration + 10.0 + + + + Application + false + MultiByte + v142 + + + Application + false + MultiByte + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + Debug\ + Debug\ + true + .\Release\ + .\Release\ + false + AllRules.ruleset + + + C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\;.;$(IncludePath) + ..\..\..\CMock\vendor\unity\extras\memory\src;..\..\..\CMock\vendor\unity\extras\fixture\src;..\..\..\CMock\vendor\unity\src;$(SourcePath) + + + + .\Debug/WIN32.tlb + + + + + Disabled + .\Config;..\..\CMock\vendor\unity\src;..\..\CMock\vendor\unity\extras\fixture\src;..\..\CMock\vendor\unity\extras\memory\src;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\Source\Utilities\logging;..\..\..\Source\FreeRTOS-Plus-CLI;.\Test_Code;..\..\..\Source\FreeRTOS-Plus-TCP\include;.\DemoTasks\include;.\TraceMacros\Example1;.\WinPCap;.;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\common;..\..\..\Source\FreeRTOS-Cellular-Interface\source\include\private;..\..\..\Source\FreeRTOS-Cellular-Interface\source\interface;..\..\..\..\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;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDLL + .\Debug/WIN32.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + false + EditAndContinue + /wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 %(AdditionalOptions) + true + NotUsing + false + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Debug/FreeRTOS-Cellular-Interface-Integration.exe + true + true + .\Debug/WIN32.pdb + Console + MachineX86 + wpcap.lib;%(AdditionalDependencies) + .\WinPCap + false + + + true + .\Debug/WIN32.bsc + + + + + .\Release/WIN32.tlb + + + + + MaxSpeed + OnlyExplicitInline + _WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/WIN32.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + ..\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) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c09 + + + .\Release/RTOSDemo.exe + true + .\Release/WIN32.pdb + Console + MachineX86 + ..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap + wpcap.lib;%(AdditionalDependencies) + + + true + .\Release/WIN32.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.filters b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.filters new file mode 100644 index 000000000..a96cae31f --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.filters @@ -0,0 +1,4873 @@ + + + + + {af3445a1-4908-4170-89ed-39345d90d30c} + + + {f32be356-4763-4cae-9020-974a2638cb08} + *.c + + + {e5ad4ec7-23dc-4295-8add-2acaee488f5a} + + + {d2dcd641-8d91-492b-852f-5563ffadaec6} + + + {8672fa26-b119-481f-8b8d-086419c01a3e} + + + {5d93ed51-023a-41ad-9243-8d230165d34b} + + + {fdabc401-4468-412c-8dc1-0e366fcdbec1} + + + {88f409e6-d396-4ac5-94bd-7a99c914be46} + + + {4570be11-ec96-4b55-ac58-24b50ada980a} + + + {ab9af260-f93b-4680-9460-1866aaab43f6} + + + {98f985a8-c260-43fe-862f-7534a83922d7} + + + {623bd581-b971-47af-b62c-ac19b71a44c1} + + + {6f69faaf-fdbe-4cd4-aec4-eea7358b8cb2} + + + {245a1489-fc0a-4108-bc64-d8c64c1a8c81} + + + {d2afe32f-b25e-4582-afd3-3b5841aa4780} + + + {7cd53342-eb66-4094-8d53-93df2949c4b5} + + + {dc865d04-f3df-40b2-8e66-7710451fb58b} + + + {671d03ff-d38e-4e14-8c6e-d57aa11f3f3d} + + + {39ab9ea6-f7dc-4f5d-a276-a38e1a93ac13} + + + {01356adc-7a1b-4cdf-af33-72929351d33f} + + + {9e48f613-62a8-4161-a219-92d6cf111c17} + + + {82f1e0e5-12ad-473a-8e5b-80d068f76afa} + + + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP + + + FreeRTOS+\FreeRTOS+TCP\Portable + + + FreeRTOS+\FreeRTOS+TCP\Portable + + + + + Test_Code + + + Unity + + + Unity + + + Unity + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular + + + FreeRTOS+\module\bg96 + + + FreeRTOS+\module\bg96 + + + FreeRTOS+\module\bg96 + + + FreeRTOS+\module\bg96 + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source\Portable + + + FreeRTOS\Source\Source + + + FreeRTOS\Source\Source + + + FreeRTOS\Source\Source + + + FreeRTOS\Source\Source + + + FreeRTOS\Source\Source + + + + + + FreeRTOS+\FreeRTOS+TCP\include + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + Windows resources + + + + + Test_Code + + + Unity + + + Unity + + + Unity + + + Unity + + + Unity + + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\interface + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\common + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\cellular\include\private + + + FreeRTOS+\module\bg96 + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS+\FreeRTOS+TCP\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS\Source\include + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + FreeRTOS+\FreeRTOS IoT Libraries\platform\logging + + + Test_Code + + + + + Windows resources + + + Windows resources + + + Windows resources + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.user b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.user new file mode 100644 index 000000000..88a550947 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WIN32.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Packet32.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Packet32.h new file mode 100644 index 000000000..e8a444dee --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Packet32.h @@ -0,0 +1,398 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2007 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32h Packet.dll definitions and data structures + * Packet32.h contains the data structures and the definitions used by packet.dll. + * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included + * by the applications that use the functions of this library + * @{ + */ + +#ifndef __PACKET32 + #define __PACKET32 + + #include + + #ifdef HAVE_AIRPCAP_API + #include + #else + #if !defined( AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ ) + #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ + typedef struct _AirpcapHandle * PAirpcapHandle; + #endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */ + #endif /* HAVE_AIRPCAP_API */ + + #ifdef HAVE_DAG_API + #include + #endif /* HAVE_DAG_API */ + +/* Working modes */ + #define PACKET_MODE_CAPT 0x0 /*/< Capture mode */ + #define PACKET_MODE_STAT 0x1 /*/< Statistical mode */ + #define PACKET_MODE_MON 0x2 /*/< Monitoring mode */ + #define PACKET_MODE_DUMP 0x10 /*/< Dump mode */ + #define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT /*/< Statistical dump Mode */ + + +/*/ Alignment macro. Defines the alignment size. */ + #define Packet_ALIGNMENT sizeof( int ) +/*/ Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. */ + #define Packet_WORDALIGN( x ) ( ( ( x ) + ( Packet_ALIGNMENT - 1 ) ) & ~( Packet_ALIGNMENT - 1 ) ) + + #define NdisMediumNull -1 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + #define NdisMediumCHDLC -2 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + #define NdisMediumPPPSerial -3 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + #define NdisMediumBare80211 -4 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + #define NdisMediumRadio80211 -5 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + #define NdisMediumPpi -6 /*/< Custom linktype: NDIS doesn't provide an equivalent */ + +/* Loopback behaviour definitions */ + #define NPF_DISABLE_LOOPBACK 1 /*/< Drop the packets sent by the NPF driver */ + #define NPF_ENABLE_LOOPBACK 2 /*/< Capture the packets sent by the NPF driver */ + +/*! + * \brief Network type structure. + * + * This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. + */ + typedef struct NetType + { + UINT LinkType; /*/< The MAC of the current network adapter (see function PacketGetNetType() for more information) */ + ULONGLONG LinkSpeed; /*/< The speed of the network in bits per second */ + } NetType; + + +/*some definitions stolen from libpcap */ + + #ifndef BPF_MAJOR_VERSION + +/*! + * \brief A BPF pseudo-assembly program. + * + * The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. + */ + struct bpf_program + { + UINT bf_len; /*/< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. */ + struct bpf_insn * bf_insns; /*/< A pointer to the first instruction of the program. */ + }; + +/*! + * \brief A single BPF pseudo-instruction. + * + * bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. + */ + struct bpf_insn + { + USHORT code; /*/< Instruction type and addressing mode. */ + UCHAR jt; /*/< Jump if true */ + UCHAR jf; /*/< Jump if false */ + int k; /*/< Generic field used for various purposes. */ + }; + +/*! + * \brief Structure that contains a couple of statistics values on the current capture. + * + * It is used by packet.dll to return statistics about a capture session. + */ + struct bpf_stat + { + UINT bs_recv; /*/< Number of packets that the driver received from the network adapter */ + /*/< from the beginning of the current capture. This value includes the packets */ + /*/< lost by the driver. */ + UINT bs_drop; /*/< number of packets that the driver lost from the beginning of a capture. */ + /*/< Basically, a packet is lost when the the buffer of the driver is full. */ + /*/< In this situation the packet cannot be stored and the driver rejects it. */ + UINT ps_ifdrop; /*/< drops by interface. XXX not yet supported */ + UINT bs_capt; /*/< number of packets that pass the filter, find place in the kernel buffer and */ + /*/< thus reach the application. */ + }; + +/*! + * \brief Packet header. + * + * This structure defines the header associated with every packet delivered to the application. + */ + struct bpf_hdr + { + struct timeval bh_tstamp; /*/< The timestamp associated with the captured packet. */ + /*/< It is stored in a TimeVal structure. */ + UINT bh_caplen; /*/< Length of captured portion. The captured portion can be different */ + /*/< from the original packet, because it is possible (with a proper filter) */ + /*/< to instruct the driver to capture only a portion of the packets. */ + UINT bh_datalen; /*/< Original length of packet */ + USHORT bh_hdrlen; /*/< Length of bpf header (this struct plus alignment padding). In some cases, */ + /*/< a padding could be added between the end of this structure and the packet */ + /*/< data for performance reasons. This filed can be used to retrieve the actual data */ + /*/< of the packet. */ + }; + +/*! + * \brief Dump packet header. + * + * This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). + * It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a + * packet in a dump file. This makes straightforward sending WinPcap dump files to the network. + */ + struct dump_bpf_hdr + { + struct timeval ts; /*/< Time stamp of the packet */ + UINT caplen; /*/< Length of captured portion. The captured portion can smaller than the */ + /*/< the original packet, because it is possible (with a proper filter) to */ + /*/< instruct the driver to capture only a portion of the packets. */ + UINT len; /*/< Length of the original packet (off wire). */ + }; + + + #endif /* ifndef BPF_MAJOR_VERSION */ + + struct bpf_stat; + + #define DOSNAMEPREFIX TEXT( "Packet_" ) /*/< Prefix added to the adapters device names to create the WinPcap devices */ + #define MAX_LINK_NAME_LENGTH 64 /*< Maximum length of the devices symbolic links */ + #define NMAX_PACKET 65535 + +/*! + * \brief Addresses of a network adapter. + * + * This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with + * an adapter. + */ + typedef struct npf_if_addr + { + struct sockaddr_storage IPAddress; /*/< IP address. */ + struct sockaddr_storage SubnetMask; /*/< Netmask for that address. */ + struct sockaddr_storage Broadcast; /*/< Broadcast address. */ + } npf_if_addr; + + + #define ADAPTER_NAME_LENGTH 256 + 12 /*/< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. */ + #define ADAPTER_DESC_LENGTH 128 /*/< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. */ + #define MAX_MAC_ADDR_LENGTH 8 /*/< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. */ + #define MAX_NETWORK_ADDRESSES 16 /*/< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. */ + + + typedef struct WAN_ADAPTER_INT WAN_ADAPTER; /*/< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API */ + typedef WAN_ADAPTER * PWAN_ADAPTER; /*/< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API */ + + #define INFO_FLAG_NDIS_ADAPTER 0 /*/< Flag for ADAPTER_INFO: this is a traditional ndis adapter */ + #define INFO_FLAG_NDISWAN_ADAPTER 1 /*/< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET */ + #define INFO_FLAG_DAG_CARD 2 /*/< Flag for ADAPTER_INFO: this is a DAG card */ + #define INFO_FLAG_DAG_FILE 6 /*/< Flag for ADAPTER_INFO: this is a DAG file */ + #define INFO_FLAG_DONT_EXPORT 8 /*/< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. */ + #define INFO_FLAG_AIRPCAP_CARD 16 /*/< Flag for ADAPTER_INFO: this is an airpcap card */ + #define INFO_FLAG_NPFIM_DEVICE 32 + +/*! + * \brief Describes an opened network adapter. + * + * This structure is the most important for the functioning of packet.dll, but the great part of its fields + * should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters + */ + typedef struct _ADAPTER + { + HANDLE hFile; /*/< \internal Handle to an open instance of the NPF driver. */ + CHAR SymbolicLink[ MAX_LINK_NAME_LENGTH ]; /*/< \internal A string containing the name of the network adapter currently opened. */ + int NumWrites; /*/< \internal Number of times a packets written on this adapter will be repeated */ + /*/< on the wire. */ + HANDLE ReadEvent; /*/< A notification event associated with the read calls on the adapter. */ + /*/< It can be passed to standard Win32 functions (like WaitForSingleObject */ + /*/< or WaitForMultipleObjects) to wait until the driver's buffer contains some */ + /*/< data. It is particularly useful in GUI applications that need to wait */ + /*/< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() */ + /*/< function can be used to define the minimum amount of data in the kernel buffer */ + /*/< that will cause the event to be signalled. */ + + UINT ReadTimeOut; /*/< \internal The amount of time after which a read on the driver will be released and */ + /*/< ReadEvent will be signaled, also if no packets were captured */ + CHAR Name[ ADAPTER_NAME_LENGTH ]; + PWAN_ADAPTER pWanAdapter; + UINT Flags; /*/< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. */ + + #ifdef HAVE_AIRPCAP_API + PAirpcapHandle AirpcapAd; + #endif // HAVE_AIRPCAP_API + + #ifdef HAVE_NPFIM_API + void * NpfImHandle; + #endif // HAVE_NPFIM_API + + #ifdef HAVE_DAG_API + dagc_t * pDagCard; /*/< Pointer to the dagc API adapter descriptor for this adapter */ + PCHAR DagBuffer; /*/< Pointer to the buffer with the packets that is received from the DAG card */ + struct timeval DagReadTimeout; /*/< Read timeout. The dagc API requires a timeval structure */ + unsigned DagFcsLen; /*/< Length of the frame check sequence attached to any packet by the card. Obtained from the registry */ + DWORD DagFastProcess; /*/< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). */ + #endif // HAVE_DAG_API + } ADAPTER, * LPADAPTER; + +/*! + * \brief Structure that contains a group of packets coming from the driver. + * + * This structure defines the header associated with every packet delivered to the application. + */ + typedef struct _PACKET + { + HANDLE hEvent; /*/< \deprecated Still present for compatibility with old applications. */ + OVERLAPPED OverLapped; /*/< \deprecated Still present for compatibility with old applications. */ + PVOID Buffer; /*/< Buffer with containing the packets. See the PacketReceivePacket() for */ + /*/< details about the organization of the data in this buffer */ + UINT Length; /*/< Length of the buffer */ + DWORD ulBytesReceived; /*/< Number of valid bytes present in the buffer, i.e. amount of data */ + /*/< received by the last call to PacketReceivePacket() */ + BOOLEAN bIoComplete; /*/< \deprecated Still present for compatibility with old applications. */ + } PACKET, * LPPACKET; + +/*! + * \brief Structure containing an OID request. + * + * It is used by the PacketRequest() function to send an OID to the interface card driver. + * It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, + * the list of the multicast groups defined on it, and so on. + */ + struct _PACKET_OID_DATA + { + ULONG Oid; /*/< OID code. See the Microsoft DDK documentation or the file ntddndis.h */ + /*/< for a complete list of valid codes. */ + ULONG Length; /*/< Length of the data field */ + UCHAR Data[ 1 ]; /*/< variable-lenght field that contains the information passed to or received */ + /*/< from the adapter. */ + }; + typedef struct _PACKET_OID_DATA PACKET_OID_DATA, * PPACKET_OID_DATA; + + #ifdef __cplusplus + extern "C" { + #endif + +/** + * @} + */ + +/* + * BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName, + * CHAR *Value, + * UINT *pValueLen, + * CHAR *DefaultVal); + * + * BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName, + * WCHAR *Value, + * UINT *pValueLen, + * WCHAR *DefaultVal); + */ + +/*--------------------------------------------------------------------------- */ +/* EXPORTED FUNCTIONS */ +/*--------------------------------------------------------------------------- */ + + PCHAR PacketGetVersion(); + PCHAR PacketGetDriverVersion(); + BOOLEAN PacketSetMinToCopy( LPADAPTER AdapterObject, + int nbytes ); + BOOLEAN PacketSetNumWrites( LPADAPTER AdapterObject, + int nwrites ); + BOOLEAN PacketSetMode( LPADAPTER AdapterObject, + int mode ); + BOOLEAN PacketSetReadTimeout( LPADAPTER AdapterObject, + int timeout ); + BOOLEAN PacketSetBpf( LPADAPTER AdapterObject, + struct bpf_program * fp ); + BOOLEAN PacketSetLoopbackBehavior( LPADAPTER AdapterObject, + UINT LoopbackBehavior ); + INT PacketSetSnapLen( LPADAPTER AdapterObject, + int snaplen ); + BOOLEAN PacketGetStats( LPADAPTER AdapterObject, + struct bpf_stat * s ); + BOOLEAN PacketGetStatsEx( LPADAPTER AdapterObject, + struct bpf_stat * s ); + BOOLEAN PacketSetBuff( LPADAPTER AdapterObject, + int dim ); + BOOLEAN PacketGetNetType( LPADAPTER AdapterObject, + NetType * type ); + LPADAPTER PacketOpenAdapter( PCHAR AdapterName ); + BOOLEAN PacketSendPacket( LPADAPTER AdapterObject, + LPPACKET pPacket, + BOOLEAN Sync ); + INT PacketSendPackets( LPADAPTER AdapterObject, + PVOID PacketBuff, + ULONG Size, + BOOLEAN Sync ); + LPPACKET PacketAllocatePacket( void ); + VOID PacketInitPacket( LPPACKET lpPacket, + PVOID Buffer, + UINT Length ); + VOID PacketFreePacket( LPPACKET lpPacket ); + BOOLEAN PacketReceivePacket( LPADAPTER AdapterObject, + LPPACKET lpPacket, + BOOLEAN Sync ); + BOOLEAN PacketSetHwFilter( LPADAPTER AdapterObject, + ULONG Filter ); + BOOLEAN PacketGetAdapterNames( PTSTR pStr, + PULONG BufferSize ); + BOOLEAN PacketGetNetInfoEx( PCHAR AdapterName, + npf_if_addr * buffer, + PLONG NEntries ); + BOOLEAN PacketRequest( LPADAPTER AdapterObject, + BOOLEAN Set, + PPACKET_OID_DATA OidData ); + HANDLE PacketGetReadEvent( LPADAPTER AdapterObject ); + BOOLEAN PacketSetDumpName( LPADAPTER AdapterObject, + void * name, + int len ); + BOOLEAN PacketSetDumpLimits( LPADAPTER AdapterObject, + UINT maxfilesize, + UINT maxnpacks ); + BOOLEAN PacketIsDumpEnded( LPADAPTER AdapterObject, + BOOLEAN sync ); + BOOL PacketStopDriver(); + VOID PacketCloseAdapter( LPADAPTER lpAdapter ); + BOOLEAN PacketStartOem( PCHAR errorString, + UINT errorStringLength ); + BOOLEAN PacketStartOemEx( PCHAR errorString, + UINT errorStringLength, + ULONG flags ); + PAirpcapHandle PacketGetAirPcapHandle( LPADAPTER AdapterObject ); + +/* */ +/* Used by PacketStartOemEx */ +/* */ + #define PACKET_START_OEM_NO_NETMON 0x00000001 + + #ifdef __cplusplus + } + #endif + +#endif //__PACKET32 diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/PacketData.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/PacketData.h new file mode 100644 index 000000000..6447af1da --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/PacketData.h @@ -0,0 +1,270 @@ +char pkt1[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x30, 0x09, 0x9c, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x07, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc7, 0x35, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, + 0x40, 0x00, 0xdf, 0xab, 0x00, 0x00, 0x02, 0x04, + 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 }; + +char pkt2[] = { + 0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01, + 0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x2c, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06, + 0xf8, 0xa6, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8, + 0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00, + 0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12, + 0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04, + 0x05, 0x92 }; + +char pkt3[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x28, 0x09, 0x9e, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10, + 0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 }; + +char pkt4[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x02, 0x27, 0x09, 0x9f, 0x40, 0x00, 0x80, 0x06, + 0x6d, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18, + 0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45, + 0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50, + 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c, + 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78, + 0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70, + 0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, + 0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65, + 0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, + 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78, + 0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c, + 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64, + 0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, + 0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78, + 0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, + 0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, + 0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c, + 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a, + 0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a, + 0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64, + 0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a, + 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69, + 0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20, + 0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, + 0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49, + 0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e, + 0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53, + 0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e, + 0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32, + 0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37, + 0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43, + 0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30, + 0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38, + 0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43, + 0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32, + 0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48, + 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32, + 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31, + 0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b, + 0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76, + 0x65, 0x0d, 0x0a, 0x0d, 0x0a }; + +char pkt5[] = { + 0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01, + 0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x40, 0x06, + 0xf8, 0xa5, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8, + 0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00, + 0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12, + 0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04, + 0x05, 0x92 }; + +char pkt6[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x28, 0x09, 0xa1, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10, + 0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 }; + +char pkt7[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x02, 0x27, 0x09, 0xa2, 0x40, 0x00, 0x80, 0x06, + 0x6d, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18, + 0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45, + 0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50, + 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c, + 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78, + 0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70, + 0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, + 0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65, + 0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, + 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78, + 0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c, + 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64, + 0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, + 0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78, + 0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, + 0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, + 0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c, + 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a, + 0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a, + 0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64, + 0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a, + 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69, + 0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20, + 0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, + 0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49, + 0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e, + 0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53, + 0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e, + 0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32, + 0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37, + 0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43, + 0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30, + 0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38, + 0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43, + 0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32, + 0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48, + 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32, + 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31, + 0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b, + 0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76, + 0x65, 0x0d, 0x0a, 0x0d, 0x0a }; + +char pkt8[] = { + 0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01, + 0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x2c, 0x00, 0x03, 0x00, 0x00, 0x40, 0x06, + 0xf8, 0xa4, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8, + 0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00, + 0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12, + 0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04, + 0x05, 0x92 }; + +char pkt9[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x28, 0x09, 0xa3, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x08, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10, + 0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 }; + +char pkt10[] = { + 0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01, + 0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x2c, 0x00, 0x04, 0x00, 0x00, 0x40, 0x06, + 0xf8, 0xa3, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8, + 0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00, + 0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12, + 0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04, + 0x05, 0x92 }; + +char pkt11[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x28, 0x09, 0xa6, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x05, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10, + 0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00 }; + +char pkt12[] = { + 0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14, + 0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x28, 0x09, 0xa7, 0x40, 0x00, 0x80, 0x06, + 0x6f, 0x04, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8, + 0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7, + 0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x14, + 0x00, 0x00, 0x43, 0xf4, 0x00, 0x00 }; + + +typedef struct +{ + char * pcData; + int iDataLen; +} xPacketData; + +xPacketData xAllPackets[] = +{ +/* These comments below are there so that we may modify + * them as and when required. Keeping them unmodified. + * Might be removed in later incremental PRs */ + { pkt1, sizeof( pkt1 ) }, +/* { pkt2, sizeof( pkt2 ) }, */ + { pkt3, sizeof( pkt3 ) }, + { pkt4, sizeof( pkt4 ) }, +/* { pkt5, sizeof( pkt5 ) }, */ + { pkt6, sizeof( pkt6 ) }, + { pkt7, sizeof( pkt7 ) }, + { pkt8, sizeof( pkt8 ) }, + { pkt9, sizeof( pkt9 ) }, + { pkt10, sizeof( pkt10 ) }, +/* { pkt11, sizeof( pkt11 ) }, */ +/* { pkt12, sizeof( pkt12 ) }, */ +/* { pkt13, sizeof( pkt13 ) }, */ +/* { pkt14, sizeof( pkt14 ) }, */ +/* { pkt15, sizeof( pkt15 ) }, */ +/* { pkt16, sizeof( pkt16 ) }, */ +}; diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Win32-Extensions.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Win32-Extensions.h new file mode 100644 index 000000000..aad6a2866 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/Win32-Extensions.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef __WIN32_EXTENSIONS_H__ + #define __WIN32_EXTENSIONS_H__ + + #ifdef __cplusplus + extern "C" { + #endif + +/* Definitions */ + +/*! + * \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). + */ + struct pcap_send_queue + { + u_int maxlen; /*/< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. */ + u_int len; /*/< Current size of the queue, in bytes. */ + char * buffer; /*/< Buffer containing the packets to be sent. */ + }; + + typedef struct pcap_send_queue pcap_send_queue; + +/*! + * \brief This typedef is a support for the pcap_get_airpcap_handle() function + */ + #if !defined( AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ ) + #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ + typedef struct _AirpcapHandle * PAirpcapHandle; + #endif + + #define BPF_MEM_EX_IMM 0xc0 + #define BPF_MEM_EX_IND 0xe0 + +/*used for ST*/ + #define BPF_MEM_EX 0xc0 + #define BPF_TME 0x08 + + #define BPF_LOOKUP 0x90 + #define BPF_EXECUTE 0xa0 + #define BPF_INIT 0xb0 + #define BPF_VALIDATE 0xc0 + #define BPF_SET_ACTIVE 0xd0 + #define BPF_RESET 0xe0 + #define BPF_SET_MEMORY 0x80 + #define BPF_GET_REGISTER_VALUE 0x70 + #define BPF_SET_REGISTER_VALUE 0x60 + #define BPF_SET_WORKING 0x50 + #define BPF_SET_ACTIVE_READ 0x40 + #define BPF_SET_AUTODELETION 0x30 + #define BPF_SEPARATION 0xff + +/* Prototypes */ + pcap_send_queue * pcap_sendqueue_alloc( u_int memsize ); + + void pcap_sendqueue_destroy( pcap_send_queue * queue ); + + int pcap_sendqueue_queue( pcap_send_queue * queue, + const struct pcap_pkthdr * pkt_header, + const u_char * pkt_data ); + + u_int pcap_sendqueue_transmit( pcap_t * p, + pcap_send_queue * queue, + int sync ); + + HANDLE pcap_getevent( pcap_t * p ); + + struct pcap_stat * pcap_stats_ex( pcap_t * p, + int * pcap_stat_size ); + + int pcap_setuserbuffer( pcap_t * p, + int size ); + + int pcap_live_dump( pcap_t * p, + char * filename, + int maxsize, + int maxpacks ); + + int pcap_live_dump_ended( pcap_t * p, + int sync ); + + int pcap_offline_filter( struct bpf_program * prog, + const struct pcap_pkthdr * header, + const u_char * pkt_data ); + + int pcap_start_oem( char * err_str, + int flags ); + + PAirpcapHandle pcap_get_airpcap_handle( pcap_t * p ); + + #ifdef __cplusplus + } + #endif + +#endif //__WIN32_EXTENSIONS_H__ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/arch.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/arch.c new file mode 100644 index 000000000..e7dd20bd7 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/arch.c @@ -0,0 +1,338 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2017 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +/* WinPCap includes. */ +#include "pcap.h" +#include "remote-ext.h" + +/* uIP includes. */ +#include "net/uip.h" +#include "net/uip_arp.h" +#include "net/clock-arch.h" + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +/* + * Query the computer the simulation is being executed on to find the network + * interfaces it has installed. + */ +static pcap_if_t * prvPrintAvailableNetworkInterfaces( void ); + +/* + * Open the network interface. The number of the interface to be opened is set + * by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h. + */ +static void prvOpenSelectedNetworkInterface( pcap_if_t * pxAllNetworkInterfaces ); + +/* + * Configure the capture filter to allow blocking reads, and to filter out + * packets that are not of interest to this demo. + */ +static void prvConfigureCaptureBehaviour( void ); + +pcap_t * pxOpenedInterfaceHandle = NULL; +LARGE_INTEGER freq, sys_start_time; + +#define archNUM_BUFFERS 5 +#define archNUM_BUFFER_POINTERS ( archNUM_BUFFERS - 1 ) + +static void prvInterruptSimulator( void * pvParameters ); + +static unsigned char ucEthernetBuffer[ archNUM_BUFFERS ][ UIP_CONF_BUFFER_SIZE ]; +static unsigned char * pucEthernetBufferPointers[ archNUM_BUFFER_POINTERS ]; + +static long lLengthOfDataInBuffer[ archNUM_BUFFER_POINTERS ] = { 0 }; +static unsigned char ucNextBufferToFill = 0U, ucNextBufferToProcess = 0U; + +unsigned char * uip_buf = NULL; +char cErrorBuffer[ PCAP_ERRBUF_SIZE ]; + +void vNetifTx( void ) +{ + pcap_sendpacket( pxOpenedInterfaceHandle, uip_buf, uip_len ); + pcap_sendpacket( pxOpenedInterfaceHandle, uip_buf, uip_len ); +} +/*-----------------------------------------------------------*/ + +UBaseType_t uxNetifRx( void ) +{ + UBaseType_t xDataLen; + unsigned char * pucTemp; + + /* Check there is really data available. */ + xDataLen = lLengthOfDataInBuffer[ ucNextBufferToProcess ]; + + if( xDataLen != 0L ) + { + /* The buffer pointed to by uip_buf is going to change. Remember which + * buffer uip_buf is currently pointing to. */ + pucTemp = uip_buf; + + /* Point uip_buf at the next buffer that contains data. */ + uip_buf = pucEthernetBufferPointers[ ucNextBufferToProcess ]; + + /* The buffer pointed to by + * pucEthernetBufferPointeres[ ucNextBufferToProcess ] is now in use by + * uip_buf, but the buffer uip_buf was pointing to on entry to this + * function is free. Set + * pucEthernetBufferPointeres[ ucNextBufferToProcess ] to the free + * buffer. */ + pucEthernetBufferPointers[ ucNextBufferToProcess ] = pucTemp; + lLengthOfDataInBuffer[ ucNextBufferToProcess ] = 0L; + + ucNextBufferToProcess++; + + if( ucNextBufferToProcess >= archNUM_BUFFER_POINTERS ) + { + ucNextBufferToProcess = 0L; + } + } + + return xDataLen; +} +/*-----------------------------------------------------------*/ + +BaseType_t xNetifInit( void ) +{ + BaseType_t x; + pcap_if_t * pxAllNetworkInterfaces; + + /* Allocate a free buffer to each buffer pointer. */ + for( x = 0; x < sizeof( pucEthernetBufferPointers ) / sizeof( unsigned char * ); x++ ) + { + pucEthernetBufferPointers[ x ] = &( ucEthernetBuffer[ x ][ 0 ] ); + } + + /* Start with uip_buf pointing to a buffer that is not referenced from the + * pucEthernetBufferPointers[] array. */ + uip_buf = &( ucEthernetBuffer[ archNUM_BUFFERS - 1 ][ 0 ] ); + + /* Query the computer the simulation is being executed on to find the + * network interfaces it has installed. */ + pxAllNetworkInterfaces = prvPrintAvailableNetworkInterfaces(); + + /* Open the network interface. The number of the interface to be opened is + * set by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h. + * Calling this function will set the pxOpenedInterfaceHandle variable. If, + * after calling this function, pxOpenedInterfaceHandle is equal to NULL, then + * the interface could not be opened. */ + if( pxAllNetworkInterfaces != NULL ) + { + prvOpenSelectedNetworkInterface( pxAllNetworkInterfaces ); + } + + return x; +} +/*-----------------------------------------------------------*/ + +static pcap_if_t * prvPrintAvailableNetworkInterfaces( void ) +{ + pcap_if_t * pxAllNetworkInterfaces = NULL, * xInterface; + long lInterfaceNumber = 1; + + if( pcap_findalldevs_ex( PCAP_SRC_IF_STRING, NULL, &pxAllNetworkInterfaces, cErrorBuffer ) == -1 ) + { + printf( "\r\nCould not obtain a list of network interfaces\r\n%s\r\n", cErrorBuffer ); + pxAllNetworkInterfaces = NULL; + } + + if( pxAllNetworkInterfaces != NULL ) + { + /* Print out the list of network interfaces. The first in the list + * is interface '1', not interface '0'. */ + for( xInterface = pxAllNetworkInterfaces; xInterface != NULL; xInterface = xInterface->next ) + { + printf( "%d. %s", lInterfaceNumber, xInterface->name ); + + if( xInterface->description != NULL ) + { + printf( " (%s)\r\n", xInterface->description ); + } + else + { + printf( " (No description available)\r\n" ); + } + + lInterfaceNumber++; + } + } + + if( lInterfaceNumber == 1 ) + { + /* The interface number was never incremented, so the above for() loop + * did not execute meaning no interfaces were found. */ + printf( " \r\nNo network interfaces were found.\r\n" ); + pxAllNetworkInterfaces = NULL; + } + + printf( "\r\nThe interface that will be opened is set by configNETWORK_INTERFACE_TO_USE which should be defined in FreeRTOSConfig.h\r\n" ); + printf( "Attempting to open interface number %d.\r\n", configNETWORK_INTERFACE_TO_USE ); + + if( ( configNETWORK_INTERFACE_TO_USE < 1L ) || ( configNETWORK_INTERFACE_TO_USE > lInterfaceNumber ) ) + { + printf( "\r\nconfigNETWORK_INTERFACE_TO_USE is not in the valid range.\r\n" ); + + if( pxAllNetworkInterfaces != NULL ) + { + /* Free the device list, as no devices are going to be opened. */ + pcap_freealldevs( pxAllNetworkInterfaces ); + pxAllNetworkInterfaces = NULL; + } + } + + return pxAllNetworkInterfaces; +} +/*-----------------------------------------------------------*/ + +static void prvOpenSelectedNetworkInterface( pcap_if_t * pxAllNetworkInterfaces ) +{ + pcap_if_t * xInterface; + long x; + + /* Walk the list of devices until the selected device is located. */ + xInterface = pxAllNetworkInterfaces; + + for( x = 0L; x < ( configNETWORK_INTERFACE_TO_USE - 1L ); x++ ) + { + xInterface = xInterface->next; + } + + /* Open the selected interface. */ + pxOpenedInterfaceHandle = pcap_open( xInterface->name, /* The name of the selected interface. */ + UIP_CONF_BUFFER_SIZE, /* The size of the packet to capture. */ + PCAP_OPENFLAG_PROMISCUOUS, /* Open in promiscious mode as the MAC and + * IP address is going to be "simulated", and + * not be the real MAC and IP address. This allows + * trafic to the simulated IP address to be routed + * to uIP, and trafic to the real IP address to be + * routed to the Windows TCP/IP stack. */ + 0xfffffffL, /* The read time out. This is going to block + * until data is available. */ + NULL, /* No authentication is required as this is + * not a remote capture session. */ + cErrorBuffer + ); + + if( pxOpenedInterfaceHandle == NULL ) + { + printf( "\r\n%s is not supported by WinPcap and cannot be opened\r\n", xInterface->name ); + } + else + { + /* Configure the capture filter to allow blocking reads, and to filter + * out packets that are not of interest to this demo. */ + prvConfigureCaptureBehaviour(); + } + + /* The device list is no longer required. */ + pcap_freealldevs( pxAllNetworkInterfaces ); +} +/*-----------------------------------------------------------*/ + +static void prvConfigureCaptureBehaviour( void ) +{ + struct bpf_program xFilterCode; + const long lMinBytesToCopy = 10L, lBlocking = 0L; + unsigned long ulNetMask; + + /* Unblock a read as soon as anything is received. */ + pcap_setmintocopy( pxOpenedInterfaceHandle, lMinBytesToCopy ); + + /* Allow blocking. */ + pcap_setnonblock( pxOpenedInterfaceHandle, lBlocking, cErrorBuffer ); + + /* Set up a filter so only the packets of interest are passed to the uIP + * stack. cErrorBuffer is used for convenience to create the string. Don't + * confuse this with an error message. */ + sprintf( cErrorBuffer, "broadcast or multicast or host %d.%d.%d.%d", configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 ); + + ulNetMask = ( configNET_MASK3 << 24UL ) | ( configNET_MASK2 << 16UL ) | ( configNET_MASK1 << 8L ) | configNET_MASK0; + + if( pcap_compile( pxOpenedInterfaceHandle, &xFilterCode, cErrorBuffer, 1, ulNetMask ) < 0 ) + { + printf( "\r\nThe packet filter string is invalid\r\n" ); + } + else + { + if( pcap_setfilter( pxOpenedInterfaceHandle, &xFilterCode ) < 0 ) + { + printf( "\r\nAn error occurred setting the packet filter.\r\n" ); + } + } + + /* Create a task that simulates an interrupt in a real system. This will + * block waiting for packets, then send a message to the uIP task when data + * is available. */ + xTaskCreate( prvInterruptSimulator, ( signed char * ) "MAC_ISR", configMINIMAL_STACK_SIZE, NULL, ( configuIP_TASK_PRIORITY - 1 ), NULL ); +} +/*-----------------------------------------------------------*/ + +static void prvInterruptSimulator( void * pvParameters ) +{ + static struct pcap_pkthdr * pxHeader; + const unsigned char * pucPacketData; + extern QueueHandle_t xEMACEventQueue; + const unsigned long ulRxEvent = uipETHERNET_RX_EVENT; + long lResult; + + /* Just to kill the compiler warning. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Get the next packet. */ + lResult = pcap_next_ex( pxOpenedInterfaceHandle, &pxHeader, &pucPacketData ); + + if( lResult ) + { + /* Is the next buffer into which data should be placed free? */ + if( lLengthOfDataInBuffer[ ucNextBufferToFill ] == 0L ) + { + /* Copy the data from the captured packet into the buffer. */ + memcpy( pucEthernetBufferPointers[ ucNextBufferToFill ], pucPacketData, pxHeader->len ); + + /* Note the amount of data that was copied. */ + lLengthOfDataInBuffer[ ucNextBufferToFill ] = pxHeader->len; + + /* Move onto the next buffer, wrapping around if necessary. */ + ucNextBufferToFill++; + + if( ucNextBufferToFill >= archNUM_BUFFER_POINTERS ) + { + ucNextBufferToFill = 0U; + } + + /* Data was received and stored. Send a message to the uIP task + * to let it know. */ + xQueueSendToBack( xEMACEventQueue, &ulRxEvent, portMAX_DELAY ); + } + } + } +} diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/bittypes.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/bittypes.h new file mode 100644 index 000000000..2be3d28db --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/bittypes.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _BITTYPES_H +#define _BITTYPES_H + +#ifndef HAVE_U_INT8_T + + #if SIZEOF_CHAR == 1 + typedef unsigned char u_int8_t; + typedef signed char _int8_t; + #elif SIZEOF_INT == 1 + typedef unsigned int u_int8_t; + typedef signed int int8_t; + #else /* XXX */ + #error "there's no appropriate type for u_int8_t" + #endif + #define HAVE_U_INT8_T 1 + #define HAVE_INT8_T 1 + +#endif /* HAVE_U_INT8_T */ + +#ifndef HAVE_U_INT16_T + + #if SIZEOF_SHORT == 2 + typedef unsigned short u_int16_t; + typedef signed short _int16_t; + #elif SIZEOF_INT == 2 + typedef unsigned int u_int16_t; + typedef signed int int16_t; + #elif SIZEOF_CHAR == 2 + typedef unsigned char u_int16_t; + typedef signed char int16_t; + #else /* XXX */ + #error "there's no appropriate type for u_int16_t" + #endif /* if SIZEOF_SHORT == 2 */ + #define HAVE_U_INT16_T 1 + #define HAVE_INT16_T 1 + +#endif /* HAVE_U_INT16_T */ + +#ifndef HAVE_U_INT32_T + + #if SIZEOF_INT == 4 + typedef unsigned int u_int32_t; + typedef signed int _int32_t; + #elif SIZEOF_LONG == 4 + typedef unsigned long u_int32_t; + typedef signed long int32_t; + #elif SIZEOF_SHORT == 4 + typedef unsigned short u_int32_t; + typedef signed short int32_t; + #else /* XXX */ + #error "there's no appropriate type for u_int32_t" + #endif /* if SIZEOF_INT == 4 */ + #define HAVE_U_INT32_T 1 + #define HAVE_INT32_T 1 + +#endif /* HAVE_U_INT32_T */ + +#ifndef HAVE_U_INT64_T + #if SIZEOF_LONG_LONG == 8 + typedef unsigned long long u_int64_t; + typedef long long int64_t; + #elif defined( _MSC_EXTENSIONS ) + typedef unsigned _int64 u_int64_t; + typedef _int64 int64_t; + #elif SIZEOF_INT == 8 + typedef unsigned int u_int64_t; + #elif SIZEOF_LONG == 8 + typedef unsigned long u_int64_t; + #elif SIZEOF_SHORT == 8 + typedef unsigned short u_int64_t; + #else /* XXX */ + #error "there's no appropriate type for u_int64_t" + #endif /* if SIZEOF_LONG_LONG == 8 */ + +#endif /* HAVE_U_INT64_T */ + +#ifndef PRId64 + #ifdef _MSC_EXTENSIONS + #define PRId64 "I64d" + #else /* _MSC_EXTENSIONS */ + #define PRId64 "lld" + #endif /* _MSC_EXTENSIONS */ +#endif /* PRId64 */ + +#ifndef PRIo64 + #ifdef _MSC_EXTENSIONS + #define PRIo64 "I64o" + #else /* _MSC_EXTENSIONS */ + #define PRIo64 "llo" + #endif /* _MSC_EXTENSIONS */ +#endif /* PRIo64 */ + +#ifndef PRIx64 + #ifdef _MSC_EXTENSIONS + #define PRIx64 "I64x" + #else /* _MSC_EXTENSIONS */ + #define PRIx64 "llx" + #endif /* _MSC_EXTENSIONS */ +#endif /* PRIx64 */ + +#ifndef PRIu64 + #ifdef _MSC_EXTENSIONS + #define PRIu64 "I64u" + #else /* _MSC_EXTENSIONS */ + #define PRIu64 "llu" + #endif /* _MSC_EXTENSIONS */ +#endif /* PRIu64 */ + +#endif /* _BITTYPES_H */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/ip6_misc.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/ip6_misc.h new file mode 100644 index 000000000..1b2e4337b --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/ip6_misc.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 1993, 1994, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL) + */ + +/* + * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows + */ + +#include + +#include + +#ifndef __MINGW32__ + #define IN_MULTICAST( a ) IN_CLASSD( a ) +#endif + +#define IN_EXPERIMENTAL( a ) ( ( ( ( u_int32_t ) ( a ) ) & 0xf0000000 ) == 0xf0000000 ) + +#define IN_LOOPBACKNET 127 + +#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF ) +/* IPv6 address */ + struct in6_addr + { + union + { + u_int8_t u6_addr8[ 16 ]; + u_int16_t u6_addr16[ 8 ]; + u_int32_t u6_addr32[ 4 ]; + } + in6_u; + #define s6_addr in6_u.u6_addr8 + #define s6_addr16 in6_u.u6_addr16 + #define s6_addr32 in6_u.u6_addr32 + #define s6_addr64 in6_u.u6_addr64 + }; + + #define IN6ADDR_ANY_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } +#endif /* __MINGW32__ */ + + +#if ( defined _MSC_VER ) || ( defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF ) ) + typedef unsigned short sa_family_t; +#endif + + +#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF ) + + #define __SOCKADDR_COMMON( sa_prefix ) \ + sa_family_t sa_prefix ## family + +/* Ditto, for IPv6. */ + struct sockaddr_in6 + { + __SOCKADDR_COMMON( sin6_ ); + u_int16_t sin6_port; /* Transport layer port # */ + u_int32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + }; + + #define IN6_IS_ADDR_V4MAPPED( a ) \ + ( ( ( ( u_int32_t * ) ( a ) )[ 0 ] == 0 ) && ( ( ( u_int32_t * ) ( a ) )[ 1 ] == 0 ) && \ + ( ( ( u_int32_t * ) ( a ) )[ 2 ] == htonl( 0xffff ) ) ) + + #define IN6_IS_ADDR_MULTICAST( a ) ( ( ( u_int8_t * ) ( a ) )[ 0 ] == 0xff ) + + #define IN6_IS_ADDR_LINKLOCAL( a ) \ + ( ( ( ( u_int32_t * ) ( a ) )[ 0 ] & htonl( 0xffc00000 ) ) == htonl( 0xfe800000 ) ) + + #define IN6_IS_ADDR_LOOPBACK( a ) \ + ( ( ( u_int32_t * ) ( a ) )[ 0 ] == 0 && ( ( u_int32_t * ) ( a ) )[ 1 ] == 0 && \ + ( ( u_int32_t * ) ( a ) )[ 2 ] == 0 && ( ( u_int32_t * ) ( a ) )[ 3 ] == htonl( 1 ) ) +#endif /* __MINGW32__ */ + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[ 0 ] + +/* + * IPV6 extension headers + */ +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +#define IPPROTO_IPV6 41 /* IPv6 header. */ +#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ESP 50 /* encapsulating security payload */ +#define IPPROTO_AH 51 /* authentication header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ +#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ + +#define IPV6_RTHDR_TYPE_0 0 + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_JUMBO_LEN 6 +#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ +#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ +#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE( o ) ( ( o ) & 0xC0 ) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + + +#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF ) + #ifndef EAI_ADDRFAMILY + struct addrinfo + { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char * ai_canonname; /* canonical name for hostname */ + struct sockaddr * ai_addr; /* binary address */ + struct addrinfo * ai_next; /* next structure in linked list */ + }; + #endif /* ifndef EAI_ADDRFAMILY */ +#endif /* __MINGW32__ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/netif.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/netif.h new file mode 100644 index 000000000..e00965cf1 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/netif.h @@ -0,0 +1,52 @@ +/* + * FreeRTOS V202107.00 + * Copyright (C) 2017 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +#ifndef NET_IF_H +#define NET_IF_H + +/* + * Send uip_len bytes from uip_buf to the network interface selected by the + * configNETWORK_INTERFACE_TO_USE constant (defined in FreeRTOSConfig.h). + */ +void vNetifTx( void ); + +/* + * Receive bytes from the network interface selected by the + * configNETWORK_INTERFACE_TO_USE constant (defined in FreeRTOSConfig.h). The + * bytes are placed in uip_buf. The number of bytes copied into uip_buf is + * returned. + */ +UBaseType_t uxNetifRx( void ); + +/* + * Prepare a packet capture session. This will print out all the network + * interfaces available, and the one actually used is set by the + * configNETWORK_INTERFACE_TO_USE constant that is defined in + * FreeRTOSConfig.h. */ +BaseType_t xNetifInit( void ); + +#endif /* NET_IF_H */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-bpf.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-bpf.h new file mode 100644 index 000000000..2657827e0 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-bpf.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007/04/01 21:43:55 guy Exp $ (LBL) + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Some applications + * might expect to be able to include . + */ +#include diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-namedb.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-namedb.h new file mode 100644 index 000000000..80a2f0040 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-namedb.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006/10/04 18:13:32 guy Exp $ (LBL) + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Some applications + * might expect to be able to include . + */ +#include diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-stdinc.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-stdinc.h new file mode 100644 index 000000000..9cde17fb3 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap-stdinc.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL) + */ + +#define SIZEOF_CHAR 1 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#ifndef _MSC_EXTENSIONS + #define SIZEOF_LONG_LONG 8 +#endif + +/* + * Avoids a compiler warning in case this was already defined + * (someone defined _WINSOCKAPI_ when including 'windows.h', in order + * to prevent it from including 'winsock.h') + */ +#ifdef _WINSOCKAPI_ + #undef _WINSOCKAPI_ +#endif +#include + +#include + +#include "bittypes.h" +#include +#include + +#ifndef __MINGW32__ + #include "IP6_misc.h" +#endif + +#define caddr_t char * + +#if _MSC_VER < 1500 + #define snprintf _snprintf + #define vsnprintf _vsnprintf + #define strdup _strdup +#endif + +#define inline __inline + +#ifdef __MINGW32__ + #include +#else /*__MINGW32__*/ +/* MSVC compiler */ + #ifndef _UINTPTR_T_DEFINED + #ifdef _WIN64 + typedef unsigned __int64 uintptr_t; + #else + typedef _W64 unsigned int uintptr_t; + #endif + #define _UINTPTR_T_DEFINED + #endif + + #ifndef _INTPTR_T_DEFINED + #ifdef _WIN64 + typedef __int64 intptr_t; + #else + typedef _W64 int intptr_t; + #endif + #define _INTPTR_T_DEFINED + #endif + +#endif /*__MINGW32__*/ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap.h new file mode 100644 index 000000000..935f9494c --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL) + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Many applications + * expect to be able to include , and at least some of them + * go through contortions in their configure scripts to try to detect + * OSes that have "helpfully" moved pcap.h to without + * leaving behind a file. + */ +#include diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bluetooth.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bluetooth.h new file mode 100644 index 000000000..7bf65df03 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bluetooth.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2006 Paolo Abeni (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * bluetooth data struct + * By Paolo Abeni + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/bluetooth.h,v 1.1 2007/09/22 02:10:17 guy Exp $ + */ + +#ifndef _PCAP_BLUETOOTH_STRUCTS_H__ +#define _PCAP_BLUETOOTH_STRUCTS_H__ + +/* + * Header prepended libpcap to each bluetooth h:4 frame. + * fields are in network byte order + */ +typedef struct _pcap_bluetooth_h4_header { + u_int32_t direction; /* if first bit is set direction is incoming */ +} pcap_bluetooth_h4_header; + + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bpf.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bpf.h new file mode 100644 index 000000000..9f4ca33e3 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/bpf.h @@ -0,0 +1,934 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19.2.8 2008-09-22 20:16:01 guy Exp $ (LBL) + */ + +/* + * This is libpcap's cut-down version of bpf.h; it includes only + * the stuff needed for the code generator and the userland BPF + * interpreter, and the libpcap APIs for setting filters, etc.. + * + * "pcap-bpf.c" will include the native OS version, as it deals with + * the OS's BPF implementation. + * + * XXX - should this all just be moved to "pcap.h"? + */ + +#ifndef BPF_MAJOR_VERSION + +#ifdef __cplusplus +extern "C" { +#endif + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +#ifdef MSDOS /* must be 32-bit */ +typedef long bpf_int32; +typedef unsigned long bpf_u_int32; +#else +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#ifndef __NetBSD__ +#define BPF_ALIGNMENT sizeof(bpf_int32) +#else +#define BPF_ALIGNMENT sizeof(long) +#endif +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +/* + * Structure for "pcap_compile()", "pcap_setfilter()", etc.. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * Data-link level type codes. + * + * Do *NOT* add new values to this list without asking + * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run + * the risk of using a value that's already being used for some other + * purpose, and of having tools that read libpcap-format captures not + * being able to handle captures with your new DLT_ value, with no hope + * that they will ever be changed to do so (as that would destroy their + * ability to read captures using that value for that other purpose). + */ + +/* + * These are the types that are the same on all platforms, and that + * have been defined by for ages. + */ +#define DLT_NULL 0 /* BSD loopback encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* 802.5 Token Ring */ +#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ + +/* + * These are types that are different on some platforms, and that + * have been defined by for ages. We use #ifdefs to + * detect the BSDs that define them differently from the traditional + * libpcap + * + * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, + * but I don't know what the right #define is for BSD/OS. + */ +#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ + +#ifdef __OpenBSD__ +#define DLT_RAW 14 /* raw IP */ +#else +#define DLT_RAW 12 /* raw IP */ +#endif + +/* + * Given that the only OS that currently generates BSD/OS SLIP or PPP + * is, well, BSD/OS, arguably everybody should have chosen its values + * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they + * didn't. So it goes. + */ +#if defined(__NetBSD__) || defined(__FreeBSD__) +#ifndef DLT_SLIP_BSDOS +#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ +#endif +#else +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ +#endif + +/* + * 17 is used for DLT_OLD_PFLOG in OpenBSD; + * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. + * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. + */ + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * Apparently Redback uses this for its SmartEdge 400/800. I hope + * nobody else decided to use it, too. + */ +#define DLT_REDBACK_SMARTEDGE 32 + +/* + * These values are defined by NetBSD; other platforms should refrain from + * using them for other purposes, so that NetBSD savefiles with link + * types of 50 or 51 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ +#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ + +/* + * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses + * a link-layer type of 99 for the tcpdump it supplies. The link-layer + * header has 6 bytes of unknown data, something that appears to be an + * Ethernet type, and 36 bytes that appear to be 0 in at least one capture + * I've seen. + */ +#define DLT_SYMANTEC_FIREWALL 99 + +/* + * Values between 100 and 103 are used in capture file headers as + * link-layer types corresponding to DLT_ types that differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, + * except when it isn't. (I.e., sometimes it's just raw IP, and + * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, + * so that we don't have to worry about the link-layer header.) + */ + +/* + * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides + * with other values. + * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header + * (DLCI, etc.). + */ +#define DLT_FRELAY 107 + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so + * we don't use 12 for it in OSes other than OpenBSD. + */ +#ifdef __OpenBSD__ +#define DLT_LOOP 12 +#else +#define DLT_LOOP 108 +#endif + +/* + * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's + * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other + * than OpenBSD. + */ +#ifdef __OpenBSD__ +#define DLT_ENC 13 +#else +#define DLT_ENC 109 +#endif + +/* + * Values between 110 and 112 are reserved for use in capture file headers + * as link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ types + * other than the corresponding DLT_ types. + */ + +/* + * This is for Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * Apple LocalTalk hardware. + */ +#define DLT_LTALK 114 + +/* + * Acorn Econet. + */ +#define DLT_ECONET 115 + +/* + * Reserved for use with OpenBSD ipfilter. + */ +#define DLT_IPFILTER 116 + +/* + * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 + * in SuSE 6.3, so we can't use 17 for it in capture-file headers. + * + * XXX: is there a conflict with DLT_PFSYNC 18 as well? + */ +#ifdef __OpenBSD__ +#define DLT_OLD_PFLOG 17 +#define DLT_PFSYNC 18 +#endif +#define DLT_PFLOG 117 + +/* + * Registered for Cisco-internal use. + */ +#define DLT_CISCO_IOS 118 + +/* + * For 802.11 cards using the Prism II chips, with a link-layer + * header including Prism monitor mode information plus an 802.11 + * header. + */ +#define DLT_PRISM_HEADER 119 + +/* + * Reserved for Aironet 802.11 cards, with an Aironet link-layer header + * (see Doug Ambrisko's FreeBSD patches). + */ +#define DLT_AIRONET_HEADER 120 + +/* + * Reserved for Siemens HiPath HDLC. + */ +#define DLT_HHDLC 121 + +/* + * This is for RFC 2625 IP-over-Fibre Channel. + * + * This is not for use with raw Fibre Channel, where the link-layer + * header starts with a Fibre Channel frame header; it's for IP-over-FC, + * where the link-layer header starts with an RFC 2625 Network_Header + * field. + */ +#define DLT_IP_OVER_FC 122 + +/* + * This is for Full Frontal ATM on Solaris with SunATM, with a + * pseudo-header followed by an AALn PDU. + * + * There may be other forms of Full Frontal ATM on other OSes, + * with different pseudo-headers. + * + * If ATM software returns a pseudo-header with VPI/VCI information + * (and, ideally, packet type information, e.g. signalling, ILMI, + * LANE, LLC-multiplexed traffic, etc.), it should not use + * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump + * and the like don't have to infer the presence or absence of a + * pseudo-header and the form of the pseudo-header. + */ +#define DLT_SUNATM 123 /* Solaris+SunATM */ + +/* + * Reserved as per request from Kent Dahlgren + * for private use. + */ +#define DLT_RIO 124 /* RapidIO */ +#define DLT_PCI_EXP 125 /* PCI Express */ +#define DLT_AURORA 126 /* Xilinx Aurora link layer */ + +/* + * Header for 802.11 plus a number of bits of link-layer information + * including radio information, used by some recent BSD drivers as + * well as the madwifi Atheros driver for Linux. + */ +#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ + +/* + * Reserved for the TZSP encapsulation, as per request from + * Chris Waters + * TZSP is a generic encapsulation for any other link type, + * which includes a means to include meta-information + * with the packet, e.g. signal strength and channel + * for 802.11 packets. + */ +#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ + +/* + * BSD's ARCNET headers have the source host, destination host, + * and type at the beginning of the packet; that's what's handed + * up to userland via BPF. + * + * Linux's ARCNET headers, however, have a 2-byte offset field + * between the host IDs and the type; that's what's handed up + * to userland via PF_PACKET sockets. + * + * We therefore have to have separate DLT_ values for them. + */ +#define DLT_ARCNET_LINUX 129 /* ARCNET */ + +/* + * Juniper-private data link types, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MLPPP 130 +#define DLT_JUNIPER_MLFR 131 +#define DLT_JUNIPER_ES 132 +#define DLT_JUNIPER_GGSN 133 +#define DLT_JUNIPER_MFR 134 +#define DLT_JUNIPER_ATM2 135 +#define DLT_JUNIPER_SERVICES 136 +#define DLT_JUNIPER_ATM1 137 + +/* + * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund + * . The header that's presented is an Ethernet-like + * header: + * + * #define FIREWIRE_EUI64_LEN 8 + * struct firewire_header { + * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; + * u_char firewire_shost[FIREWIRE_EUI64_LEN]; + * u_short firewire_type; + * }; + * + * with "firewire_type" being an Ethernet type value, rather than, + * for example, raw GASP frames being handed up. + */ +#define DLT_APPLE_IP_OVER_IEEE1394 138 + +/* + * Various SS7 encapsulations, as per a request from Jeff Morriss + * and subsequent discussions. + */ +#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ +#define DLT_MTP2 140 /* MTP2, without pseudo-header */ +#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ +#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ + +/* + * DOCSIS MAC frames. + */ +#define DLT_DOCSIS 143 + +/* + * Linux-IrDA packets. Protocol defined at http://www.irda.org. + * Those packets include IrLAP headers and above (IrLMP...), but + * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy + * framing can be handled by the hardware and depend on the bitrate. + * This is exactly the format you would get capturing on a Linux-IrDA + * interface (irdaX), but not on a raw serial port. + * Note the capture is done in "Linux-cooked" mode, so each packet include + * a fake packet header (struct sll_header). This is because IrDA packet + * decoding is dependant on the direction of the packet (incomming or + * outgoing). + * When/if other platform implement IrDA capture, we may revisit the + * issue and define a real DLT_IRDA... + * Jean II + */ +#define DLT_LINUX_IRDA 144 + +/* + * Reserved for IBM SP switch and IBM Next Federation switch. + */ +#define DLT_IBM_SP 145 +#define DLT_IBM_SN 146 + +/* + * Reserved for private use. If you have some link-layer header type + * that you want to use within your organization, with the capture files + * using that link-layer header type not ever be sent outside your + * organization, you can use these values. + * + * No libpcap release will use these for any purpose, nor will any + * tcpdump release use them, either. + * + * Do *NOT* use these in capture files that you expect anybody not using + * your private versions of capture-file-reading tools to read; in + * particular, do *NOT* use them in products, otherwise you may find that + * people won't be able to use tcpdump, or snort, or Ethereal, or... to + * read capture files from your firewall/intrusion detection/traffic + * monitoring/etc. appliance, or whatever product uses that DLT_ value, + * and you may also find that the developers of those applications will + * not accept patches to let them read those files. + * + * Also, do not use them if somebody might send you a capture using them + * for *their* private type and tools using them for *your* private type + * would have to read them. + * + * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, + * as per the comment above, and use the type you're given. + */ +#define DLT_USER0 147 +#define DLT_USER1 148 +#define DLT_USER2 149 +#define DLT_USER3 150 +#define DLT_USER4 151 +#define DLT_USER5 152 +#define DLT_USER6 153 +#define DLT_USER7 154 +#define DLT_USER8 155 +#define DLT_USER9 156 +#define DLT_USER10 157 +#define DLT_USER11 158 +#define DLT_USER12 159 +#define DLT_USER13 160 +#define DLT_USER14 161 +#define DLT_USER15 162 + +/* + * For future use with 802.11 captures - defined by AbsoluteValue + * Systems to store a number of bits of link-layer information + * including radio information: + * + * http://www.shaftnet.org/~pizza/software/capturefrm.txt + * + * but it might be used by some non-AVS drivers now or in the + * future. + */ +#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MONITOR 164 + +/* + * Reserved for BACnet MS/TP. + */ +#define DLT_BACNET_MS_TP 165 + +/* + * Another PPP variant as per request from Karsten Keil . + * + * This is used in some OSes to allow a kernel socket filter to distinguish + * between incoming and outgoing packets, on a socket intended to + * supply pppd with outgoing packets so it can do dial-on-demand and + * hangup-on-lack-of-demand; incoming packets are filtered out so they + * don't cause pppd to hold the connection up (you don't want random + * input packets such as port scans, packets from old lost connections, + * etc. to force the connection to stay up). + * + * The first byte of the PPP header (0xff03) is modified to accomodate + * the direction - 0x00 = IN, 0x01 = OUT. + */ +#define DLT_PPP_PPPD 166 + +/* + * Names for backwards compatibility with older versions of some PPP + * software; new software should use DLT_PPP_PPPD. + */ +#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD +#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, cookies, etc.. + */ +#define DLT_JUNIPER_PPPOE 167 +#define DLT_JUNIPER_PPPOE_ATM 168 + +#define DLT_GPRS_LLC 169 /* GPRS LLC */ +#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ +#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ + +/* + * Requested by Oolan Zimmer for use in Gcom's T1/E1 line + * monitoring equipment. + */ +#define DLT_GCOM_T1E1 172 +#define DLT_GCOM_SERIAL 173 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_ is used + * for internal communication to Physical Interface Cards (PIC) + */ +#define DLT_JUNIPER_PIC_PEER 174 + +/* + * Link types requested by Gregor Maier of Endace + * Measurement Systems. They add an ERF header (see + * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of + * the link-layer header. + */ +#define DLT_ERF_ETH 175 /* Ethernet */ +#define DLT_ERF_POS 176 /* Packet-over-SONET */ + +/* + * Requested by Daniele Orlandi for raw LAPD + * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header + * includes additional information before the LAPD header, so it's + * not necessarily a generic LAPD header. + */ +#define DLT_LINUX_LAPD 177 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ are used for prepending meta-information + * like interface index, interface name + * before standard Ethernet, PPP, Frelay & C-HDLC Frames + */ +#define DLT_JUNIPER_ETHER 178 +#define DLT_JUNIPER_PPP 179 +#define DLT_JUNIPER_FRELAY 180 +#define DLT_JUNIPER_CHDLC 181 + +/* + * Multi Link Frame Relay (FRF.16) + */ +#define DLT_MFR 182 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for internal communication with a + * voice Adapter Card (PIC) + */ +#define DLT_JUNIPER_VP 183 + +/* + * Arinc 429 frames. + * DLT_ requested by Gianluca Varenni . + * Every frame contains a 32bit A429 label. + * More documentation on Arinc 429 can be found at + * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf + */ +#define DLT_A429 184 + +/* + * Arinc 653 Interpartition Communication messages. + * DLT_ requested by Gianluca Varenni . + * Please refer to the A653-1 standard for more information. + */ +#define DLT_A653_ICM 185 + +/* + * USB packets, beginning with a USB setup header; requested by + * Paolo Abeni . + */ +#define DLT_USB 186 + +/* + * Bluetooth HCI UART transport layer (part H:4); requested by + * Paolo Abeni. + */ +#define DLT_BLUETOOTH_HCI_H4 187 + +/* + * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz + * . + */ +#define DLT_IEEE802_16_MAC_CPS 188 + +/* + * USB packets, beginning with a Linux USB header; requested by + * Paolo Abeni . + */ +#define DLT_USB_LINUX 189 + +/* + * Controller Area Network (CAN) v. 2.0B packets. + * DLT_ requested by Gianluca Varenni . + * Used to dump CAN packets coming from a CAN Vector board. + * More documentation on the CAN v2.0B frames can be found at + * http://www.can-cia.org/downloads/?269 + */ +#define DLT_CAN20B 190 + +/* + * IEEE 802.15.4, with address fields padded, as is done by Linux + * drivers; requested by Juergen Schimmer. + */ +#define DLT_IEEE802_15_4_LINUX 191 + +/* + * Per Packet Information encapsulated packets. + * DLT_ requested by Gianluca Varenni . + */ +#define DLT_PPI 192 + +/* + * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; + * requested by Charles Clancy. + */ +#define DLT_IEEE802_16_MAC_CPS_RADIO 193 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for internal communication with a + * integrated service module (ISM). + */ +#define DLT_JUNIPER_ISM 194 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing); requested by Mikko Saarnivala . + */ +#define DLT_IEEE802_15_4 195 + +/* + * Various link-layer types, with a pseudo-header, for SITA + * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). + */ +#define DLT_SITA 196 + +/* + * Various link-layer types, with a pseudo-header, for Endace DAG cards; + * encapsulates Endace ERF records. Requested by Stephen Donnelly + * . + */ +#define DLT_ERF 197 + +/* + * Special header prepended to Ethernet packets when capturing from a + * u10 Networks board. Requested by Phil Mulholland + * . + */ +#define DLT_RAIF1 198 + +/* + * IPMB packet for IPMI, beginning with the I2C slave address, followed + * by the netFn and LUN, etc.. Requested by Chanthy Toeung + * . + */ +#define DLT_IPMB 199 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for capturing data on a secure tunnel interface. + */ +#define DLT_JUNIPER_ST 200 + +/* + * Bluetooth HCI UART transport layer (part H:4), with pseudo-header + * that includes direction information; requested by Paolo Abeni. + */ +#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 + +/* + * AX.25 packet with a 1-byte KISS header; see + * + * http://www.ax25.net/kiss.htm + * + * as per Richard Stearn . + */ +#define DLT_AX25_KISS 202 + +/* + * LAPD packets from an ISDN channel, starting with the address field, + * with no pseudo-header. + * Requested by Varuna De Silva . + */ +#define DLT_LAPD 203 + +/* + * Variants of various link-layer headers, with a one-byte direction + * pseudo-header prepended - zero means "received by this host", + * non-zero (any non-zero value) means "sent by this host" - as per + * Will Barker . + */ +#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ +#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ +#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ +#define DLT_LAPB_WITH_DIR 207 /* LAPB */ + +/* + * 208 is reserved for an as-yet-unspecified proprietary link-layer + * type, as requested by Will Barker. + */ + +/* + * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman + * . + */ +#define DLT_IPMB_LINUX 209 + +/* + * FlexRay automotive bus - http://www.flexray.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_FLEXRAY 210 + +/* + * Media Oriented Systems Transport (MOST) bus for multimedia + * transport - http://www.mostcooperation.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_MOST 211 + +/* + * Local Interconnect Network (LIN) bus for vehicle networks - + * http://www.lin-subbus.org/ - as requested by Hannes Kaelber + * . + */ +#define DLT_LIN 212 + +/* + * X2E-private data link type used for serial line capture, + * as requested by Hannes Kaelber . + */ +#define DLT_X2E_SERIAL 213 + +/* + * X2E-private data link type used for the Xoraya data logger + * family, as requested by Hannes Kaelber . + */ +#define DLT_X2E_XORAYA 214 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), but with the PHY-level data for non-ASK PHYs (4 octets + * of 0 as preamble, one octet of SFD, one octet of frame length+ + * reserved bit, and then the MAC-layer data, starting with the + * frame control field). + * + * Requested by Max Filippov . + */ +#define DLT_IEEE802_15_4_NONASK_PHY 215 + + +/* + * DLT and savefile link type values are split into a class and + * a member of that class. A class value of 0 indicates a regular + * DLT_/LINKTYPE_ value. + */ +#define DLT_CLASS(x) ((x) & 0x03ff0000) + +/* + * NetBSD-specific generic "raw" link type. The class value indicates + * that this is the generic raw type, and the lower 16 bits are the + * address family we're dealing with. Those values are NetBSD-specific; + * do not assume that they correspond to AF_ values for your operating + * system. + */ +#define DLT_CLASS_NETBSD_RAWAF 0x02240000 +#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) +#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) +#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) + + +/* + * The instruction encodings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* + * The instruction data structure. + */ +struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_u_int32 k; +}; + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +#if __STDC__ || defined(__cplusplus) +extern int bpf_validate(const struct bpf_insn *, int); +extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); +#else +extern int bpf_validate(); +extern u_int bpf_filter(); +#endif + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/namedb.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/namedb.h new file mode 100644 index 000000000..9002c7509 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/namedb.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006/10/04 18:09:22 guy Exp $ (LBL) + */ + +#ifndef lib_pcap_namedb_h +#define lib_pcap_namedb_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * As returned by the pcap_next_etherent() + * XXX this stuff doesn't belong in this interface, but this + * library already must do name to address translation, so + * on systems that don't have support for /etc/ethers, we + * export these hooks since they'll + */ +struct pcap_etherent { + u_char addr[6]; + char name[122]; +}; +#ifndef PCAP_ETHERS_FILE +#define PCAP_ETHERS_FILE "/etc/ethers" +#endif +struct pcap_etherent *pcap_next_etherent(FILE *); +u_char *pcap_ether_hostton(const char*); +u_char *pcap_ether_aton(const char *); + +bpf_u_int32 **pcap_nametoaddr(const char *); +#ifdef INET6 +struct addrinfo *pcap_nametoaddrinfo(const char *); +#endif +bpf_u_int32 pcap_nametonetaddr(const char *); + +int pcap_nametoport(const char *, int *, int *); +int pcap_nametoportrange(const char *, int *, int *, int *); +int pcap_nametoproto(const char *); +int pcap_nametoeproto(const char *); +int pcap_nametollc(const char *); +/* + * If a protocol is unknown, PROTO_UNDEF is returned. + * Also, pcap_nametoport() returns the protocol along with the port number. + * If there are ambiguous entried in /etc/services (i.e. domain + * can be either tcp or udp) PROTO_UNDEF is returned. + */ +#define PROTO_UNDEF -1 + +/* XXX move these to pcap-int.h? */ +int __pcap_atodn(const char *, bpf_u_int32 *); +int __pcap_atoin(const char *, bpf_u_int32 *); +u_short __pcap_nametodnaddr(const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/pcap.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/pcap.h new file mode 100644 index 000000000..ad8fc40ac --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/pcap.h @@ -0,0 +1,407 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.4.2.11 2008-10-06 15:38:39 gianluca Exp $ (LBL) + */ + +#ifndef lib_pcap_pcap_h +#define lib_pcap_pcap_h + +#if defined(WIN32) + #include +#elif defined(MSDOS) + #include + #include /* u_int, u_char etc. */ +#else /* UN*X */ + #include + #include +#endif /* WIN32/MSDOS/UN*X */ + +#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H +#include +#endif + +#include + +#ifdef HAVE_REMOTE + // We have to define the SOCKET here, although it has been defined in sockutils.h + // This is to avoid the distribution of the 'sockutils.h' file around + // (for example in the WinPcap developer's pack) + #ifndef SOCKET + #ifdef WIN32 + #define SOCKET unsigned int + #else + #define SOCKET int + #endif + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PCAP_VERSION_MAJOR 2 +#define PCAP_VERSION_MINOR 4 + +#define PCAP_ERRBUF_SIZE 256 + +/* + * Compatibility for systems that have a bpf.h that + * predates the bpf typedefs for 64-bit support. + */ +#if BPF_RELEASE - 0 < 199406 +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +typedef struct pcap pcap_t; +typedef struct pcap_dumper pcap_dumper_t; +typedef struct pcap_if pcap_if_t; +typedef struct pcap_addr pcap_addr_t; + +/* + * The first record in the file contains saved values for some + * of the flags used in the printout phases of tcpdump. + * Many fields here are 32 bit ints so compilers won't insert unwanted + * padding; these files need to be interchangeable across architectures. + * + * Do not change the layout of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * + * Also, do not change the interpretation of any of the members of this + * structure, in any way (this includes using values other than + * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" + * field). + * + * Instead: + * + * introduce a new structure for the new format, if the layout + * of the structure changed; + * + * send mail to "tcpdump-workers@lists.tcpdump.org", requesting + * a new magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed file + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old file header as well as files with the new file header + * (using the magic number to determine the header format). + * + * Then supply the changes as a patch at + * + * http://sourceforge.net/projects/libpcap/ + * + * so that future versions of libpcap and programs that use it (such as + * tcpdump) will be able to read your new capture file format. + */ +struct pcap_file_header { + bpf_u_int32 magic; + u_short version_major; + u_short version_minor; + bpf_int32 thiszone; /* gmt to local correction */ + bpf_u_int32 sigfigs; /* accuracy of timestamps */ + bpf_u_int32 snaplen; /* max length saved portion of each pkt */ + bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ +}; + +/* + * Macros for the value returned by pcap_datalink_ext(). + * + * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro + * gives the FCS length of packets in the capture. + */ +#define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) +#define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) +#define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) + +typedef enum { + PCAP_D_INOUT = 0, + PCAP_D_IN, + PCAP_D_OUT +} pcap_direction_t; + +/* + * Generic per-packet information, as supplied by libpcap. + * + * The time stamp can and should be a "struct timeval", regardless of + * whether your system supports 32-bit tv_sec in "struct timeval", + * 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit + * and 64-bit applications. The on-disk format of savefiles uses 32-bit + * tv_sec (and tv_usec); this structure is irrelevant to that. 32-bit + * and 64-bit versions of libpcap, even if they're on the same platform, + * should supply the appropriate version of "struct timeval", even if + * that's not what the underlying packet capture mechanism supplies. + */ +struct pcap_pkthdr { + struct timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * As returned by the pcap_stats() + */ +struct pcap_stat { + u_int ps_recv; /* number of packets received */ + u_int ps_drop; /* number of packets dropped */ + u_int ps_ifdrop; /* drops by interface XXX not yet supported */ +#ifdef HAVE_REMOTE + u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ + u_int ps_sent; /* number of packets sent by the server on the network */ + u_int ps_netdrop; /* number of packets lost on the network */ +#endif /* HAVE_REMOTE */ +}; + +#ifdef MSDOS +/* + * As returned by the pcap_stats_ex() + */ +struct pcap_stat_ex { + u_long rx_packets; /* total packets received */ + u_long tx_packets; /* total packets transmitted */ + u_long rx_bytes; /* total bytes received */ + u_long tx_bytes; /* total bytes transmitted */ + u_long rx_errors; /* bad packets received */ + u_long tx_errors; /* packet transmit problems */ + u_long rx_dropped; /* no space in Rx buffers */ + u_long tx_dropped; /* no space available for Tx */ + u_long multicast; /* multicast packets received */ + u_long collisions; + + /* detailed rx_errors: */ + u_long rx_length_errors; + u_long rx_over_errors; /* receiver ring buff overflow */ + u_long rx_crc_errors; /* recv'd pkt with crc error */ + u_long rx_frame_errors; /* recv'd frame alignment error */ + u_long rx_fifo_errors; /* recv'r fifo overrun */ + u_long rx_missed_errors; /* recv'r missed packet */ + + /* detailed tx_errors */ + u_long tx_aborted_errors; + u_long tx_carrier_errors; + u_long tx_fifo_errors; + u_long tx_heartbeat_errors; + u_long tx_window_errors; + }; +#endif + +/* + * Item in a list of interfaces. + */ +struct pcap_if { + struct pcap_if *next; + char *name; /* name to hand to "pcap_open_live()" */ + char *description; /* textual description of interface, or NULL */ + struct pcap_addr *addresses; + bpf_u_int32 flags; /* PCAP_IF_ interface flags */ +}; + +#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ + +/* + * Representation of an interface address. + */ +struct pcap_addr { + struct pcap_addr *next; + struct sockaddr *addr; /* address */ + struct sockaddr *netmask; /* netmask for that address */ + struct sockaddr *broadaddr; /* broadcast address for that address */ + struct sockaddr *dstaddr; /* P2P destination address for that address */ +}; + +typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, + const u_char *); + +/* + * Error codes for the pcap API. + * These will all be negative, so you can check for the success or + * failure of a call that returns these codes by checking for a + * negative value. + */ +#define PCAP_ERROR -1 /* generic error code */ +#define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ +#define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */ +#define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */ +#define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */ +#define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */ +#define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ +#define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ +#define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ + +/* + * Warning codes for the pcap API. + * These will all be positive and non-zero, so they won't look like + * errors. + */ +#define PCAP_WARNING 1 /* generic warning code */ +#define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ + +char *pcap_lookupdev(char *); +int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); + +pcap_t *pcap_create(const char *, char *); +int pcap_set_snaplen(pcap_t *, int); +int pcap_set_promisc(pcap_t *, int); +int pcap_can_set_rfmon(pcap_t *); +int pcap_set_rfmon(pcap_t *, int); +int pcap_set_timeout(pcap_t *, int); +int pcap_set_buffer_size(pcap_t *, int); +int pcap_activate(pcap_t *); + +pcap_t *pcap_open_live(const char *, int, int, int, char *); +pcap_t *pcap_open_dead(int, int); +pcap_t *pcap_open_offline(const char *, char *); +#if defined(WIN32) +pcap_t *pcap_hopen_offline(intptr_t, char *); +#if !defined(LIBPCAP_EXPORTS) +#define pcap_fopen_offline(f,b) \ + pcap_hopen_offline(_get_osfhandle(_fileno(f)), b) +#else /*LIBPCAP_EXPORTS*/ +static pcap_t *pcap_fopen_offline(FILE *, char *); +#endif +#else /*WIN32*/ +pcap_t *pcap_fopen_offline(FILE *, char *); +#endif /*WIN32*/ + +void pcap_close(pcap_t *); +int pcap_loop(pcap_t *, int, pcap_handler, u_char *); +int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); +const u_char* + pcap_next(pcap_t *, struct pcap_pkthdr *); +int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); +void pcap_breakloop(pcap_t *); +int pcap_stats(pcap_t *, struct pcap_stat *); +int pcap_setfilter(pcap_t *, struct bpf_program *); +int pcap_setdirection(pcap_t *, pcap_direction_t); +int pcap_getnonblock(pcap_t *, char *); +int pcap_setnonblock(pcap_t *, int, char *); +int pcap_inject(pcap_t *, const void *, size_t); +int pcap_sendpacket(pcap_t *, const u_char *, int); +const char *pcap_statustostr(int); +const char *pcap_strerror(int); +char *pcap_geterr(pcap_t *); +void pcap_perror(pcap_t *, char *); +int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, + bpf_u_int32); +int pcap_compile_nopcap(int, int, struct bpf_program *, + const char *, int, bpf_u_int32); +void pcap_freecode(struct bpf_program *); +int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *, + const u_char *); +int pcap_datalink(pcap_t *); +int pcap_datalink_ext(pcap_t *); +int pcap_list_datalinks(pcap_t *, int **); +int pcap_set_datalink(pcap_t *, int); +void pcap_free_datalinks(int *); +int pcap_datalink_name_to_val(const char *); +const char *pcap_datalink_val_to_name(int); +const char *pcap_datalink_val_to_description(int); +int pcap_snapshot(pcap_t *); +int pcap_is_swapped(pcap_t *); +int pcap_major_version(pcap_t *); +int pcap_minor_version(pcap_t *); + +/* XXX */ +FILE *pcap_file(pcap_t *); +int pcap_fileno(pcap_t *); + +pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); +pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); +FILE *pcap_dump_file(pcap_dumper_t *); +long pcap_dump_ftell(pcap_dumper_t *); +int pcap_dump_flush(pcap_dumper_t *); +void pcap_dump_close(pcap_dumper_t *); +void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); + +int pcap_findalldevs(pcap_if_t **, char *); +void pcap_freealldevs(pcap_if_t *); + +const char *pcap_lib_version(void); + +/* XXX this guy lives in the bpf tree */ +u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); +int bpf_validate(const struct bpf_insn *f, int len); +char *bpf_image(const struct bpf_insn *, int); +void bpf_dump(const struct bpf_program *, int); + +#if defined(WIN32) + +/* + * Win32 definitions + */ + +int pcap_setbuff(pcap_t *p, int dim); +int pcap_setmode(pcap_t *p, int mode); +int pcap_setmintocopy(pcap_t *p, int size); + +#ifdef WPCAP +/* Include file with the wpcap-specific extensions */ +#include +#endif /* WPCAP */ + +#define MODE_CAPT 0 +#define MODE_STAT 1 +#define MODE_MON 2 + +#elif defined(MSDOS) + +/* + * MS-DOS definitions + */ + +int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); +void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); +u_long pcap_mac_packets (void); + +#else /* UN*X */ + +/* + * UN*X definitions + */ + +int pcap_get_selectable_fd(pcap_t *); + +#endif /* WIN32/MSDOS/UN*X */ + +#ifdef HAVE_REMOTE +/* Includes most of the public stuff that is needed for the remote capture */ +#include +#endif /* HAVE_REMOTE */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/sll.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/sll.h new file mode 100644 index 000000000..e9d5452af --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/sll.h @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/sll.h,v 1.2.2.1 2008-05-30 01:36:06 guy Exp $ (LBL) + */ + +/* + * For captures on Linux cooked sockets, we construct a fake header + * that includes: + * + * a 2-byte "packet type" which is one of: + * + * LINUX_SLL_HOST packet was sent to us + * LINUX_SLL_BROADCAST packet was broadcast + * LINUX_SLL_MULTICAST packet was multicast + * LINUX_SLL_OTHERHOST packet was sent to somebody else + * LINUX_SLL_OUTGOING packet was sent *by* us; + * + * a 2-byte Ethernet protocol field; + * + * a 2-byte link-layer type; + * + * a 2-byte link-layer address length; + * + * an 8-byte source link-layer address, whose actual length is + * specified by the previous value. + * + * All fields except for the link-layer address are in network byte order. + * + * DO NOT change the layout of this structure, or change any of the + * LINUX_SLL_ values below. If you must change the link-layer header + * for a "cooked" Linux capture, introduce a new DLT_ type (ask + * "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it + * a value that collides with a value already being used), and use the + * new header in captures of that type, so that programs that can + * handle DLT_LINUX_SLL captures will continue to handle them correctly + * without any change, and so that capture files with different headers + * can be told apart and programs that read them can dissect the + * packets in them. + */ + +#ifndef lib_pcap_sll_h +#define lib_pcap_sll_h + +/* + * A DLT_LINUX_SLL fake link-layer header. + */ +#define SLL_HDR_LEN 16 /* total header length */ +#define SLL_ADDRLEN 8 /* length of address field */ + +struct sll_header { + u_int16_t sll_pkttype; /* packet type */ + u_int16_t sll_hatype; /* link-layer address type */ + u_int16_t sll_halen; /* link-layer address length */ + u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */ + u_int16_t sll_protocol; /* protocol */ +}; + +/* + * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the + * PACKET_ values on Linux, but are defined here so that they're + * available even on systems other than Linux, and so that they + * don't change even if the PACKET_ values change. + */ +#define LINUX_SLL_HOST 0 +#define LINUX_SLL_BROADCAST 1 +#define LINUX_SLL_MULTICAST 2 +#define LINUX_SLL_OTHERHOST 3 +#define LINUX_SLL_OUTGOING 4 + +/* + * The LINUX_SLL_ values for "sll_protocol"; these correspond to the + * ETH_P_ values on Linux, but are defined here so that they're + * available even on systems other than Linux. We assume, for now, + * that the ETH_P_ values won't change in Linux; if they do, then: + * + * if we don't translate them in "pcap-linux.c", capture files + * won't necessarily be readable if captured on a system that + * defines ETH_P_ values that don't match these values; + * + * if we do translate them in "pcap-linux.c", that makes life + * unpleasant for the BPF code generator, as the values you test + * for in the kernel aren't the values that you test for when + * reading a capture file, so the fixup code run on BPF programs + * handed to the kernel ends up having to do more work. + * + * Add other values here as necessary, for handling packet types that + * might show up on non-Ethernet, non-802.x networks. (Not all the ones + * in the Linux "if_ether.h" will, I suspect, actually show up in + * captures.) + */ +#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ +#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/usb.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/usb.h new file mode 100644 index 000000000..adcd19c05 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/usb.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2006 Paolo Abeni (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Basic USB data struct + * By Paolo Abeni + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.6 2007/09/22 02:06:08 guy Exp $ + */ + +#ifndef _PCAP_USB_STRUCTS_H__ +#define _PCAP_USB_STRUCTS_H__ + +/* + * possible transfer mode + */ +#define URB_TRANSFER_IN 0x80 +#define URB_ISOCHRONOUS 0x0 +#define URB_INTERRUPT 0x1 +#define URB_CONTROL 0x2 +#define URB_BULK 0x3 + +/* + * possible event type + */ +#define URB_SUBMIT 'S' +#define URB_COMPLETE 'C' +#define URB_ERROR 'E' + +/* + * USB setup header as defined in USB specification. + * Appears at the front of each packet in DLT_USB captures. + */ +typedef struct _usb_setup { + u_int8_t bmRequestType; + u_int8_t bRequest; + u_int16_t wValue; + u_int16_t wIndex; + u_int16_t wLength; +} pcap_usb_setup; + + +/* + * Header prepended by linux kernel to each event. + * Appears at the front of each packet in DLT_USB_LINUX captures. + */ +typedef struct _usb_header { + u_int64_t id; + u_int8_t event_type; + u_int8_t transfer_type; + u_int8_t endpoint_number; + u_int8_t device_address; + u_int16_t bus_id; + char setup_flag;/*if !=0 the urb setup header is not present*/ + char data_flag; /*if !=0 no urb data is present*/ + int64_t ts_sec; + int32_t ts_usec; + int32_t status; + u_int32_t urb_len; + u_int32_t data_len; /* amount of urb data really present in this event*/ + pcap_usb_setup setup; +} pcap_usb_header; + + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/vlan.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/vlan.h new file mode 100644 index 000000000..b0cb7949b --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/pcap/vlan.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap/vlan.h,v 1.1.2.2 2008-08-06 07:45:59 guy Exp $ + */ + +#ifndef lib_pcap_vlan_h +#define lib_pcap_vlan_h + +struct vlan_tag { + u_int16_t vlan_tpid; /* ETH_P_8021Q */ + u_int16_t vlan_tci; /* VLAN TCI */ +}; + +#define VLAN_TAG_LEN 4 + +#endif diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/remote-ext.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/remote-ext.h new file mode 100644 index 000000000..580dea589 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/remote-ext.h @@ -0,0 +1,472 @@ +/* + * Copyright (c) 2002 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef __REMOTE_EXT_H__ + #define __REMOTE_EXT_H__ + + + #ifndef HAVE_REMOTE + #error Please do not include this file directly. Just define HAVE_REMOTE and then include pcap.h + #endif + +/* Definition for Microsoft Visual Studio */ + #if _MSC_VER > 1000 + #pragma once + #endif + + #ifdef __cplusplus + extern "C" { + #endif + +/*! + * \file remote-ext.h + * + * The goal of this file it to include most of the new definitions that should be + * placed into the pcap.h file. + * + * It includes all new definitions (structures and functions like pcap_open(). + * Some of the functions are not really a remote feature, but, right now, + * they are placed here. + */ + + + +/* All this stuff is public */ + +/*! \addtogroup remote_struct + \{ + */ + + + +/*! + * \brief Defines the maximum buffer size in which address, port, interface names are kept. + * + * In case the adapter name or such is larger than this value, it is truncated. + * This is not used by the user; however it must be aware that an hostname / interface + * name longer than this value will be truncated. + */ + #define PCAP_BUF_SIZE 1024 + + +/*! \addtogroup remote_source_ID + \{ + */ + + +/*! + * \brief Internal representation of the type of source in use (file, + * remote/local interface). + * + * This indicates a file, i.e. the user want to open a capture from a local file. + */ + #define PCAP_SRC_FILE 2 + +/*! + * \brief Internal representation of the type of source in use (file, + * remote/local interface). + * + * This indicates a local interface, i.e. the user want to open a capture from + * a local interface. This does not involve the RPCAP protocol. + */ + #define PCAP_SRC_IFLOCAL 3 + +/*! + * \brief Internal representation of the type of source in use (file, + * remote/local interface). + * + * This indicates a remote interface, i.e. the user want to open a capture from + * an interface on a remote host. This does involve the RPCAP protocol. + */ + #define PCAP_SRC_IFREMOTE 4 + +/*! + \} + */ + + + +/*! \addtogroup remote_source_string + * + * The formats allowed by the pcap_open() are the following: + * - file://path_and_filename [opens a local file] + * - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] + * - rpcap://host/devicename [opens the selected device available on a remote host] + * - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] + * - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged] + * - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged] + * + * The formats allowed by the pcap_findalldevs_ex() are the following: + * - file://folder/ [lists all the files in the given folder] + * - rpcap:// [lists all local adapters] + * - rpcap://host:port/ [lists the devices available on a remote host] + * + * Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since + * IPv6 is fully supported, these are the allowed formats: + * + * - host (literal): e.g. host.foo.bar + * - host (numeric IPv4): e.g. 10.11.12.13 + * - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] + * - host (numeric IPv6): e.g. [1:2:3::4] + * - port: can be either numeric (e.g. '80') or literal (e.g. 'http') + * + * Here you find some allowed examples: + * - rpcap://host.foo.bar/devicename [everything literal, no port number] + * - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] + * - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] + * - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] + * - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] + * - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] + * - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] + * - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] + * + \{ + */ + + +/*! + * \brief String that will be used to determine the type of source in use (file, + * remote/local interface). + * + * This string will be prepended to the interface name in order to create a string + * that contains all the information required to open the source. + * + * This string indicates that the user wants to open a capture from a local file. + */ + #define PCAP_SRC_FILE_STRING "file://" + +/*! + * \brief String that will be used to determine the type of source in use (file, + * remote/local interface). + * + * This string will be prepended to the interface name in order to create a string + * that contains all the information required to open the source. + * + * This string indicates that the user wants to open a capture from a network interface. + * This string does not necessarily involve the use of the RPCAP protocol. If the + * interface required resides on the local host, the RPCAP protocol is not involved + * and the local functions are used. + */ + #define PCAP_SRC_IF_STRING "rpcap://" + +/*! + \} + */ + + + +/*! + * \addtogroup remote_open_flags + \{ + */ + +/*! + * \brief Defines if the adapter has to go in promiscuous mode. + * + * It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. + * Note that even if this parameter is false, the interface could well be in promiscuous + * mode for some other reason (for example because another capture process with + * promiscuous mode enabled is currently using that interface). + * On on Linux systems with 2.2 or later kernels (that have the "any" device), this + * flag does not work on the "any" device; if an argument of "any" is supplied, + * the 'promisc' flag is ignored. + */ + #define PCAP_OPENFLAG_PROMISCUOUS 1 + +/*! + * \brief Defines if the data trasfer (in case of a remote + * capture) has to be done with UDP protocol. + * + * If it is '1' if you want a UDP data connection, '0' if you want + * a TCP data connection; control connection is always TCP-based. + * A UDP connection is much lighter, but it does not guarantee that all + * the captured packets arrive to the client workstation. Moreover, + * it could be harmful in case of network congestion. + * This flag is meaningless if the source is not a remote interface. + * In that case, it is simply ignored. + */ + #define PCAP_OPENFLAG_DATATX_UDP 2 + + +/*! + * \brief Defines if the remote probe will capture its own generated traffic. + * + * In case the remote probe uses the same interface to capture traffic and to send + * data back to the caller, the captured traffic includes the RPCAP traffic as well. + * If this flag is turned on, the RPCAP traffic is excluded from the capture, so that + * the trace returned back to the collector is does not include this traffic. + */ + #define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 + +/*! + * \brief Defines if the local adapter will capture its own generated traffic. + * + * This flag tells the underlying capture driver to drop the packets that were sent by itself. + * This is usefult when building applications like bridges, that should ignore the traffic + * they just sent. + */ + #define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8 + +/*! + * \brief This flag configures the adapter for maximum responsiveness. + * + * In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before + * copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, + * i.e. better performance, which is good for applications like sniffers. If the user sets the + * PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application + * is ready to receive them. This is suggested for real time applications (like, for example, a bridge) + * that need the best responsiveness.*/ + #define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16 + +/*! + \} + */ + + +/*! + * \addtogroup remote_samp_methods + \{ + */ + +/*! + * \brief No sampling has to be done on the current capture. + * + * In this case, no sampling algorithms are applied to the current capture. + */ + #define PCAP_SAMP_NOSAMP 0 + +/*! + * \brief It defines that only 1 out of N packets must be returned to the user. + * + * In this case, the 'value' field of the 'pcap_samp' structure indicates the + * number of packets (minus 1) that must be discarded before one packet got accepted. + * In other words, if 'value = 10', the first packet is returned to the caller, while + * the following 9 are discarded. + */ + #define PCAP_SAMP_1_EVERY_N 1 + +/*! + * \brief It defines that we have to return 1 packet every N milliseconds. + * + * In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting + * time' in milliseconds before one packet got accepted. + * In other words, if 'value = 10', the first packet is returned to the caller; the next + * returned one will be the first packet that arrives when 10ms have elapsed. + */ + #define PCAP_SAMP_FIRST_AFTER_N_MS 2 + +/*! + \} + */ + + +/*! + * \addtogroup remote_auth_methods + \{ + */ + +/*! + * \brief It defines the NULL authentication. + * + * This value has to be used within the 'type' member of the pcap_rmtauth structure. + * The 'NULL' authentication has to be equal to 'zero', so that old applications + * can just put every field of struct pcap_rmtauth to zero, and it does work. + */ + #define RPCAP_RMTAUTH_NULL 0 + +/*! + * \brief It defines the username/password authentication. + * + * With this type of authentication, the RPCAP protocol will use the username/ + * password provided to authenticate the user on the remote machine. If the + * authentication is successful (and the user has the right to open network devices) + * the RPCAP connection will continue; otherwise it will be dropped. + * + * This value has to be used within the 'type' member of the pcap_rmtauth structure. + */ + #define RPCAP_RMTAUTH_PWD 1 + +/*! + \} + */ + + + +/*! + * + * \brief This structure keeps the information needed to autheticate + * the user on a remote machine. + * + * The remote machine can either grant or refuse the access according + * to the information provided. + * In case the NULL authentication is required, both 'username' and + * 'password' can be NULL pointers. + * + * This structure is meaningless if the source is not a remote interface; + * in that case, the functions which requires such a structure can accept + * a NULL pointer as well. + */ + struct pcap_rmtauth + { + /*! + * \brief Type of the authentication required. + * + * In order to provide maximum flexibility, we can support different types + * of authentication based on the value of this 'type' variable. The currently + * supported authentication methods are defined into the + * \link remote_auth_methods Remote Authentication Methods Section\endlink. + * + */ + int type; + + /*! + * \brief Zero-terminated string containing the username that has to be + * used on the remote machine for authentication. + * + * This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + * and it can be NULL. + */ + char * username; + + /*! + * \brief Zero-terminated string containing the password that has to be + * used on the remote machine for authentication. + * + * This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + * and it can be NULL. + */ + char * password; + }; + + +/*! + * \brief This structure defines the information related to sampling. + * + * In case the sampling is requested, the capturing device should read + * only a subset of the packets coming from the source. The returned packets depend + * on the sampling parameters. + * + * \warning The sampling process is applied after the filtering process. + * In other words, packets are filtered first, then the sampling process selects a + * subset of the 'filtered' packets and it returns them to the caller. + */ + struct pcap_samp + { + /*! + * Method used for sampling. Currently, the supported methods are listed in the + * \link remote_samp_methods Sampling Methods Section\endlink. + */ + int method; + + /*! + * This value depends on the sampling method defined. For its meaning, please check + * at the \link remote_samp_methods Sampling Methods Section\endlink. + */ + int value; + }; + + + +/*! Maximum lenght of an host name (needed for the RPCAP active mode) */ + #define RPCAP_HOSTLIST_SIZE 1024 + + +/*! + \} + *//* end of public documentation */ + + +/* Exported functions */ + + + +/** \name New WinPcap functions + * + * This section lists the new functions that are able to help considerably in writing + * WinPcap programs because of their easiness of use. + */ +/*\{ */ + pcap_t * pcap_open( const char * source, + int snaplen, + int flags, + int read_timeout, + struct pcap_rmtauth * auth, + char * errbuf ); + int pcap_createsrcstr( char * source, + int type, + const char * host, + const char * port, + const char * name, + char * errbuf ); + int pcap_parsesrcstr( const char * source, + int * type, + char * host, + char * port, + char * name, + char * errbuf ); + int pcap_findalldevs_ex( char * source, + struct pcap_rmtauth * auth, + pcap_if_t ** alldevs, + char * errbuf ); + struct pcap_samp * pcap_setsampling( pcap_t * p ); + +/*\} */ +/* End of new winpcap functions */ + + + +/** \name Remote Capture functions + */ +/*\{ */ + SOCKET pcap_remoteact_accept( const char * address, + const char * port, + const char * hostlist, + char * connectinghost, + struct pcap_rmtauth * auth, + char * errbuf ); + int pcap_remoteact_list( char * hostlist, + char sep, + int size, + char * errbuf ); + int pcap_remoteact_close( const char * host, + char * errbuf ); + void pcap_remoteact_cleanup(); +/*\} */ +/* End of remote capture functions */ + + #ifdef __cplusplus + } + #endif + + +#endif /* ifndef __REMOTE_EXT_H__ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/wpcap.lib b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/wpcap.lib new file mode 100644 index 000000000..f832e0445 Binary files /dev/null and b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/WinPCap/wpcap.lib differ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_config.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_config.h new file mode 100644 index 000000000..29f3c22e9 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_config.h @@ -0,0 +1,68 @@ +/* + * FreeRTOS + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file cellular_config.h + * @brief cellular config options. + */ + +#ifndef __CELLULAR_CONFIG_H__ +#define __CELLULAR_CONFIG_H__ + +/* This is a project specific file and is used to override config values defined + * in cellular_config_defaults.h. */ + +/** + * Cellular comm interface make use of COM port on computer to communicate with + * cellular module on windows simulator, for example "COM5". + * #define CELLULAR_COMM_INTERFACE_PORT "...insert here..." + */ + +/* + * Default APN for network registration. + * #define CELLULAR_APN "...insert here..." + */ + +/* + * PDN context id for cellular network. + */ +#define CELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID_MIN ) + +/* + * PDN connect timeout for network registration. + */ +#define CELLULAR_PDN_CONNECT_TIMEOUT ( 100000UL ) + +/* + * Overwrite default config for different cellular modules. + */ + +/* + * GetHostByName API is not used in the demo. IP address is used to store the hostname. + * The value should be longer than the length of democonfigMQTT_BROKER_ENDPOINT in demo_config.h. + */ +#define CELLULAR_IP_ADDRESS_MAX_SIZE ( 64U ) + +#endif /* __CELLULAR_CONFIG_H__ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.c new file mode 100644 index 000000000..2f46cbe5d --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.c @@ -0,0 +1,233 @@ +/* + * Amazon FreeRTOS CELLULAR Preview Release + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +#include + +#include "cellular_platform.h" + +/*-----------------------------------------------------------*/ + +typedef QueueHandle_t SemaphoreHandle_t; + +typedef struct threadInfo +{ + void * pArgument; /**< @brief Argument to `threadRoutine`. */ + void ( * threadRoutine )( void * ); /**< @brief Thread function to run. */ +} threadInfo_t; + +/*-----------------------------------------------------------*/ + +/** + * @brief Sends provided buffer to network using transport send. + * + * @param[in] pArgument Argument passed to threadRoutine function. + * + */ +static void prvThreadRoutineWrapper( void * pArgument ); + +/** + * @brief Lock mutex with timeout. + * + * @param[in] pMutex Mutex to lock. + * @param[in] timeout Timeout value to lock mutex. + * + * @return true if mutex is locked successfully. Otherwise false. + */ +static bool prIotMutexTimedLock( PlatformMutex_t * pMutex, + TickType_t timeout ); + +/*-----------------------------------------------------------*/ + +static void prvThreadRoutineWrapper( void * pArgument ) +{ + threadInfo_t * pThreadInfo = ( threadInfo_t * ) pArgument; + + /* Run the thread routine. */ + pThreadInfo->threadRoutine( pThreadInfo->pArgument ); + Platform_Free( pThreadInfo ); + + vTaskDelete( NULL ); +} + +/*-----------------------------------------------------------*/ + +static bool prIotMutexTimedLock( PlatformMutex_t * pMutex, + TickType_t timeout ) +{ + BaseType_t lockResult = pdTRUE; + + configASSERT( pMutex != NULL ); + + LogDebug( ( "Locking mutex %p.", pMutex ) ); + + /* Call the correct FreeRTOS mutex take function based on mutex type. */ + if( pMutex->recursive == pdTRUE ) + { + lockResult = xSemaphoreTakeRecursive( ( SemaphoreHandle_t ) &pMutex->xMutex, timeout ); + } + else + { + lockResult = xSemaphoreTake( ( SemaphoreHandle_t ) &pMutex->xMutex, timeout ); + } + + return( lockResult == pdTRUE ); +} + +/*-----------------------------------------------------------*/ + +bool Platform_CreateDetachedThread( void ( * threadRoutine )( void * ), + void * pArgument, + int32_t priority, + size_t stackSize ) +{ + bool status = true; + threadInfo_t * pThreadInfo = NULL; + + configASSERT( threadRoutine != NULL ); + + LogDebug( ( "Creating new thread." ) ); + + pThreadInfo = Platform_Malloc( sizeof( threadInfo_t ) ); + + if( pThreadInfo == NULL ) + { + LogDebug( ( "Unable to allocate memory for threadRoutine %p.", threadRoutine ) ); + status = false; + } + + /* Create the FreeRTOS task that will run the thread. */ + if( status == true ) + { + pThreadInfo->threadRoutine = threadRoutine; + pThreadInfo->pArgument = pArgument; + + if( xTaskCreate( prvThreadRoutineWrapper, + "Cellular_Thread", + ( configSTACK_DEPTH_TYPE ) stackSize, + pThreadInfo, + priority, + NULL ) != pdPASS ) + { + /* Task creation failed. */ + LogWarn( ( "Failed to create thread." ) ); + Platform_Free( pThreadInfo ); + status = false; + } + else + { + LogDebug( ( "New thread created." ) ); + } + } + + return status; +} + +/*-----------------------------------------------------------*/ + +bool PlatformMutex_Create( PlatformMutex_t * pNewMutex, + bool recursive ) +{ + SemaphoreHandle_t xSemaphore = NULL; + bool retMutexCreate = false; + + configASSERT( pNewMutex != NULL ); + + LogDebug( ( "Creating new mutex %p.", pNewMutex ) ); + + if( recursive == true ) + { + xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &pNewMutex->xMutex ); + } + else + { + xSemaphore = xSemaphoreCreateMutexStatic( &pNewMutex->xMutex ); + } + + /* Remember the type of mutex. */ + if( recursive == true ) + { + pNewMutex->recursive = pdTRUE; + } + else + { + pNewMutex->recursive = pdFALSE; + } + + /* Check the handle value returned by the mutex create function. */ + if( xSemaphore == NULL ) + { + retMutexCreate = false; + } + else + { + retMutexCreate = true; + } + + return retMutexCreate; +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Destroy( PlatformMutex_t * pMutex ) +{ + configASSERT( pMutex != NULL ); + + vSemaphoreDelete( ( SemaphoreHandle_t ) &pMutex->xMutex ); +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Lock( PlatformMutex_t * pMutex ) +{ + prIotMutexTimedLock( pMutex, portMAX_DELAY ); +} + +/*-----------------------------------------------------------*/ + +bool PlatformMutex_TryLock( PlatformMutex_t * pMutex ) +{ + return prIotMutexTimedLock( pMutex, 0 ); +} + +/*-----------------------------------------------------------*/ + +void PlatformMutex_Unlock( PlatformMutex_t * pMutex ) +{ + configASSERT( pMutex != NULL ); + + LogDebug( ( "Unlocking mutex %p.", pMutex ) ); + + /* Call the correct FreeRTOS mutex unlock function based on mutex type. */ + if( pMutex->recursive == pdTRUE ) + { + ( void ) xSemaphoreGiveRecursive( ( SemaphoreHandle_t ) &pMutex->xMutex ); + } + else + { + ( void ) xSemaphoreGive( ( SemaphoreHandle_t ) &pMutex->xMutex ); + } +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.h new file mode 100644 index 000000000..4d4a0ea62 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/cellular_platform.h @@ -0,0 +1,160 @@ +/* + * FreeRTOS + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +#ifndef __CELLULAR_PLATFORM_H__ +#define __CELLULAR_PLATFORM_H__ + +#include "FreeRTOS.h" +#include "queue.h" +#include "semphr.h" +#include "event_groups.h" + +#include +#include + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library log configuration. + * + * Cellular library use CellularLogLevel macro for logging. + * The prototye of these logging function is similar with printf with return type ignored. + * + */ + +#include "logging_levels.h" +#ifndef LIBRARY_LOG_NAME + #define LIBRARY_LOG_NAME "CELLULAR" +#endif +#ifndef LIBRARY_LOG_LEVEL + #define LIBRARY_LOG_LEVEL LOG_ERROR +#endif + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#ifndef SdkLog + #define SdkLog( message ) printf message +#endif +#include "logging_stack.h" + + + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform thread API and configuration. + * + * Cellular library create a detached thread by this API. + * The threadRoutine should be called with pArgument in the created thread. + * + * PLATFORM_THREAD_DEFAULT_STACK_SIZE and PLATFORM_THREAD_DEFAULT_PRIORITY defines + * the platform related stack size and priority. + */ + +bool Platform_CreateDetachedThread( void ( * threadRoutine )( void * ), + void * pArgument, + int32_t priority, + size_t stackSize ); + +#define PLATFORM_THREAD_DEFAULT_STACK_SIZE ( 2048U ) +#define PLATFORM_THREAD_DEFAULT_PRIORITY ( tskIDLE_PRIORITY + 5U ) + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform mutex APIs. + * + * Cellular library use platform mutex to protect resource. + * + * The IotMutex_ functions can be referenced as function prototype for + * PlatfromMutex_ prefix function in the following link. + * https://docs.aws.amazon.com/freertos/latest/lib-ref/c-sdk/platform/platform_threads_functions.html + * + */ + +typedef struct PlatformMutex +{ + StaticSemaphore_t xMutex; /**< FreeRTOS mutex. */ + BaseType_t recursive; /**< Type; used for indicating if this is reentrant or normal. */ +} PlatformMutex_t; + +bool PlatformMutex_Create( PlatformMutex_t * pNewMutex, + bool recursive ); +void PlatformMutex_Destroy( PlatformMutex_t * pMutex ); +void PlatformMutex_Lock( PlatformMutex_t * pMutex ); +bool PlatformMutex_TryLock( PlatformMutex_t * pMutex ); +void PlatformMutex_Unlock( PlatformMutex_t * pMutex ); + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform memory allocation APIs. + * + * Cellular library use platform memory allocation APIs to allocate memory dynamically. + * The FreeRTOS memory management document can be referenced for these APIs. + * https://www.freertos.org/a00111.html + * + */ + +#define Platform_Malloc pvPortMalloc +#define Platform_Free vPortFree + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform event group APIs. + * + * Cellular library use platform event group for process synchronization. + * + * The EventGroup functions in the following link can be referenced as function prototype. + * https://www.freertos.org/event-groups-API.html + * + */ + +#define PlatformEventGroupHandle_t EventGroupHandle_t +#define PlatformEventGroup_Delete vEventGroupDelete +#define PlatformEventGroup_ClearBits xEventGroupClearBits +#define PlatformEventGroup_Create xEventGroupCreate +#define PlatformEventGroup_GetBits xEventGroupGetBits +#define PlatformEventGroup_SetBits xEventGroupSetBits +#define PlatformEventGroup_SetBitsFromISR xEventGroupSetBitsFromISR +#define PlatformEventGroup_WaitBits xEventGroupWaitBits +#define PlatformEventGroup_EventBits EventBits_t +#define PlatformTickType TickType_t + +/*-----------------------------------------------------------*/ + +/** + * @brief Cellular library platform delay function. + * + * Cellular library use platform delay function for waiting events. + * + * The delay functions in the following link can be referenced as function prototype. + * https://www.freertos.org/a00127.html + * + */ +#define Platform_Delay( delayMs ) vTaskDelay( pdMS_TO_TICKS( delayMs ) ) + +#endif /* __CELLULAR_PLATFORM_H__ */ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/comm_if_windows.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/comm_if_windows.c new file mode 100644 index 000000000..2c77c2b73 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/comm_if_windows.c @@ -0,0 +1,1028 @@ +/* + * Amazon FreeRTOS Cellular Preview Release + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + + +/** + * @file comm_if_windows.c + * @brief Windows Simulator file for cellular comm interface + */ + +/*-----------------------------------------------------------*/ + +/* Windows include file for COM port I/O. */ +#include + +/* Platform layer includes. */ +#include "cellular_platform.h" + +/* Cellular comm interface include file. */ +#include "cellular_config.h" +#include "cellular_config_defaults.h" +#include "cellular_comm_interface.h" + +/*-----------------------------------------------------------*/ + +/* Define the COM port used as comm interface. */ +#ifndef CELLULAR_COMM_INTERFACE_PORT + #error "Define CELLULAR_COMM_INTERFACE_PORT in cellular_config.h" +#endif +#define CELLULAR_COMM_PATH "\\\\.\\"CELLULAR_COMM_INTERFACE_PORT + +/* Define the simulated UART interrupt number. */ +#define portINTERRUPT_UART ( 2UL ) + +/* Define the read write buffer size. */ +#define COMM_TX_BUFFER_SIZE ( 8192 ) +#define COMM_RX_BUFFER_SIZE ( 8192 ) + +/* Receive thread timeout in ms. */ +#define COMM_RECV_THREAD_TIMEOUT ( 5000 ) + +/* Write operation timeout in ms. */ +#define COMM_WRITE_OPERATION_TIMEOUT ( 500 ) + +/* Comm status. */ +#define CELLULAR_COMM_OPEN_BIT ( 0x01U ) + +/* Comm task event. */ +#define COMMTASK_EVT_MASK_STARTED ( 0x0001UL ) +#define COMMTASK_EVT_MASK_ABORT ( 0x0002UL ) +#define COMMTASK_EVT_MASK_ABORTED ( 0x0004UL ) +#define COMMTASK_EVT_MASK_ALL_EVENTS \ + ( COMMTASK_EVT_MASK_STARTED \ + | COMMTASK_EVT_MASK_ABORT \ + | COMMTASK_EVT_MASK_ABORTED ) +#define COMMTASK_POLLING_TIME_MS ( 1UL ) + +/* Comm port event. */ +#define COMMPORT_EVT_RXCHAR ( 0x0001UL ) +#define COMMPORT_EVT_TXEMPTY ( 0x0002UL ) + +/* COMM_IF_REOPEN_DELAY. */ +#define COMM_IF_REOPEN_DELAY ( 100U ) + +/* Platform thread stack size and priority. */ +#define COMM_IF_THREAD_DEFAULT_STACK_SIZE ( 2048U ) +#define COMM_IF_THREAD_DEFAULT_PRIORITY ( tskIDLE_PRIORITY + 5U ) + +/*-----------------------------------------------------------*/ + +typedef struct _cellularCommContext +{ + CellularCommInterfaceReceiveCallback_t commReceiveCallback; + HANDLE commReceiveCallbackThread; + uint8_t commStatus; + void * pUserData; + HANDLE commFileHandle; + CellularCommInterface_t * pCommInterface; + bool commTaskThreadStarted; + EventGroupHandle_t pCommTaskEvent; /* For receive callback function. */ + EventGroupHandle_t pCommPortEvent; /* Notify RX TX events. */ +} _cellularCommContext_t; + +/*-----------------------------------------------------------*/ + +/** + * @brief CellularCommInterfaceOpen_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfOpen( CellularCommInterfaceReceiveCallback_t receiveCallback, + void * pUserData, + CellularCommInterfaceHandle_t * pCommInterfaceHandle ); + +/** + * @brief CellularCommInterfaceSend_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfSend( CellularCommInterfaceHandle_t commInterfaceHandle, + const uint8_t * pData, + uint32_t dataLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataSentLength ); + +/** + * @brief CellularCommInterfaceRecv_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfReceive( CellularCommInterfaceHandle_t commInterfaceHandle, + uint8_t * pBuffer, + uint32_t bufferLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataReceivedLength ); + +/** + * @brief CellularCommInterfaceClose_t implementation. + */ +static CellularCommInterfaceError_t _prvCommIntfClose( CellularCommInterfaceHandle_t commInterfaceHandle ); + +/** + * @brief Get default comm interface context. + * + * @return On success, SOCKETS_ERROR_NONE is returned. If an error occurred, error code defined + * in sockets_wrapper.h is returned. + */ +static _cellularCommContext_t * _getCellularCommContext( void ); + +/** + * @brief UART interrupt handler. + * + * @return pdTRUE if the operation is successful, otherwise + * an error code indicating the cause of the error. + */ +static uint32_t prvProcessUartInt( void ); + +/** + * @brief Set COM port timeout settings. + * + * @param[in] hComm COM handle returned by CreateFile. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t _setupCommTimeout( HANDLE hComm ); + +/** + * @brief Set COM port control settings. + * + * @param[in] hComm COM handle returned by CreateFile. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t _setupCommSettings( HANDLE hComm ); + +/** + * @brief Thread routine to generate simulated interrupt. + * + * @param[in] pUserData Pointer to _cellularCommContext_t allocated in comm interface open. + */ +static void commTaskThread( void * pUserData ); + +/** + * @brief Helper function to setup and create commTaskThread. + * + * @param[in] pCellularCommContext Cellular comm interface context allocated in open. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t setupCommTaskThread( _cellularCommContext_t * pCellularCommContext ); + +/** + * @brief Helper function to clean commTaskThread. + * + * @param[in] pCellularCommContext Cellular comm interface context allocated in open. + * + * @return On success, IOT_COMM_INTERFACE_SUCCESS is returned. If an error occurred, error code defined + * in CellularCommInterfaceError_t is returned. + */ +static CellularCommInterfaceError_t cleanCommTaskThread( _cellularCommContext_t * pCellularCommContext ); + +/*-----------------------------------------------------------*/ + +CellularCommInterface_t CellularCommInterface = +{ + .open = _prvCommIntfOpen, + .send = _prvCommIntfSend, + .recv = _prvCommIntfReceive, + .close = _prvCommIntfClose +}; + +static _cellularCommContext_t _iotCellularCommContext = +{ + .commReceiveCallback = NULL, + .commReceiveCallbackThread = NULL, + .pCommInterface = &CellularCommInterface, + .commFileHandle = NULL, + .pUserData = NULL, + .commStatus = 0U, + .commTaskThreadStarted = false, + .pCommTaskEvent = NULL, + .pCommPortEvent = NULL +}; + +/* Indicate RX event is received in comm driver. */ +static bool rxEvent = false; + +static bool txEmptyEvent = false; + +/*-----------------------------------------------------------*/ + +static _cellularCommContext_t * _getCellularCommContext( void ) +{ + return &_iotCellularCommContext; +} + +/*-----------------------------------------------------------*/ + +static uint32_t prvProcessUartInt( void ) +{ + _cellularCommContext_t * pCellularCommContext = _getCellularCommContext(); + CellularCommInterfaceError_t callbackRet = IOT_COMM_INTERFACE_FAILURE; + uint32_t retUartInt = pdTRUE; + + if( pCellularCommContext->commReceiveCallback != NULL ) + { + callbackRet = pCellularCommContext->commReceiveCallback( pCellularCommContext->pUserData, + ( CellularCommInterfaceHandle_t ) pCellularCommContext ); + } + + if( callbackRet == IOT_COMM_INTERFACE_SUCCESS ) + { + retUartInt = pdTRUE; + } + else + { + retUartInt = pdFALSE; + } + + return retUartInt; +} + +/*-----------------------------------------------------------*/ + +/** + * @brief Communication receiver thread function. + * + * @param[in] pArgument windows COM port handle. + * @return 0 if thread function exit without error. Others for error. + */ +DWORD WINAPI _CellularCommReceiveCBThreadFunc( LPVOID pArgument ) +{ + DWORD dwCommStatus = 0; + HANDLE hComm = ( HANDLE ) pArgument; + BOOL retWait = FALSE; + DWORD retValue = 0; + _cellularCommContext_t * pCellularCommContext = _getCellularCommContext(); + + if( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) + { + retValue = ERROR_INVALID_HANDLE; + } + + while( retValue == 0 ) + { + retWait = WaitCommEvent( hComm, &dwCommStatus, NULL ); + + if( ( retWait != FALSE ) && ( ( dwCommStatus & ( EV_RXCHAR | EV_TXEMPTY ) ) != 0 ) ) + { + if( ( dwCommStatus & EV_RXCHAR ) != 0 ) + { + /* The RXECHAR event. */ + rxEvent = true; + } + + if( ( dwCommStatus & EV_TXEMPTY ) != 0 ) + { + /* The TXEMPTY event. */ + txEmptyEvent = true; + } + } + else + { + if( ( GetLastError() == ERROR_INVALID_HANDLE ) || ( GetLastError() == ERROR_OPERATION_ABORTED ) ) + { + /* COM port closed. */ + LogInfo( ( "Cellular COM port %p closed", hComm ) ); + } + else + { + LogInfo( ( "Cellular receiver thread wait comm error %p %d", hComm, GetLastError() ) ); + } + + retValue = GetLastError(); + + break; + } + } + + return retValue; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _setupCommTimeout( HANDLE hComm ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + COMMTIMEOUTS xCommTimeouts = { 0 }; + BOOL Status = TRUE; + + /* Set ReadIntervalTimeout to MAXDWORD and zero values for both + * ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier to return + * immediately with the bytes that already been received. */ + xCommTimeouts.ReadIntervalTimeout = MAXDWORD; + xCommTimeouts.ReadTotalTimeoutConstant = 0; + xCommTimeouts.ReadTotalTimeoutMultiplier = 0; + xCommTimeouts.WriteTotalTimeoutConstant = COMM_WRITE_OPERATION_TIMEOUT; + xCommTimeouts.WriteTotalTimeoutMultiplier = 0; + Status = SetCommTimeouts( hComm, &xCommTimeouts ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommTimeouts fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _setupCommSettings( HANDLE hComm ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + DCB dcbSerialParams = { 0 }; + BOOL Status = TRUE; + + ( void ) memset( &dcbSerialParams, 0, sizeof( dcbSerialParams ) ); + dcbSerialParams.DCBlength = sizeof( dcbSerialParams ); + dcbSerialParams.BaudRate = CBR_115200; + dcbSerialParams.fBinary = 1; + dcbSerialParams.ByteSize = 8; + dcbSerialParams.StopBits = ONESTOPBIT; + dcbSerialParams.Parity = NOPARITY; + + dcbSerialParams.fOutxCtsFlow = FALSE; + dcbSerialParams.fOutxDsrFlow = FALSE; + dcbSerialParams.fDtrControl = DTR_CONTROL_ENABLE; + dcbSerialParams.fRtsControl = RTS_CONTROL_ENABLE; + + Status = SetCommState( hComm, &dcbSerialParams ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommState fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static void commTaskThread( void * pUserData ) +{ + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) pUserData; + EventBits_t uxBits = 0; + + /* Inform thread ready. */ + LogInfo( ( "Cellular commTaskThread started" ) ); + + if( pCellularCommContext != NULL ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, + COMMTASK_EVT_MASK_STARTED ); + } + + while( true ) + { + /* Wait for notification from eventqueue. */ + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ), + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( COMMTASK_POLLING_TIME_MS ) ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ) != 0U ) + { + LogDebug( ( "Abort received, cleaning up!" ) ); + break; + } + else + { + /* Polling the global share variable to trigger the interrupt. */ + if( rxEvent == true ) + { + rxEvent = false; + vPortGenerateSimulatedInterrupt( portINTERRUPT_UART ); + ( void ) xEventGroupSetBits( pCellularCommContext->pCommPortEvent, + COMMPORT_EVT_RXCHAR ); + } + + if( txEmptyEvent == true ) + { + txEmptyEvent = false; + ( void ) xEventGroupSetBits( pCellularCommContext->pCommPortEvent, + COMMPORT_EVT_TXEMPTY ); + } + } + } + + /* Inform thread ready. */ + if( pCellularCommContext != NULL ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, COMMTASK_EVT_MASK_ABORTED ); + } + + LogInfo( ( "Cellular commTaskThread exit" ) ); +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t setupCommTaskThread( _cellularCommContext_t * pCellularCommContext ) +{ + BOOL Status = TRUE; + EventBits_t uxBits = 0; + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + + pCellularCommContext->pCommTaskEvent = xEventGroupCreate(); + + if( pCellularCommContext->pCommTaskEvent != NULL ) + { + /* Create the FreeRTOS thread to generate the simulated interrupt. */ + Status = Platform_CreateDetachedThread( commTaskThread, + ( void * ) pCellularCommContext, + COMM_IF_THREAD_DEFAULT_PRIORITY, + COMM_IF_THREAD_DEFAULT_STACK_SIZE ); + + if( Status != true ) + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_STARTED | ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ), + pdTRUE, + pdFALSE, + portMAX_DELAY ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_STARTED ) == COMMTASK_EVT_MASK_STARTED ) + { + pCellularCommContext->commTaskThreadStarted = true; + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + pCellularCommContext->commTaskThreadStarted = false; + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t cleanCommTaskThread( _cellularCommContext_t * pCellularCommContext ) +{ + EventBits_t uxBits = 0; + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + + /* Wait for the commTaskThreadStarted exit. */ + if( ( pCellularCommContext->commTaskThreadStarted == true ) && ( pCellularCommContext->pCommTaskEvent != NULL ) ) + { + ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, + COMMTASK_EVT_MASK_ABORT ); + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ), + ( ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ), + pdTRUE, + pdFALSE, + portMAX_DELAY ); + + if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_ABORTED ) != COMMTASK_EVT_MASK_ABORTED ) + { + LogDebug( ( "Cellular close wait commTaskThread fail" ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + pCellularCommContext->commTaskThreadStarted = false; + } + + /* Clean the event group. */ + if( pCellularCommContext->pCommTaskEvent != NULL ) + { + vEventGroupDelete( pCellularCommContext->pCommTaskEvent ); + pCellularCommContext->pCommTaskEvent = NULL; + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfOpen( CellularCommInterfaceReceiveCallback_t receiveCallback, + void * pUserData, + CellularCommInterfaceHandle_t * pCommInterfaceHandle ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + HANDLE hComm = ( HANDLE ) INVALID_HANDLE_VALUE; + BOOL Status = TRUE; + _cellularCommContext_t * pCellularCommContext = _getCellularCommContext(); + DWORD dwRes = 0; + + if( pCommInterfaceHandle == NULL ) + { + LogError( ( "Cellular comm pCommInterfaceHandle invalid" ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) != 0 ) + { + LogError( ( "Cellular comm interface opened already" ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + /* Clear the context. */ + memset( pCellularCommContext, 0, sizeof( _cellularCommContext_t ) ); + pCellularCommContext->pCommInterface = &CellularCommInterface; + + /* If CreateFile fails, the return value is INVALID_HANDLE_VALUE. */ + hComm = CreateFile( TEXT( CELLULAR_COMM_PATH ), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL ); + } + + /* Comm port is just closed. Wait 1 second and retry. */ + if( ( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) && ( GetLastError() == 5 ) ) + { + vTaskDelay( pdMS_TO_TICKS( COMM_IF_REOPEN_DELAY ) ); + hComm = CreateFile( TEXT( CELLULAR_COMM_PATH ), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_WRITE_THROUGH, + NULL ); + } + + if( hComm == ( HANDLE ) INVALID_HANDLE_VALUE ) + { + LogError( ( "Cellular open COM port fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + Status = SetupComm( hComm, COMM_TX_BUFFER_SIZE, COMM_RX_BUFFER_SIZE ); + + if( Status == FALSE ) + { + LogError( ( "Cellular setup COM port fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + commIntRet = _setupCommTimeout( hComm ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + commIntRet = _setupCommSettings( hComm ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = SetCommMask( hComm, EV_RXCHAR | EV_TXEMPTY ); + + if( Status == FALSE ) + { + LogError( ( "Cellular SetCommMask fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + pCellularCommContext->pCommPortEvent = xEventGroupCreate(); + + if( pCellularCommContext->pCommPortEvent == NULL ) + { + LogError( ( "Cellular SetCommMask fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + pCellularCommContext->commReceiveCallback = receiveCallback; + commIntRet = setupCommTaskThread( pCellularCommContext ); + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + vPortSetInterruptHandler( portINTERRUPT_UART, prvProcessUartInt ); + pCellularCommContext->commReceiveCallbackThread = + CreateThread( NULL, 0, _CellularCommReceiveCBThreadFunc, hComm, 0, NULL ); + + /* CreateThread return NULL for error. */ + if( pCellularCommContext->commReceiveCallbackThread == NULL ) + { + LogError( ( "Cellular CreateThread fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + pCellularCommContext->pUserData = pUserData; + pCellularCommContext->commFileHandle = hComm; + *pCommInterfaceHandle = ( CellularCommInterfaceHandle_t ) pCellularCommContext; + pCellularCommContext->commStatus |= CELLULAR_COMM_OPEN_BIT; + } + else + { + /* Comm interface open fail. Clean the data. */ + if( hComm != ( HANDLE ) INVALID_HANDLE_VALUE ) + { + ( void ) CloseHandle( hComm ); + hComm = INVALID_HANDLE_VALUE; + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + /* Wait for the commReceiveCallbackThread exit. */ + if( pCellularCommContext->commReceiveCallbackThread != NULL ) + { + dwRes = WaitForSingleObject( pCellularCommContext->commReceiveCallbackThread, COMM_RECV_THREAD_TIMEOUT ); + + if( dwRes != WAIT_OBJECT_0 ) + { + LogDebug( ( "Cellular close wait receiveCallbackThread %p fail %d", + pCellularCommContext->commReceiveCallbackThread, dwRes ) ); + } + } + + pCellularCommContext->commReceiveCallbackThread = NULL; + + /* Clean the com port event group. */ + if( pCellularCommContext->pCommPortEvent != NULL ) + { + vEventGroupDelete( pCellularCommContext->pCommPortEvent ); + pCellularCommContext->pCommPortEvent = NULL; + } + + /* Wait for the commTaskThreadStarted exit. */ + ( void ) cleanCommTaskThread( pCellularCommContext ); + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfClose( CellularCommInterfaceHandle_t commInterfaceHandle ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + BOOL Status = TRUE; + DWORD dwRes = 0; + + if( pCellularCommContext == NULL ) + { + LogError( ( "Cellular close context is NULL" ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular close comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + /* clean the receive callback. */ + pCellularCommContext->commReceiveCallback = NULL; + + /* Close the COM port. */ + hComm = pCellularCommContext->commFileHandle; + + if( hComm != ( HANDLE ) INVALID_HANDLE_VALUE ) + { + Status = CloseHandle( hComm ); + + if( Status == FALSE ) + { + LogError( ( "Cellular close CloseHandle %p fail", hComm ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + else + { + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + pCellularCommContext->commFileHandle = NULL; + + /* Wait for the thread exit. */ + if( pCellularCommContext->commReceiveCallbackThread != NULL ) + { + dwRes = WaitForSingleObject( pCellularCommContext->commReceiveCallbackThread, COMM_RECV_THREAD_TIMEOUT ); + + if( dwRes != WAIT_OBJECT_0 ) + { + LogError( ( "Cellular close wait receiveCallbackThread %p fail %d", + pCellularCommContext->commReceiveCallbackThread, dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + CloseHandle( pCellularCommContext->commReceiveCallbackThread ); + } + } + + pCellularCommContext->commReceiveCallbackThread = NULL; + + /* Clean the com port event group. */ + if( pCellularCommContext->pCommPortEvent != NULL ) + { + vEventGroupDelete( pCellularCommContext->pCommPortEvent ); + pCellularCommContext->pCommPortEvent = NULL; + } + + /* Clean the commTaskThread. */ + ( void ) cleanCommTaskThread( pCellularCommContext ); + + /* clean the data structure. */ + pCellularCommContext->commStatus &= ~( CELLULAR_COMM_OPEN_BIT ); + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfSend( CellularCommInterfaceHandle_t commInterfaceHandle, + const uint8_t * pData, + uint32_t dataLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataSentLength ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + OVERLAPPED osWrite = { 0 }; + DWORD dwRes = 0; + DWORD dwWritten = 0; + BOOL Status = TRUE; + EventBits_t uxBits = 0; + + if( pCellularCommContext == NULL ) + { + LogError( ( "Cellular send comm interface handle invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pData == NULL ) || ( dataLength == 0 ) ) + { + LogError( ( "Cellular send pData or dataLength invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( pDataSentLength == NULL ) + { + LogError( ( "Cellular send pDataSentLength invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular send comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + hComm = pCellularCommContext->commFileHandle; + osWrite.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); + + if( osWrite.hEvent == NULL ) + { + LogError( ( "Cellular CreateEvent fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = WriteFile( hComm, pData, dataLength, &dwWritten, &osWrite ); + + if( Status == TRUE ) + { + /* Waiting for TX empty. */ + *pDataSentLength = ( uint32_t ) dwWritten; + + /* Wait for notification from eventqueue. */ + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommPortEvent ), + ( ( EventBits_t ) COMMPORT_EVT_TXEMPTY ), + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( timeoutMilliseconds ) ); + + if( ( uxBits & COMMPORT_EVT_TXEMPTY ) == 0 ) + { + LogError( ( "Cellular WriteFile fail timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + } + } + else + { + /* WriteFile fail and error is not the ERROR_IO_PENDING. */ + if( GetLastError() != ERROR_IO_PENDING ) + { + LogError( ( "Cellular WriteFile fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + } + + /* Handle pending I/O. */ + if( ( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) && ( Status == FALSE ) ) + { + dwRes = WaitForSingleObject( osWrite.hEvent, timeoutMilliseconds ); + + switch( dwRes ) + { + case WAIT_OBJECT_0: + + if( GetOverlappedResult( hComm, &osWrite, &dwWritten, FALSE ) == FALSE ) + { + LogError( ( "Cellular GetOverlappedResult fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + break; + + case STATUS_TIMEOUT: + LogError( ( "Cellular WaitForSingleObject timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + break; + + default: + LogError( ( "Cellular WaitForSingleObject fail %d", dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + break; + } + + *pDataSentLength = ( uint32_t ) dwWritten; + } + + if( osWrite.hEvent != NULL ) + { + Status = CloseHandle( osWrite.hEvent ); + + if( Status == FALSE ) + { + LogDebug( ( "Cellular send CloseHandle fail" ) ); + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ + +static CellularCommInterfaceError_t _prvCommIntfReceive( CellularCommInterfaceHandle_t commInterfaceHandle, + uint8_t * pBuffer, + uint32_t bufferLength, + uint32_t timeoutMilliseconds, + uint32_t * pDataReceivedLength ) +{ + CellularCommInterfaceError_t commIntRet = IOT_COMM_INTERFACE_SUCCESS; + _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) commInterfaceHandle; + HANDLE hComm = NULL; + OVERLAPPED osRead = { 0 }; + BOOL Status = TRUE; + DWORD dwRes = 0; + DWORD dwRead = 0; + EventBits_t uxBits = 0; + + if( pCellularCommContext == NULL ) + { + LogError( ( "Cellular receive comm interface handle invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pBuffer == NULL ) || ( bufferLength == 0 ) ) + { + LogError( ( "Cellular receive pBuffer or bufferLength invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( pDataReceivedLength == NULL ) + { + LogError( ( "Cellular receive pDataReceivedLength invalid." ) ); + commIntRet = IOT_COMM_INTERFACE_BAD_PARAMETER; + } + else if( ( pCellularCommContext->commStatus & CELLULAR_COMM_OPEN_BIT ) == 0 ) + { + LogError( ( "Cellular read comm interface is not opened before." ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + else + { + hComm = pCellularCommContext->commFileHandle; + osRead.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); + + if( osRead.hEvent == NULL ) + { + LogError( ( "Cellular CreateEvent fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + + if( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) + { + Status = ReadFile( hComm, pBuffer, bufferLength, &dwRead, &osRead ); + + if( ( Status == TRUE ) && ( dwRead == 0 ) ) + { + /* Wait for notification from eventqueue. */ + uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommPortEvent ), + ( ( EventBits_t ) COMMPORT_EVT_RXCHAR ), + pdTRUE, + pdFALSE, + pdMS_TO_TICKS( timeoutMilliseconds ) ); + + if( ( uxBits & COMMPORT_EVT_RXCHAR ) == 0 ) + { + LogDebug( ( "Cellular ReadFile timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + } + else + { + Status = ReadFile( hComm, pBuffer, bufferLength, &dwRead, &osRead ); + } + } + + if( Status == TRUE ) + { + *pDataReceivedLength = ( uint32_t ) dwRead; + } + else + { + if( GetLastError() != ERROR_IO_PENDING ) + { + LogError( ( "Cellular ReadFile fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + } + } + + /* Handle pending I/O. */ + if( ( commIntRet == IOT_COMM_INTERFACE_SUCCESS ) && ( Status == FALSE ) ) + { + dwRes = WaitForSingleObject( osRead.hEvent, timeoutMilliseconds ); + + switch( dwRes ) + { + case WAIT_OBJECT_0: + + if( GetOverlappedResult( hComm, &osRead, &dwRead, FALSE ) == FALSE ) + { + LogError( ( "Cellular receive GetOverlappedResult fail %d", GetLastError() ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + } + + break; + + case STATUS_TIMEOUT: + LogError( ( "Cellular receive WaitForSingleObject timeout" ) ); + commIntRet = IOT_COMM_INTERFACE_TIMEOUT; + break; + + default: + LogError( ( "Cellular receive WaitForSingleObject fail %d", dwRes ) ); + commIntRet = IOT_COMM_INTERFACE_FAILURE; + break; + } + + *pDataReceivedLength = ( uint32_t ) dwRead; + } + + if( osRead.hEvent != NULL ) + { + Status = CloseHandle( osRead.hEvent ); + + if( Status == FALSE ) + { + LogDebug( ( "Cellular recv CloseHandle fail" ) ); + } + } + + return commIntRet; +} + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c new file mode 100644 index 000000000..73c97ccc3 --- /dev/null +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c @@ -0,0 +1,326 @@ +/* + * FreeRTOS + * 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. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file main.c + * @brief Implements the main function. + */ + +/* FreeRTOS include. */ +#include +#include "task.h" +/* TCP/IP stack includes. */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* Standard includes. */ +#include +#include +#include + +/* Visual studio intrinsics used so the __debugbreak() function is available + * should an assert get hit. */ +#if defined( _WIN32 ) + #include +#endif + +/* Test Specific configs. */ +#include "test_config.h" + +/* Unity framework includes. */ +#include "unity_fixture.h" +#include "unity_internals.h" + +/*-----------------------------------------------------------*/ + +/* Use by the pseudo random number generator. */ +static UBaseType_t ulNextRand; + +/*-----------------------------------------------------------*/ + +void CellularTestTask( void * pvParameters ) +{ + ( void ) pvParameters; + + /* Initialize unity. */ + UnityFixture.Verbose = 1; + UnityFixture.GroupFilter = 0; + UnityFixture.NameFilter = 0; + UnityFixture.RepeatCount = 1; + + /* Run Unity Tests. */ + UNITY_BEGIN(); + + #if defined( testCELLULAR_API ) && testCELLULAR_API == 1 + RUN_TEST_GROUP( Full_CELLULAR_API ); + #endif + + UNITY_END(); + + /* This task has finished. FreeRTOS does not allow a task to run off the + * end of its implementing function, so the task must be deleted. */ + vTaskDelete( NULL ); +} +/*-----------------------------------------------------------*/ + +int main( void ) +{ + /*** + * See https://www.FreeRTOS.org/mqtt_lts/index.html for configuration and usage instructions. + ***/ + + /* FreeRTOS Cellular Library init needs thread ready environment. + * CellularDemoTask invoke setupCellular to init FreeRTOS Cellular Library and register network. + * Then it runs the MQTT demo. */ + xTaskCreate( CellularTestTask, /* Function that implements the task. */ + "CellularTest", /* Text name for the task - only used for debugging. */ + testconfigTEST_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */ + NULL, /* Task parameter - not used in this case. */ + testconfigTEST_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */ + NULL ); /* Used to pass out a handle to the created task - not used in this case. */ + + /* Start the RTOS scheduler. */ + vTaskStartScheduler(); +} +/*-----------------------------------------------------------*/ + +/* 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 ) +{ + ( void ) eNetworkEvent; +} + +/*-----------------------------------------------------------*/ + +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; + + configPRINTF( ( "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 ) + { + #if defined( _WIN32 ) + __debugbreak(); + #endif + } + } + taskENABLE_INTERRUPTS(); +} + +/*-----------------------------------------------------------*/ + +void vApplicationIdleHook( void ) +{ + const uint32_t ulMSToSleep = 1; + const TickType_t xKitHitCheckPeriod = pdMS_TO_TICKS( 1000UL ); + static TickType_t xTimeNow, xLastTimeCheck = 0; + + /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set + * to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle + * task. It is essential that code added to this hook function never attempts + * to block in any way (for example, call xQueueReceive() with a block time + * specified, or call vTaskDelay()). If application tasks make use of the + * vTaskDelete() API function to delete themselves then it is also important + * that vApplicationIdleHook() is permitted to return to its calling function, + * because it is the responsibility of the idle task to clean up memory + * allocated by the kernel to any task that has since deleted itself. */ + + /* _kbhit() is a Windows system function, and system functions can cause + * crashes if they somehow block the FreeRTOS thread. The call to _kbhit() + * can be removed if it causes problems. Limiting the frequency of calls to + * _kbhit() should minimize the potential for issues. */ + xTimeNow = xTaskGetTickCount(); + + if( ( xTimeNow - xLastTimeCheck ) > xKitHitCheckPeriod ) + { + /* Uncomment the print line to get confirmation that tests are still + * running if you suspect a previous run resulted in a crash. */ + /* configPRINTF( ( "Running...\n" ) ); /**/ + xLastTimeCheck = xTimeNow; + } + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task if configUSE_IDLE_HOOK is set to 1 in + * FreeRTOSConfig.h. It must *NOT* attempt to block. In this case the + * idle task just sleeps to lower the CPU usage. */ + Sleep( ulMSToSleep ); +} +/*-----------------------------------------------------------*/ + +#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 ) */ + +/*-----------------------------------------------------------*/ + +/* 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; +} +/*-----------------------------------------------------------*/ + +void getUserCmd( char * pucUserCmd ) +{ + char cTmp; + + scanf( "%c%c", pucUserCmd, &cTmp ); +} +/*-----------------------------------------------------------*/ + +UBaseType_t uxRand( void ) +{ + const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL; + + /* Utility function to generate a pseudo random number. */ + + ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement; + return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL ); +} + +/*-----------------------------------------------------------*/ + +BaseType_t xApplicationGetRandomNumber() +{ + return uxRand(); +} + +/*-----------------------------------------------------------*/ + +/* + * 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(); +} + +/*-----------------------------------------------------------*/ + +/* 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/lexicon.txt b/lexicon.txt index ac14e48e7..a2ecacfbc 100644 --- a/lexicon.txt +++ b/lexicon.txt @@ -39,6 +39,8 @@ ap apb api apis +apn + app applicationexit appnote @@ -127,6 +129,7 @@ blockq blockqc blocktimems bloggedin +blox bmasterinterface bmattributes bmaxpacketsize @@ -141,6 +144,7 @@ bootloader bootstrapcdn bp br +brasil brdh brdiv brdl @@ -195,9 +199,16 @@ cd cdatastring cdc cec +cellularconnectionloop +cellulardemo +cellulardemotask +cellularloglevel +cellulartest +cellulartesttask centre ceo cer +cereg cerrorbuffer cert certificatetemplate @@ -209,6 +220,7 @@ cexpectednumberofparameters cexpectedstring cfginitialize cg +cgreg ch chacha chachapoly @@ -229,6 +241,7 @@ ckf ckm ckr cktim +claro clearpendingirq cli clientauthentication @@ -251,6 +264,7 @@ closesession cmac cmaxpower cmcnt +cmd cmdlen cmdname cmdrx @@ -283,6 +297,9 @@ commecho comms commsfirst commslast +commreceivecallbackthread +commtaskthread +commtaskthreadstarted comp comrx coms @@ -396,7 +413,9 @@ cqueuereievefromisr cread creadonlyarray creadwritearray +createfile createfileforrx +createthread creceivedstring cren crend @@ -495,6 +514,7 @@ describeendpoint describejobexecution deserialize deserialized +deutsche dev developerguide devicepublickeyasciihex @@ -525,6 +545,7 @@ dly dma dns dnstestnum +docomo doctype doen doens @@ -541,6 +562,8 @@ dqp dr drbg drm +drx +drxvalue dset dsp dspdis @@ -567,12 +590,15 @@ ecmd ecp edbg edk +edrx eeprom eequalpriority efm eg egisters eic +eidrx +eidrxsettings eind eint einval @@ -610,6 +636,7 @@ enterant entercriticalsectionstub entrancy entropycontext +entrytimems enum enums envisionrx @@ -620,6 +647,7 @@ ep epalstate epfr epint +eps eqivalent equalled er @@ -652,10 +680,14 @@ etxck etxhigherpriority etxlowerpriority etype +europe +european eusci eval evb eventcallback +eventgroup +eventqueue evk evnt evt @@ -731,6 +763,7 @@ fpga fpidiv fpu fr +france framming fre fread @@ -807,12 +840,14 @@ gpioe gpios greacefully grec +gsm gree hal halboardinit hallcd hardfault hclk +hcomm hcs hed hein @@ -870,6 +905,7 @@ ic icc iccarm icciar +iccid iccrx iclk icmp @@ -892,6 +928,7 @@ iir il imanufacturer imrh +imsi inb inc incase @@ -917,6 +954,7 @@ integrationtestportablemax intel intenac intenas +interfal interfer interruptcall interrupthandler @@ -1068,6 +1106,7 @@ lfilecloseresult lfxo lfxt lhigherprioritytaskwoken +libatdata libc libgcc libs @@ -1121,6 +1160,7 @@ lsl lsr lstringlength ltd +lte ltransmitted lu lv @@ -1181,6 +1221,7 @@ mam masterrate matchtopic maxcdn +maxdword maximise maxitems mbanumber @@ -1226,6 +1267,7 @@ microsoft microzed mii mikroc +miliseconds min mingw minilistitem @@ -1238,6 +1280,8 @@ misra mkd mkdir mmcr +mno +mnos mosquitto mov movs @@ -1332,6 +1376,7 @@ nt ntp ntpdemo nts +ntt nullptr num numaker @@ -1350,6 +1395,7 @@ oled olen olimex onboard +onboarding oneshot op opendns @@ -1405,6 +1451,7 @@ pactopic palpnprotos param paramater +pargument partest partstall partstled @@ -1426,6 +1473,7 @@ pc pca pcaction pcaddress +pcallbackcontext pcap pcapplicationhostnamehook pcattrib @@ -1446,6 +1494,8 @@ pcdatasentfrominterrupt pcdefenderresponse pcertfilepath pcextracontents +pcellularcommcontext +pcellularsocketcontext pcfakestring pcfile pcfilebuffer @@ -1472,6 +1522,8 @@ pcnew pcnewdir pcommandtorelease pcommandtosend +pcommportevent +pcommtaskevent pcontext pcontextbuffer pcoverflowedtask @@ -1514,11 +1566,13 @@ pdfreertos pdigest pdlong pdms +pdn pdpass pdr pdtrue pe peform +pelapsedtimems pem pendsv perfrom @@ -1552,6 +1606,7 @@ plaformimagestate plaintext plaintexthttpexample platformimagestate +pleaseconsult plib plic pll @@ -1660,8 +1715,10 @@ proj projcoverage promiscious prootca +properoperation prot proto +prototye prs prv prvabortcommand @@ -1847,9 +1904,14 @@ pservertime psignature psl pslotlist +psm +psmsettings +psmtau +psmtimer psoc psocket psr +psregistrationstatus psslcontext pstplatformimagestate psval @@ -1914,6 +1976,7 @@ pulsystemperipheralregister pultaskidarray pultaskidarraylength pultaskidsarray +puserdata pusername pusopenportsarray pusouttcpportsarray @@ -2032,6 +2095,7 @@ randomisation randomise randomised randomiser +ratpriorities rb rbr rbuf @@ -2042,10 +2106,14 @@ rcvtimeo rdparty readbale readdir +readintervaltimeout readme readonly +readtotaltimeoutconstant +readtotaltimeoutmultiplier reblocked receiveloop +receivetimeout receivetimeoutms recmucontrolling recmutex @@ -2056,6 +2124,7 @@ recognises recorderdata recv recvfrom +recvtimeout referencetimestamp reflash reg @@ -2092,6 +2161,7 @@ resynchronise retargets retored retr +rf rfc rgb rhr @@ -2144,6 +2214,7 @@ rxbuffer rxcie rxd rxdv +rxechar rxed rxen rxend @@ -2159,6 +2230,7 @@ samd sampleapp sampleapptask santity +sara sarecomtesttasksstillrunning saveall sbnumber @@ -2188,6 +2260,7 @@ semtest semtestc sendb sendpingrequest +sendtimeout sendtimeoutms sendto sep @@ -2211,6 +2284,7 @@ setimagestate setpollisr setpriority setsockopt +setupcellular sfena sfprld sfr @@ -2244,6 +2318,7 @@ simultaniously singletasks sizeof sk +skt slewrate slibxr smc @@ -2263,8 +2338,11 @@ sntptask soc sockaddr socketauto +sockethandle +socketserrors socklen sof +softbank softbaugh somewebsite sp @@ -2305,6 +2383,7 @@ statictask statictimer stdarg stdint +stdlib stdout sthreempty stirng @@ -2387,6 +2466,10 @@ tcptesttcp tcptesttx td teardown +telecom +telekom +telstra +telus tei temo temt @@ -2398,6 +2481,7 @@ testrunnerafqp testrunnerfull testshadowname testthingname +testtimoutms testval tex tfrz @@ -2405,6 +2489,7 @@ tha thingname thingnamelength thr +threadroutine thre throwtheswitch ths @@ -2414,6 +2499,7 @@ ticktype tiemr tim timeguard +timeoutvaluems timertest timertimer timeserver @@ -2464,6 +2550,7 @@ twoechoclient tx txcomp txd +txempty txen txend txfifolevel @@ -2642,6 +2729,7 @@ ulwantedbaud umount un unblockes +unconfigure unconfigured unferenced unicast @@ -2661,6 +2749,8 @@ unusued updatejobexecution uploadhttpexample upto +urc +urcevent uri url urls @@ -2705,9 +2795,11 @@ utalised utc utest util +utilies utilise utilised utils +utran uvmpw ux uxbaseled @@ -2802,6 +2894,7 @@ veify veirfy vemacread verifyinit +verizon verrorchecks veventgroupclearbitscallback veventgroupdelete @@ -2836,6 +2929,7 @@ vmaindeleteme vmainpoststopprocessing vmemchecktask vmov +vodafone votademotask vpartestinitialise vpartesttoggleled @@ -2909,6 +3003,7 @@ vtaskplaceoneventlistrestricted vtaskpriorityset vtaskresume vtaskresumeall +vtasksettimeoutstate vtaskstartscheduler vtaskstarttrace vtasksuspend @@ -2947,6 +3042,7 @@ wiznet wmaxpacketsize wolfssl wpa +writefile ws www xa @@ -3121,6 +3217,7 @@ xmethodlen xmode xmoredatatofollow xmqttsocket +xmutex xmutexholder xmutextodelete xnetworkbuffer diff --git a/manifest.yml b/manifest.yml index bd4193bee..bc99bf63d 100644 --- a/manifest.yml +++ b/manifest.yml @@ -122,4 +122,11 @@ dependencies: url: "https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos" path: "FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos" + - name: "FreeRTOS-Cellular-Interface" + version: "d35316b" + repository: + type: "git" + url: "https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface.git" + path: "FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface" + license: "MIT" -- cgit v1.2.1