FreeRTOS: Platform
Platform portability layer
Return to main page ↑
iot_metrics.h File Reference

Functions for retrieving Device Defender metrics. More...

#include "iot_config.h"
#include <stdbool.h>
#include "iot_linear_containers.h"

Go to the source code of this file.

Functions

bool IotMetrics_Init (void)
 One-time initialization function for the platform metrics component. More...
 
void IotMetrics_Cleanup (void)
 One-time deinitialization function for the platform metrics component. More...
 
void IotMetrics_GetTcpConnections (void *pContext, void(*metricsCallback)(void *, const IotListDouble_t *))
 Retrieve a list of active TCP connections from the system. More...
 

Detailed Description

Functions for retrieving Device Defender metrics.

The functions in this header are only required by Device Defender. They do not need to be implemented if Device Defender is not used.

Function Documentation

◆ IotMetrics_Init()

bool IotMetrics_Init ( void  )

One-time initialization function for the platform metrics component.

This function initializes the platform metrics component. It must be called once (and only once) before calling any other metrics or Device Defender function. Calling this function more than once without first calling IotMetrics_Cleanup may result in a crash.

Returns
true is initialization succeeded; false otherwise.
Warning
No thread-safety guarantees are provided for this function.

◆ IotMetrics_Cleanup()

void IotMetrics_Cleanup ( void  )

One-time deinitialization function for the platform metrics component.

This function frees resources taken in IotMetrics_Init. No other metrics or Device Defender functions may be called unless IotMetrics_Init is called again.

Warning
No thread-safety guarantees are provided for this function.

◆ IotMetrics_GetTcpConnections()

void IotMetrics_GetTcpConnections ( void *  pContext,
void(*)(void *, const IotListDouble_t *)  metricsCallback 
)

Retrieve a list of active TCP connections from the system.

The provided connections are reported by Device Defender.

Parameters
[in]pContextContext passed as the first parameter of metricsCallback.
[in]metricsCallbackCalled by this function to provide the list of TCP connections. The list given by this function is should not be used after the callback returns.