]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries/abstractions/platform/include/platform/iot_metrics.h
Rename \FreeRTOS-Plus\Source\FreeRTOS-Plus-IoT-SDK to \FreeRTOS-Plus\Source\FreeRTOS...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-IoT-Libraries / abstractions / platform / include / platform / iot_metrics.h
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries/abstractions/platform/include/platform/iot_metrics.h b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries/abstractions/platform/include/platform/iot_metrics.h
new file mode 100644 (file)
index 0000000..74eb4f6
--- /dev/null
@@ -0,0 +1,103 @@
+/*\r
+ * Amazon FreeRTOS Platform V1.0.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
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/**\r
+ * @file iot_metrics.h\r
+ * @brief Functions for retrieving [Device Defender](@ref defender) metrics.\r
+ *\r
+ * The functions in this header are only required by Device Defender. They do not\r
+ * need to be implemented if Device Defender is not used.\r
+ */\r
+\r
+#ifndef IOT_METRICS_H_\r
+#define IOT_METRICS_H_\r
+\r
+/* The config header is always included first. */\r
+#include "iot_config.h"\r
+\r
+/* Standard includes. */\r
+#include <stdbool.h>\r
+\r
+/* Linear containers (lists and queues) include. */\r
+#include "iot_linear_containers.h"\r
+\r
+/**\r
+ * @functionspage{platform_metrics,platform metrics component,Metrics}\r
+ * - @functionname{platform_metrics_function_init}\r
+ * - @functionname{platform_metrics_function_cleanup}\r
+ * - @functionname{platform_metrics_function_gettcpconnections}\r
+ */\r
+\r
+/**\r
+ * @functionpage{IotMetrics_Init,platform_metrics,init}\r
+ * @functionpage{IotMetrics_Cleanup,platform_metrics,cleanup}\r
+ * @functionpage{IotMetrics_GetTcpConnections,platform_metrics,gettcpconnections}\r
+ */\r
+\r
+/**\r
+ * @brief One-time initialization function for the platform metrics component.\r
+ *\r
+ * This function initializes the platform metrics component. <b>It must be called\r
+ * once (and only once) before calling any other metrics or [Device Defender function]\r
+ * (@ref defender_functions).</b> Calling this function more than once without first\r
+ * calling @ref platform_metrics_function_cleanup may result in a crash.\r
+ *\r
+ * @return `true` is initialization succeeded; `false` otherwise.\r
+ *\r
+ * @warning No thread-safety guarantees are provided for this function.\r
+ */\r
+/* @[declare_platform_metrics_init] */\r
+bool IotMetrics_Init( void );\r
+/* @[declare_platform_metrics_init] */\r
+\r
+/**\r
+ * @brief One-time deinitialization function for the platform metrics component.\r
+ *\r
+ * This function frees resources taken in @ref platform_metrics_function_init.\r
+ * No other metrics or [Device Defender functions](@ref defender_functions) may\r
+ * be called unless @ref platform_metrics_function_init is called again.\r
+ *\r
+ * @warning No thread-safety guarantees are provided for this function.\r
+ */\r
+/* @[declare_platform_metrics_cleanup] */\r
+void IotMetrics_Cleanup( void );\r
+/* @[declare_platform_metrics_cleanup] */\r
+\r
+/**\r
+ * @brief Retrieve a list of active TCP connections from the system.\r
+ *\r
+ * The provided connections are reported by Device Defender.\r
+ *\r
+ * @param[in] pContext Context passed as the first parameter of `metricsCallback`.\r
+ * @param[in] metricsCallback Called by this function to provide the list of TCP\r
+ * connections. The list given by this function is should not be used after the\r
+ * callback returns.\r
+ */\r
+/* @[declare_platform_metrics_gettcpconnections] */\r
+void IotMetrics_GetTcpConnections( void * pContext,\r
+                                   void ( * metricsCallback )( void *, const IotListDouble_t * ) );\r
+/* @[declare_platform_metrics_gettcpconnections] */\r
+\r
+#endif /* ifndef IOT_METRICS_H_ */\r