]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/c_sdk/platform/iot_metrics.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-IoT-Libraries / c_sdk / platform / iot_metrics.h
1 /*\r
2  * IoT Platform V1.1.0\r
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  */\r
22 \r
23 /**\r
24  * @file iot_metrics.h\r
25  * @brief Functions for retrieving [Device Defender](@ref defender) metrics.\r
26  *\r
27  * The functions in this header are only required by Device Defender. They do not\r
28  * need to be implemented if Device Defender is not used.\r
29  */\r
30 \r
31 #ifndef IOT_METRICS_H_\r
32 #define IOT_METRICS_H_\r
33 \r
34 /* The config header is always included first. */\r
35 #include "iot_config.h"\r
36 \r
37 /* Standard includes. */\r
38 #include <stdbool.h>\r
39 \r
40 /* Linear containers (lists and queues) include. */\r
41 #include "iot_linear_containers.h"\r
42 \r
43 /**\r
44  * @functionspage{platform_metrics,platform metrics component,Metrics}\r
45  * - @functionname{platform_metrics_function_init}\r
46  * - @functionname{platform_metrics_function_cleanup}\r
47  * - @functionname{platform_metrics_function_gettcpconnections}\r
48  */\r
49 \r
50 /**\r
51  * @functionpage{IotMetrics_Init,platform_metrics,init}\r
52  * @functionpage{IotMetrics_Cleanup,platform_metrics,cleanup}\r
53  * @functionpage{IotMetrics_GetTcpConnections,platform_metrics,gettcpconnections}\r
54  */\r
55 \r
56 /**\r
57  * @brief One-time initialization function for the platform metrics component.\r
58  *\r
59  * This function initializes the platform metrics component. <b>It must be called\r
60  * once (and only once) before calling any other metrics or [Device Defender function]\r
61  * (@ref defender_functions).</b> Calling this function more than once without first\r
62  * calling @ref platform_metrics_function_cleanup may result in a crash.\r
63  *\r
64  * @return `true` is initialization succeeded; `false` otherwise.\r
65  *\r
66  * @warning No thread-safety guarantees are provided for this function.\r
67  */\r
68 /* @[declare_platform_metrics_init] */\r
69 bool IotMetrics_Init( void );\r
70 /* @[declare_platform_metrics_init] */\r
71 \r
72 /**\r
73  * @brief One-time deinitialization function for the platform metrics component.\r
74  *\r
75  * This function frees resources taken in @ref platform_metrics_function_init.\r
76  * No other metrics or [Device Defender functions](@ref defender_functions) may\r
77  * be called unless @ref platform_metrics_function_init is called again.\r
78  *\r
79  * @warning No thread-safety guarantees are provided for this function.\r
80  */\r
81 /* @[declare_platform_metrics_cleanup] */\r
82 void IotMetrics_Cleanup( void );\r
83 /* @[declare_platform_metrics_cleanup] */\r
84 \r
85 /**\r
86  * @brief Retrieve a list of active TCP connections from the system.\r
87  *\r
88  * The provided connections are reported by Device Defender.\r
89  *\r
90  * @param[in] pContext Context passed as the first parameter of `metricsCallback`.\r
91  * @param[in] metricsCallback Called by this function to provide the list of TCP\r
92  * connections. The list given by this function is should not be used after the\r
93  * callback returns.\r
94  */\r
95 /* @[declare_platform_metrics_gettcpconnections] */\r
96 void IotMetrics_GetTcpConnections( void * pContext,\r
97                                    void ( * metricsCallback )( void *, const IotListDouble_t * ) );\r
98 /* @[declare_platform_metrics_gettcpconnections] */\r
99 \r
100 #endif /* ifndef IOT_METRICS_H_ */\r