]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/c_sdk/platform/types/iot_platform_types.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-IoT-Libraries / c_sdk / platform / types / iot_platform_types.h
diff --git a/FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/c_sdk/platform/types/iot_platform_types.h b/FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/c_sdk/platform/types/iot_platform_types.h
new file mode 100644 (file)
index 0000000..986a1e5
--- /dev/null
@@ -0,0 +1,190 @@
+/*\r
+ * IoT Platform V1.1.0\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ */\r
+\r
+/**\r
+ * @file iot_platform_types.h\r
+ * @brief Types of the platform layer.\r
+ */\r
+\r
+#ifndef IOT_PLATFORM_TYPES_H_\r
+#define IOT_PLATFORM_TYPES_H_\r
+\r
+/* The config header is always included first. */\r
+#include "iot_config.h"\r
+\r
+/* Linear containers (lists and queues) include for metrics types. */\r
+#include "iot_linear_containers.h"\r
+\r
+/*------------------------- Thread management types -------------------------*/\r
+\r
+/**\r
+ * @brief A value representing the system default for new thread priority.\r
+ */\r
+#ifndef IOT_THREAD_DEFAULT_PRIORITY\r
+#define IOT_THREAD_DEFAULT_PRIORITY      0\r
+#endif\r
+\r
+/**\r
+ * @brief A value representing the system default for new thread stack size.\r
+ */\r
+#ifndef IOT_THREAD_DEFAULT_STACK_SIZE\r
+#define IOT_THREAD_DEFAULT_STACK_SIZE    0\r
+#endif\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent mutexes, configured with the type\r
+ * `_IotSystemMutex_t`.\r
+ *\r
+ * For the provided ports, `_IotSystemMutex_t` will be automatically configured.\r
+ * For other ports, `_IotSystemMutex_t` should be set in `iot_config.h`.\r
+ *\r
+ * Mutexes should only be released by the threads that take them.\r
+ *\r
+ * <b>Example</b> <br>\r
+ * To change the type of #IotMutex_t to `long`:\r
+ * @code{c}\r
+ * typedef long _IotSystemMutex_t;\r
+ * #include "iot_threads.h"\r
+ * @endcode\r
+ */\r
+typedef _IotSystemMutex_t       IotMutex_t;\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent semaphores, configured with the type\r
+ * `_IotSystemSemaphore_t`.\r
+ *\r
+ * For the provided ports, `_IotSystemSemaphore_t` will be automatically configured.\r
+ * For other ports, `_IotSystemSemaphore_t` should be set in `iot_config.h`.\r
+ *\r
+ * Semaphores must be counting, and any thread may take (wait on) or release\r
+ * (post to) a semaphore.\r
+ *\r
+ * <b>Example</b> <br>\r
+ * To change the type of #IotSemaphore_t to `long`:\r
+ * @code{c}\r
+ * typedef long _IotSystemSemaphore_t;\r
+ * #include "iot_threads.h"\r
+ * @endcode\r
+ */\r
+typedef _IotSystemSemaphore_t   IotSemaphore_t;\r
+\r
+/**\r
+ * @brief Thread routine function.\r
+ *\r
+ * @param[in] void * The argument passed to the @ref\r
+ * platform_threads_function_createdetachedthread. For application use.\r
+ */\r
+typedef void ( * IotThreadRoutine_t )( void * );\r
+\r
+/*-------------------------- Clock and timer types --------------------------*/\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent timers, configured with the type\r
+ * `_IotSystemTimer_t`.\r
+ *\r
+ * For the provided ports, `_IotSystemTimer_t` will be automatically configured.\r
+ * For other ports, `_IotSystemTimer_t` should be set in `iot_config.h`.\r
+ *\r
+ * <b>Example</b> <br>\r
+ * To change the type of #IotTimer_t to `long`:\r
+ * @code{c}\r
+ * typedef long _IotSystemTimer_t;\r
+ * #include "iot_clock.h"\r
+ * @endcode\r
+ */\r
+typedef _IotSystemTimer_t IotTimer_t;\r
+\r
+/*--------------------------- Network stack types ---------------------------*/\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent network server info, configured with the\r
+ * type `_IotNetworkServerInfo_t`.\r
+ *\r
+ * For the provided ports, `_IotNetworkServerInfo_t` will be automatically configured.\r
+ * For other ports, `_IotNetworkServerInfo_t` should be set in `iot_config.h`.\r
+ *\r
+ * All of the provided ports configure this to #IotNetworkServerInfo, which provides\r
+ * the necessary information to connect to a TCP peer. For other network protocols,\r
+ * this type should be set to an alternate structure as needed by the other protocol.\r
+ */\r
+typedef _IotNetworkServerInfo_t IotNetworkServerInfo_t;\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent network credentials, configured with the\r
+ * type `_IotNetworkCredentials_t`.\r
+ *\r
+ * For the provided ports, `_IotNetworkCredentials_t` will be automatically configured.\r
+ * For other ports, `_IotNetworkCredentials_t` should be set in `iot_config.h`.\r
+ *\r
+ * All of the provided ports configure this to #IotNetworkCredentials, which provides\r
+ * the necessary information to connect to a TLS server over TCP. For other network\r
+ * protocols, this type should be set to an alternate structure as needed by the other\r
+ * protocol.\r
+ */\r
+typedef _IotNetworkCredentials_t IotNetworkCredentials_t;\r
+\r
+/**\r
+ * @ingroup platform_datatypes_handles\r
+ * @brief The type used to represent network connections, configured with the\r
+ * type `_IotNetworkConnection_t`.\r
+ *\r
+ * For the provided ports, `_IotNetworkConnection_t` will be automatically configured.\r
+ * For other ports, `_IotNetworkConnection_t` should be set in `iot_config.h`.\r
+ */\r
+typedef _IotNetworkConnection_t IotNetworkConnection_t;\r
+\r
+/*------------------------------ Metrics types ------------------------------*/\r
+\r
+/**\r
+ * @brief The length of the buffer used to store IP addresses for metrics.\r
+ *\r
+ * This is the length of the longest IPv6 address plus space for the port number\r
+ * and NULL terminator.\r
+ */\r
+#define IOT_METRICS_IP_ADDRESS_LENGTH    54\r
+\r
+/**\r
+ * @brief Represents a TCP connection to a remote IPv4 server.\r
+ *\r
+ * A list of these is provided by @ref platform_metrics_function_gettcpconnections.\r
+ */\r
+typedef struct IotMetricsTcpConnection\r
+{\r
+    IotLink_t link;         /**< @brief List link member. */\r
+    void * pNetworkContext; /**< @brief Context that may be used by metrics or Defender. */\r
+    size_t addressLength;   /**< @brief The length of the address stored in #IotMetricsTcpConnection_t.pRemoteAddress. */\r
+\r
+    /**\r
+     * @brief NULL-terminated IP address and port in text format.\r
+     *\r
+     * IPv4 addresses will be in the format `xxx.xxx.xxx.xxx:port`.\r
+     * IPv6 addresses will be in the format `[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:port`.\r
+     */\r
+    char pRemoteAddress[ IOT_METRICS_IP_ADDRESS_LENGTH ];\r
+} IotMetricsTcpConnection_t;\r
+\r
+#endif /* ifndef IOT_PLATFORM_TYPES_H_ */\r