mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-20 23:27:39 +08:00
Defender demo cleanup (#651)
This commit is contained in:
@ -197,16 +197,6 @@ static uint16_t pusOpenUdpPorts[ democonfigOPEN_UDP_PORTS_ARRAY_SIZE ];
|
|||||||
*/
|
*/
|
||||||
static Connection_t pxEstablishedConnections[ democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE ];
|
static Connection_t pxEstablishedConnections[ democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE ];
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Array of task statuses, used to generate custom metrics.
|
|
||||||
*/
|
|
||||||
static TaskStatus_t pxTaskStatusList[ democonfigCUSTOM_METRICS_TASKS_ARRAY_SIZE ];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Task numbers custom metric array.
|
|
||||||
*/
|
|
||||||
static uint32_t pulCustomMetricsTaskNumbers[ democonfigCUSTOM_METRICS_TASKS_ARRAY_SIZE ];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief All the metrics sent in the Device Defender report.
|
* @brief All the metrics sent in the Device Defender report.
|
||||||
*/
|
*/
|
||||||
@ -243,6 +233,8 @@ static void prvPublishCallback( MQTTContext_t * pxMqttContext,
|
|||||||
/**
|
/**
|
||||||
* @brief Collect all the metrics to be sent in the Device Defender report.
|
* @brief Collect all the metrics to be sent in the Device Defender report.
|
||||||
*
|
*
|
||||||
|
* On success, caller is responsible for freeing xDeviceMetrics.pxTaskStatusArray.
|
||||||
|
*
|
||||||
* @return true if all the metrics are successfully collected;
|
* @return true if all the metrics are successfully collected;
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
@ -251,12 +243,12 @@ static bool prvCollectDeviceMetrics( void );
|
|||||||
/**
|
/**
|
||||||
* @brief Generate the Device Defender report.
|
* @brief Generate the Device Defender report.
|
||||||
*
|
*
|
||||||
* @param[out] pulOutReportLength Length of the Device Defender report.
|
* @param[out] pxOutReportLength Length of the Device Defender report.
|
||||||
*
|
*
|
||||||
* @return true if the report is generated successfully;
|
* @return true if the report is generated successfully;
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool prvGenerateDeviceMetricsReport( uint32_t * pulOutReportLength );
|
static bool prvGenerateDeviceMetricsReport( size_t * pxOutReportLength );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Subscribe to the Device Defender topics.
|
* @brief Subscribe to the Device Defender topics.
|
||||||
@ -277,12 +269,12 @@ static bool prvUnsubscribeFromDefenderTopics( void );
|
|||||||
/**
|
/**
|
||||||
* @brief Publish the generated Device Defender report.
|
* @brief Publish the generated Device Defender report.
|
||||||
*
|
*
|
||||||
* @param[in] ulReportLength Length of the Device Defender report.
|
* @param[in] xReportLength Length of the Device Defender report.
|
||||||
*
|
*
|
||||||
* @return true if the report is published successfully;
|
* @return true if the report is published successfully;
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool prvPublishDeviceMetricsReport( uint32_t ulReportLength );
|
static bool prvPublishDeviceMetricsReport( size_t xReportLength );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Validate the response received from the AWS IoT Device Defender Service.
|
* @brief Validate the response received from the AWS IoT Device Defender Service.
|
||||||
@ -291,13 +283,13 @@ static bool prvPublishDeviceMetricsReport( uint32_t ulReportLength );
|
|||||||
* is same as was sent in the published report.
|
* is same as was sent in the published report.
|
||||||
*
|
*
|
||||||
* @param[in] pcDefenderResponse The defender response to validate.
|
* @param[in] pcDefenderResponse The defender response to validate.
|
||||||
* @param[in] ulDefenderResponseLength Length of the defender response.
|
* @param[in] xDefenderResponseLength Length of the defender response.
|
||||||
*
|
*
|
||||||
* @return true if the response is valid;
|
* @return true if the response is valid;
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
||||||
uint32_t ulDefenderResponseLength );
|
size_t xDefenderResponseLength );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The task used to demonstrate the Defender API.
|
* @brief The task used to demonstrate the Defender API.
|
||||||
@ -316,7 +308,7 @@ static void prvDefenderDemoTask( void * pvParameters );
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
||||||
uint32_t ulDefenderResponseLength )
|
size_t xDefenderResponseLength )
|
||||||
{
|
{
|
||||||
bool xStatus = false;
|
bool xStatus = false;
|
||||||
JSONStatus_t eJsonResult = JSONSuccess;
|
JSONStatus_t eJsonResult = JSONSuccess;
|
||||||
@ -327,12 +319,12 @@ static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
|||||||
configASSERT( pcDefenderResponse != NULL );
|
configASSERT( pcDefenderResponse != NULL );
|
||||||
|
|
||||||
/* Is the response a valid JSON? */
|
/* Is the response a valid JSON? */
|
||||||
eJsonResult = JSON_Validate( pcDefenderResponse, ulDefenderResponseLength );
|
eJsonResult = JSON_Validate( pcDefenderResponse, xDefenderResponseLength );
|
||||||
|
|
||||||
if( eJsonResult != JSONSuccess )
|
if( eJsonResult != JSONSuccess )
|
||||||
{
|
{
|
||||||
LogError( ( "Invalid response from AWS IoT Device Defender Service: %.*s.",
|
LogError( ( "Invalid response from AWS IoT Device Defender Service: %.*s.",
|
||||||
( int ) ulDefenderResponseLength,
|
( int ) xDefenderResponseLength,
|
||||||
pcDefenderResponse ) );
|
pcDefenderResponse ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +332,7 @@ static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
|||||||
{
|
{
|
||||||
/* Search the ReportId key in the response. */
|
/* Search the ReportId key in the response. */
|
||||||
eJsonResult = JSON_Search( ( char * ) pcDefenderResponse,
|
eJsonResult = JSON_Search( ( char * ) pcDefenderResponse,
|
||||||
ulDefenderResponseLength,
|
xDefenderResponseLength,
|
||||||
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
||||||
DEFENDER_RESPONSE_REPORT_ID_FIELD_LENGTH,
|
DEFENDER_RESPONSE_REPORT_ID_FIELD_LENGTH,
|
||||||
&( ucReportIdString ),
|
&( ucReportIdString ),
|
||||||
@ -351,7 +343,7 @@ static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
|||||||
LogError( ( "%s key not found in the response from the"
|
LogError( ( "%s key not found in the response from the"
|
||||||
"AWS IoT Device Defender Service: %.*s.",
|
"AWS IoT Device Defender Service: %.*s.",
|
||||||
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
||||||
( int ) ulDefenderResponseLength,
|
( int ) xDefenderResponseLength,
|
||||||
pcDefenderResponse ) );
|
pcDefenderResponse ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -376,7 +368,7 @@ static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
|||||||
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
DEFENDER_RESPONSE_REPORT_ID_FIELD,
|
||||||
ulReportId,
|
ulReportId,
|
||||||
ulReportIdInResponse,
|
ulReportIdInResponse,
|
||||||
( int ) ulDefenderResponseLength,
|
( int ) xDefenderResponseLength,
|
||||||
pcDefenderResponse ) );
|
pcDefenderResponse ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -476,9 +468,11 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
{
|
{
|
||||||
bool xStatus = false;
|
bool xStatus = false;
|
||||||
eMetricsCollectorStatus eStatus;
|
eMetricsCollectorStatus eStatus;
|
||||||
uint32_t ulNumOpenTcpPorts = 0UL, ulNumOpenUdpPorts = 0UL, ulNumEstablishedConnections = 0UL, i;
|
size_t xNumOpenTcpPorts = 0UL, xNumOpenUdpPorts = 0UL, xNumEstablishedConnections = 0UL, i;
|
||||||
UBaseType_t uxTasksWritten = { 0 };
|
UBaseType_t uxTasksWritten = { 0 };
|
||||||
|
UBaseType_t uxNumTasksRunning;
|
||||||
TaskStatus_t pxTaskStatus = { 0 };
|
TaskStatus_t pxTaskStatus = { 0 };
|
||||||
|
TaskStatus_t * pxTaskStatusArray = NULL;
|
||||||
|
|
||||||
/* Collect bytes and packets sent and received. */
|
/* Collect bytes and packets sent and received. */
|
||||||
eStatus = eGetNetworkStats( &( xNetworkStats ) );
|
eStatus = eGetNetworkStats( &( xNetworkStats ) );
|
||||||
@ -494,7 +488,7 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
{
|
{
|
||||||
eStatus = eGetOpenTcpPorts( &( pusOpenTcpPorts[ 0 ] ),
|
eStatus = eGetOpenTcpPorts( &( pusOpenTcpPorts[ 0 ] ),
|
||||||
democonfigOPEN_TCP_PORTS_ARRAY_SIZE,
|
democonfigOPEN_TCP_PORTS_ARRAY_SIZE,
|
||||||
&( ulNumOpenTcpPorts ) );
|
&( xNumOpenTcpPorts ) );
|
||||||
|
|
||||||
if( eStatus != eMetricsCollectorSuccess )
|
if( eStatus != eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
@ -508,7 +502,7 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
{
|
{
|
||||||
eStatus = eGetOpenUdpPorts( &( pusOpenUdpPorts[ 0 ] ),
|
eStatus = eGetOpenUdpPorts( &( pusOpenUdpPorts[ 0 ] ),
|
||||||
democonfigOPEN_UDP_PORTS_ARRAY_SIZE,
|
democonfigOPEN_UDP_PORTS_ARRAY_SIZE,
|
||||||
&( ulNumOpenUdpPorts ) );
|
&( xNumOpenUdpPorts ) );
|
||||||
|
|
||||||
if( eStatus != eMetricsCollectorSuccess )
|
if( eStatus != eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
@ -522,7 +516,7 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
{
|
{
|
||||||
eStatus = eGetEstablishedConnections( &( pxEstablishedConnections[ 0 ] ),
|
eStatus = eGetEstablishedConnections( &( pxEstablishedConnections[ 0 ] ),
|
||||||
democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE,
|
democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE,
|
||||||
&( ulNumEstablishedConnections ) );
|
&( xNumEstablishedConnections ) );
|
||||||
|
|
||||||
if( eStatus != eMetricsCollectorSuccess )
|
if( eStatus != eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
@ -531,33 +525,18 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Collect custom metrics. This demo sends this task's stack high water mark
|
|
||||||
* as a number type custom metric and the current task IDs as a list of
|
|
||||||
* numbers type custom metric. */
|
|
||||||
if( eStatus == eMetricsCollectorSuccess )
|
if( eStatus == eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
vTaskGetInfo(
|
/* Get task count */
|
||||||
/* Query this task. */
|
uxNumTasksRunning = uxTaskGetNumberOfTasks();
|
||||||
NULL,
|
|
||||||
&pxTaskStatus,
|
|
||||||
/* Include the stack high water mark value. */
|
|
||||||
pdTRUE,
|
|
||||||
/* Don't include the task state in the TaskStatus_t structure. */
|
|
||||||
0 );
|
|
||||||
uxTasksWritten = uxTaskGetSystemState( pxTaskStatusList, democonfigCUSTOM_METRICS_TASKS_ARRAY_SIZE, NULL );
|
|
||||||
|
|
||||||
if( uxTasksWritten == 0 )
|
/* Allocate pxTaskStatusArray */
|
||||||
|
pxTaskStatusArray = pvPortMalloc( uxNumTasksRunning * sizeof( TaskStatus_t ) );
|
||||||
|
|
||||||
|
if( pxTaskStatusArray == NULL )
|
||||||
{
|
{
|
||||||
|
LogError( ( "Cannot allocate memory for pxTaskStatusArray: pvPortMalloc() failed." ) );
|
||||||
eStatus = eMetricsCollectorCollectionFailed;
|
eStatus = eMetricsCollectorCollectionFailed;
|
||||||
LogError( ( "Failed to collect system state. uxTaskGetSystemState() failed due to insufficient buffer space.",
|
|
||||||
eStatus ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( i = 0; i < uxTasksWritten; i++ )
|
|
||||||
{
|
|
||||||
pulCustomMetricsTaskNumbers[ i ] = pxTaskStatusList[ i ].xTaskNumber;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,6 +545,9 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
* numbers type custom metric. */
|
* numbers type custom metric. */
|
||||||
if( eStatus == eMetricsCollectorSuccess )
|
if( eStatus == eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
|
/* Get the current task's status information. The usStackHighWaterMark
|
||||||
|
* field of the task status will be included in the report as a "number"
|
||||||
|
* custom metric. */
|
||||||
vTaskGetInfo(
|
vTaskGetInfo(
|
||||||
/* Query this task. */
|
/* Query this task. */
|
||||||
NULL,
|
NULL,
|
||||||
@ -574,21 +556,20 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
pdTRUE,
|
pdTRUE,
|
||||||
/* Don't include the task state in the TaskStatus_t structure. */
|
/* Don't include the task state in the TaskStatus_t structure. */
|
||||||
0 );
|
0 );
|
||||||
uxTasksWritten = uxTaskGetSystemState( pxTaskStatusList, democonfigCUSTOM_METRICS_TASKS_ARRAY_SIZE, NULL );
|
/* Get the task status information for all running tasks. The task IDs
|
||||||
|
* of each task is then extracted to include in the report as a "list of
|
||||||
|
* numbers" custom metric */
|
||||||
|
uxTasksWritten = uxTaskGetSystemState( pxTaskStatusArray, uxNumTasksRunning, NULL );
|
||||||
|
|
||||||
if( uxTasksWritten == 0 )
|
if( uxTasksWritten == 0 )
|
||||||
{
|
{
|
||||||
|
/* If 0 is returned, the buffer was too small. This line is reached
|
||||||
|
* when we hit the race condition where tasks have been added since
|
||||||
|
* we got the result of uxTaskGetNumberOfTasks() */
|
||||||
eStatus = eMetricsCollectorCollectionFailed;
|
eStatus = eMetricsCollectorCollectionFailed;
|
||||||
LogError( ( "Failed to collect system state. uxTaskGetSystemState() failed due to insufficient buffer space.",
|
LogError( ( "Failed to collect system state. uxTaskGetSystemState() failed due to insufficient buffer space.",
|
||||||
eStatus ) );
|
eStatus ) );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
for( i = 0; i < uxTasksWritten; i++ )
|
|
||||||
{
|
|
||||||
pulCustomMetricsTaskNumbers[ i ] = pxTaskStatusList[ i ].xTaskNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Populate device metrics. */
|
/* Populate device metrics. */
|
||||||
@ -597,21 +578,30 @@ static bool prvCollectDeviceMetrics( void )
|
|||||||
xStatus = true;
|
xStatus = true;
|
||||||
xDeviceMetrics.pxNetworkStats = &( xNetworkStats );
|
xDeviceMetrics.pxNetworkStats = &( xNetworkStats );
|
||||||
xDeviceMetrics.pusOpenTcpPortsArray = &( pusOpenTcpPorts[ 0 ] );
|
xDeviceMetrics.pusOpenTcpPortsArray = &( pusOpenTcpPorts[ 0 ] );
|
||||||
xDeviceMetrics.ulOpenTcpPortsArrayLength = ulNumOpenTcpPorts;
|
xDeviceMetrics.xOpenTcpPortsArrayLength = xNumOpenTcpPorts;
|
||||||
xDeviceMetrics.pusOpenUdpPortsArray = &( pusOpenUdpPorts[ 0 ] );
|
xDeviceMetrics.pusOpenUdpPortsArray = &( pusOpenUdpPorts[ 0 ] );
|
||||||
xDeviceMetrics.ulOpenUdpPortsArrayLength = ulNumOpenUdpPorts;
|
xDeviceMetrics.xOpenUdpPortsArrayLength = xNumOpenUdpPorts;
|
||||||
xDeviceMetrics.pxEstablishedConnectionsArray = &( pxEstablishedConnections[ 0 ] );
|
xDeviceMetrics.pxEstablishedConnectionsArray = &( pxEstablishedConnections[ 0 ] );
|
||||||
xDeviceMetrics.ulEstablishedConnectionsArrayLength = ulNumEstablishedConnections;
|
xDeviceMetrics.xEstablishedConnectionsArrayLength = xNumEstablishedConnections;
|
||||||
xDeviceMetrics.ulStackHighWaterMark = pxTaskStatus.usStackHighWaterMark;
|
xDeviceMetrics.ulStackHighWaterMark = pxTaskStatus.usStackHighWaterMark;
|
||||||
xDeviceMetrics.pulTaskIdArray = pulCustomMetricsTaskNumbers;
|
xDeviceMetrics.pxTaskStatusArray = pxTaskStatusArray;
|
||||||
xDeviceMetrics.ulTaskIdArrayLength = uxTasksWritten;
|
xDeviceMetrics.xTaskStatusArrayLength = uxTasksWritten;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Free pxTaskStatusArray if we allocated it but did not add it to the
|
||||||
|
* xDeviceMetrics struct. */
|
||||||
|
if( pxTaskStatusArray != NULL )
|
||||||
|
{
|
||||||
|
vPortFree( pxTaskStatusArray );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xStatus;
|
return xStatus;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static bool prvGenerateDeviceMetricsReport( uint32_t * pulOutReportLength )
|
static bool prvGenerateDeviceMetricsReport( size_t * pxOutReportLength )
|
||||||
{
|
{
|
||||||
bool xStatus = false;
|
bool xStatus = false;
|
||||||
eReportBuilderStatus eReportBuilderStatus;
|
eReportBuilderStatus eReportBuilderStatus;
|
||||||
@ -624,7 +614,7 @@ static bool prvGenerateDeviceMetricsReport( uint32_t * pulOutReportLength )
|
|||||||
democonfigDEVICE_METRICS_REPORT_MAJOR_VERSION,
|
democonfigDEVICE_METRICS_REPORT_MAJOR_VERSION,
|
||||||
democonfigDEVICE_METRICS_REPORT_MINOR_VERSION,
|
democonfigDEVICE_METRICS_REPORT_MINOR_VERSION,
|
||||||
ulReportId,
|
ulReportId,
|
||||||
pulOutReportLength );
|
pxOutReportLength );
|
||||||
|
|
||||||
if( eReportBuilderStatus != eReportBuilderSuccess )
|
if( eReportBuilderStatus != eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
@ -634,7 +624,7 @@ static bool prvGenerateDeviceMetricsReport( uint32_t * pulOutReportLength )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogDebug( ( "Generated Report: %.*s.",
|
LogDebug( ( "Generated Report: %.*s.",
|
||||||
*pulOutReportLength,
|
*pxOutReportLength,
|
||||||
&( pcDeviceMetricsJsonReport[ 0 ] ) ) );
|
&( pcDeviceMetricsJsonReport[ 0 ] ) ) );
|
||||||
xStatus = true;
|
xStatus = true;
|
||||||
}
|
}
|
||||||
@ -699,13 +689,13 @@ static bool prvUnsubscribeFromDefenderTopics( void )
|
|||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static bool prvPublishDeviceMetricsReport( uint32_t reportLength )
|
static bool prvPublishDeviceMetricsReport( size_t xReportLength )
|
||||||
{
|
{
|
||||||
return xPublishToTopic( &xMqttContext,
|
return xPublishToTopic( &xMqttContext,
|
||||||
DEFENDER_API_JSON_PUBLISH( democonfigTHING_NAME ),
|
DEFENDER_API_JSON_PUBLISH( democonfigTHING_NAME ),
|
||||||
DEFENDER_API_LENGTH_JSON_PUBLISH( THING_NAME_LENGTH ),
|
DEFENDER_API_LENGTH_JSON_PUBLISH( THING_NAME_LENGTH ),
|
||||||
&( pcDeviceMetricsJsonReport[ 0 ] ),
|
&( pcDeviceMetricsJsonReport[ 0 ] ),
|
||||||
reportLength );
|
xReportLength );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
@ -732,7 +722,8 @@ void prvDefenderDemoTask( void * pvParameters )
|
|||||||
{
|
{
|
||||||
bool xStatus = false;
|
bool xStatus = false;
|
||||||
BaseType_t xExitStatus = EXIT_FAILURE;
|
BaseType_t xExitStatus = EXIT_FAILURE;
|
||||||
uint32_t ulReportLength = 0UL, i, ulMqttSessionEstablished = 0UL;
|
uint32_t ulReportLength = 0UL, i;
|
||||||
|
bool xMqttSessionEstablished = false;
|
||||||
UBaseType_t uxDemoRunCount = 0UL;
|
UBaseType_t uxDemoRunCount = 0UL;
|
||||||
|
|
||||||
/* Remove compiler warnings about unused parameters. */
|
/* Remove compiler warnings about unused parameters. */
|
||||||
@ -777,7 +768,7 @@ void prvDefenderDemoTask( void * pvParameters )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulMqttSessionEstablished = 1;
|
xMqttSessionEstablished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************** Subscribe to Defender topics. *******************/
|
/******************** Subscribe to Defender topics. *******************/
|
||||||
@ -853,6 +844,13 @@ void prvDefenderDemoTask( void * pvParameters )
|
|||||||
LogInfo( ( "Generating Device Defender report..." ) );
|
LogInfo( ( "Generating Device Defender report..." ) );
|
||||||
xStatus = prvGenerateDeviceMetricsReport( &( ulReportLength ) );
|
xStatus = prvGenerateDeviceMetricsReport( &( ulReportLength ) );
|
||||||
|
|
||||||
|
/* Free the allocated array in xDeviceMetrics struct which is not
|
||||||
|
* used anymore after prvGenerateDeviceMetricsReport(). This code is
|
||||||
|
* only reached when prvCollectDeviceMetrics succeeded, so
|
||||||
|
* xDeviceMetrics.pxTaskStatusArray is a valid allocation that needs
|
||||||
|
* to be freed. */
|
||||||
|
vPortFree( xDeviceMetrics.pxTaskStatusArray );
|
||||||
|
|
||||||
if( xStatus != true )
|
if( xStatus != true )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to generate Device Defender report." ) );
|
LogError( ( "Failed to generate Device Defender report." ) );
|
||||||
@ -908,7 +906,7 @@ void prvDefenderDemoTask( void * pvParameters )
|
|||||||
* protocol spec, it is okay to send UNSUBSCRIBE even if no corresponding
|
* protocol spec, it is okay to send UNSUBSCRIBE even if no corresponding
|
||||||
* subscription exists on the broker. Therefore, it is okay to attempt
|
* subscription exists on the broker. Therefore, it is okay to attempt
|
||||||
* unsubscribe even if one more subscribe failed earlier. */
|
* unsubscribe even if one more subscribe failed earlier. */
|
||||||
if( ulMqttSessionEstablished == 1 )
|
if( xMqttSessionEstablished )
|
||||||
{
|
{
|
||||||
LogInfo( ( "Unsubscribing from defender topics..." ) );
|
LogInfo( ( "Unsubscribing from defender topics..." ) );
|
||||||
xStatus = prvUnsubscribeFromDefenderTopics();
|
xStatus = prvUnsubscribeFromDefenderTopics();
|
||||||
|
@ -75,12 +75,12 @@ eMetricsCollectorStatus eGetNetworkStats( NetworkStats_t * pxOutNetworkStats )
|
|||||||
/* Fill our response with values gotten from FreeRTOS+TCP. */
|
/* Fill our response with values gotten from FreeRTOS+TCP. */
|
||||||
if( eStatus == eMetricsCollectorSuccess )
|
if( eStatus == eMetricsCollectorSuccess )
|
||||||
{
|
{
|
||||||
LogDebug( ( "Network stats read. Bytes received: %u, packets received: %u, "
|
LogDebug( ( "Network stats read. Bytes received: %lu, packets received: %lu, "
|
||||||
"bytes sent: %u, packets sent: %u.",
|
"bytes sent: %lu, packets sent: %lu.",
|
||||||
( unsigned int ) xMetrics.xInput.uxByteCount,
|
( unsigned long ) xMetrics.xInput.uxByteCount,
|
||||||
( unsigned int ) xMetrics.xInput.uxPacketCount,
|
( unsigned long ) xMetrics.xInput.uxPacketCount,
|
||||||
( unsigned int ) xMetrics.xOutput.uxByteCount,
|
( unsigned long ) xMetrics.xOutput.uxByteCount,
|
||||||
( unsigned int ) xMetrics.xOutput.uxPacketCount ) );
|
( unsigned long ) xMetrics.xOutput.uxPacketCount ) );
|
||||||
|
|
||||||
pxOutNetworkStats->ulBytesReceived = xMetrics.xInput.uxByteCount;
|
pxOutNetworkStats->ulBytesReceived = xMetrics.xInput.uxByteCount;
|
||||||
pxOutNetworkStats->ulPacketsReceived = xMetrics.xInput.uxPacketCount;
|
pxOutNetworkStats->ulPacketsReceived = xMetrics.xInput.uxPacketCount;
|
||||||
@ -93,17 +93,17 @@ eMetricsCollectorStatus eGetNetworkStats( NetworkStats_t * pxOutNetworkStats )
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
||||||
uint32_t ulTcpPortsArrayLength,
|
size_t xTcpPortsArrayLength,
|
||||||
uint32_t * pulOutNumTcpOpenPorts )
|
size_t * pxOutNumTcpOpenPorts )
|
||||||
{
|
{
|
||||||
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
||||||
|
|
||||||
MetricsType_t xMetrics = { 0 };
|
MetricsType_t xMetrics = { 0 };
|
||||||
BaseType_t xMetricsStatus = 0;
|
BaseType_t xMetricsStatus = 0;
|
||||||
uint32_t ulCopyAmount = 0UL;
|
size_t xCopyAmount = 0UL;
|
||||||
|
|
||||||
/* pusOutTcpPortsArray can be NULL. */
|
/* pusOutTcpPortsArray can be NULL. */
|
||||||
configASSERT( pulOutNumTcpOpenPorts != NULL );
|
configASSERT( pxOutNumTcpOpenPorts != NULL );
|
||||||
|
|
||||||
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
||||||
xMetricsStatus = vGetMetrics( &xMetrics );
|
xMetricsStatus = vGetMetrics( &xMetrics );
|
||||||
@ -121,24 +121,24 @@ eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
|||||||
* given array. */
|
* given array. */
|
||||||
if( pusOutTcpPortsArray != NULL )
|
if( pusOutTcpPortsArray != NULL )
|
||||||
{
|
{
|
||||||
ulCopyAmount = xMetrics.xTCPPortList.uxCount;
|
xCopyAmount = xMetrics.xTCPPortList.uxCount;
|
||||||
|
|
||||||
/* Limit the copied ports to what can fit in the output array. */
|
/* Limit the copied ports to what can fit in the output array. */
|
||||||
if( ulTcpPortsArrayLength < xMetrics.xTCPPortList.uxCount )
|
if( xTcpPortsArrayLength < xMetrics.xTCPPortList.uxCount )
|
||||||
{
|
{
|
||||||
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
||||||
ulCopyAmount = ulTcpPortsArrayLength;
|
xCopyAmount = xTcpPortsArrayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( pusOutTcpPortsArray, &xMetrics.xTCPPortList.usTCPPortList, ulCopyAmount * sizeof( uint16_t ) );
|
memcpy( pusOutTcpPortsArray, &xMetrics.xTCPPortList.usTCPPortList, xCopyAmount * sizeof( uint16_t ) );
|
||||||
|
|
||||||
/* Return the number of elements copied to the array. */
|
/* Return the number of elements copied to the array. */
|
||||||
*pulOutNumTcpOpenPorts = ulCopyAmount;
|
*pxOutNumTcpOpenPorts = xCopyAmount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Return the total number of open ports. */
|
/* Return the total number of open ports. */
|
||||||
*pulOutNumTcpOpenPorts = xMetrics.xTCPPortList.uxCount;
|
*pxOutNumTcpOpenPorts = xMetrics.xTCPPortList.uxCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,17 +147,17 @@ eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
||||||
uint32_t ulUdpPortsArrayLength,
|
size_t xUdpPortsArrayLength,
|
||||||
uint32_t * pulOutNumUdpOpenPorts )
|
size_t * pxOutNumUdpOpenPorts )
|
||||||
{
|
{
|
||||||
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
||||||
|
|
||||||
MetricsType_t xMetrics = { 0 };
|
MetricsType_t xMetrics = { 0 };
|
||||||
BaseType_t xMetricsStatus = 0;
|
BaseType_t xMetricsStatus = 0;
|
||||||
uint32_t ulCopyAmount = 0UL;
|
uint32_t xCopyAmount = 0UL;
|
||||||
|
|
||||||
/* pusOutUdpPortsArray can be NULL. */
|
/* pusOutUdpPortsArray can be NULL. */
|
||||||
configASSERT( pulOutNumUdpOpenPorts != NULL );
|
configASSERT( pxOutNumUdpOpenPorts != NULL );
|
||||||
|
|
||||||
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
||||||
xMetricsStatus = vGetMetrics( &xMetrics );
|
xMetricsStatus = vGetMetrics( &xMetrics );
|
||||||
@ -175,24 +175,24 @@ eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
|||||||
* given array. */
|
* given array. */
|
||||||
if( pusOutUdpPortsArray != NULL )
|
if( pusOutUdpPortsArray != NULL )
|
||||||
{
|
{
|
||||||
ulCopyAmount = xMetrics.xUDPPortList.uxCount;
|
xCopyAmount = xMetrics.xUDPPortList.uxCount;
|
||||||
|
|
||||||
/* Limit the copied ports to what can fit in the output array. */
|
/* Limit the copied ports to what can fit in the output array. */
|
||||||
if( ulUdpPortsArrayLength < xMetrics.xUDPPortList.uxCount )
|
if( xUdpPortsArrayLength < xMetrics.xUDPPortList.uxCount )
|
||||||
{
|
{
|
||||||
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
||||||
ulCopyAmount = ulUdpPortsArrayLength;
|
xCopyAmount = xUdpPortsArrayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( pusOutUdpPortsArray, &xMetrics.xUDPPortList.usUDPPortList, ulCopyAmount * sizeof( uint16_t ) );
|
memcpy( pusOutUdpPortsArray, &xMetrics.xUDPPortList.usUDPPortList, xCopyAmount * sizeof( uint16_t ) );
|
||||||
|
|
||||||
/* Return the number of elements copied to the array. */
|
/* Return the number of elements copied to the array. */
|
||||||
*pulOutNumUdpOpenPorts = ulCopyAmount;
|
*pxOutNumUdpOpenPorts = xCopyAmount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Return the total number of open ports. */
|
/* Return the total number of open ports. */
|
||||||
*pulOutNumUdpOpenPorts = xMetrics.xUDPPortList.uxCount;
|
*pxOutNumUdpOpenPorts = xMetrics.xUDPPortList.uxCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,19 +202,19 @@ eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnectionsArray,
|
eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnectionsArray,
|
||||||
uint32_t ulConnectionsArrayLength,
|
size_t xConnectionsArrayLength,
|
||||||
uint32_t * pulOutNumEstablishedConnections )
|
size_t * pxOutNumEstablishedConnections )
|
||||||
{
|
{
|
||||||
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
eMetricsCollectorStatus eStatus = eMetricsCollectorSuccess;
|
||||||
|
|
||||||
MetricsType_t xMetrics = { 0 };
|
MetricsType_t xMetrics = { 0 };
|
||||||
BaseType_t xMetricsStatus = 0;
|
BaseType_t xMetricsStatus = 0;
|
||||||
uint32_t ulCopyAmount = 0UL;
|
size_t xCopyAmount = 0UL;
|
||||||
uint32_t ulLocalIp = 0UL;
|
uint32_t ulLocalIp = 0UL;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
/* pxOutConnectionsArray can be NULL. */
|
/* pxOutConnectionsArray can be NULL. */
|
||||||
configASSERT( pulOutNumEstablishedConnections != NULL );
|
configASSERT( pxOutNumEstablishedConnections != NULL );
|
||||||
|
|
||||||
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
/* Get metrics from FreeRTOS+TCP tcp_netstat utility. */
|
||||||
xMetricsStatus = vGetMetrics( &xMetrics );
|
xMetricsStatus = vGetMetrics( &xMetrics );
|
||||||
@ -232,19 +232,19 @@ eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnecti
|
|||||||
* the given array. */
|
* the given array. */
|
||||||
if( pxOutConnectionsArray != NULL )
|
if( pxOutConnectionsArray != NULL )
|
||||||
{
|
{
|
||||||
ulCopyAmount = xMetrics.xTCPSocketList.uxCount;
|
xCopyAmount = xMetrics.xTCPSocketList.uxCount;
|
||||||
|
|
||||||
/* Get local IP as the tcp_netstat utility does not give it. */
|
/* Get local IP as the tcp_netstat utility does not give it. */
|
||||||
ulLocalIp = FreeRTOS_GetIPAddress();
|
ulLocalIp = FreeRTOS_GetIPAddress();
|
||||||
|
|
||||||
/* Limit the outputted connections to what can fit in the output array. */
|
/* Limit the outputted connections to what can fit in the output array. */
|
||||||
if( ulConnectionsArrayLength < xMetrics.xTCPSocketList.uxCount )
|
if( xConnectionsArrayLength < xMetrics.xTCPSocketList.uxCount )
|
||||||
{
|
{
|
||||||
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
LogWarn( ( "Ports returned truncated due to insufficient buffer size." ) );
|
||||||
ulCopyAmount = ulConnectionsArrayLength;
|
xCopyAmount = xConnectionsArrayLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < ulCopyAmount; i++ )
|
for( i = 0; i < xCopyAmount; i++ )
|
||||||
{
|
{
|
||||||
pxOutConnectionsArray[ i ].ulLocalIp = ulLocalIp;
|
pxOutConnectionsArray[ i ].ulLocalIp = ulLocalIp;
|
||||||
pxOutConnectionsArray[ i ].usLocalPort =
|
pxOutConnectionsArray[ i ].usLocalPort =
|
||||||
@ -256,12 +256,12 @@ eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnecti
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the number of elements copied to the array. */
|
/* Return the number of elements copied to the array. */
|
||||||
*pulOutNumEstablishedConnections = ulCopyAmount;
|
*pxOutNumEstablishedConnections = xCopyAmount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Return the total number of established connections. */
|
/* Return the total number of established connections. */
|
||||||
*pulOutNumEstablishedConnections = xMetrics.xTCPSocketList.uxCount;
|
*pxOutNumEstablishedConnections = xMetrics.xTCPSocketList.uxCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ eMetricsCollectorStatus eGetNetworkStats( NetworkStats_t * pxOutNetworkStats );
|
|||||||
*
|
*
|
||||||
* @param[out] pusOutTcpPortsArray The array to write the open TCP ports into. This
|
* @param[out] pusOutTcpPortsArray The array to write the open TCP ports into. This
|
||||||
* can be NULL, if only the number of open ports is needed.
|
* can be NULL, if only the number of open ports is needed.
|
||||||
* @param[in] ulTcpPortsArrayLength Length of the pusOutTcpPortsArray, if it is not
|
* @param[in] xTcpPortsArrayLength Length of the pusOutTcpPortsArray, if it is not
|
||||||
* NULL.
|
* NULL.
|
||||||
* @param[out] pulOutNumTcpOpenPorts Number of open TCP ports if @p
|
* @param[out] pxOutNumTcpOpenPorts Number of open TCP ports if @p
|
||||||
* pusOutTcpPortsArray NULL, else number of TCP ports written.
|
* pusOutTcpPortsArray NULL, else number of TCP ports written.
|
||||||
*
|
*
|
||||||
* @return #eMetricsCollectorSuccess if open TCP ports are successfully obtained;
|
* @return #eMetricsCollectorSuccess if open TCP ports are successfully obtained;
|
||||||
@ -99,8 +99,8 @@ eMetricsCollectorStatus eGetNetworkStats( NetworkStats_t * pxOutNetworkStats );
|
|||||||
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
||||||
*/
|
*/
|
||||||
eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
||||||
uint32_t ulTcpPortsArrayLength,
|
size_t xTcpPortsArrayLength,
|
||||||
uint32_t * pulOutNumTcpOpenPorts );
|
size_t * pxOutNumTcpOpenPorts );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of the open UDP ports.
|
* @brief Get a list of the open UDP ports.
|
||||||
@ -110,9 +110,9 @@ eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
|||||||
*
|
*
|
||||||
* @param[out] pusOutUdpPortsArray The array to write the open UDP ports into. Can
|
* @param[out] pusOutUdpPortsArray The array to write the open UDP ports into. Can
|
||||||
* be NULL, if only number of open ports is needed.
|
* be NULL, if only number of open ports is needed.
|
||||||
* @param[in] ulUdpPortsArrayLength Length of the pusOutUdpPortsArray, if it is not
|
* @param[in] xUdpPortsArrayLength Length of the pusOutUdpPortsArray, if it is not
|
||||||
* NULL.
|
* NULL.
|
||||||
* @param[out] pulOutNumUdpOpenPorts Number of open UDP ports if @p
|
* @param[out] pxOutNumUdpOpenPorts Number of open UDP ports if @p
|
||||||
* pusOutUdpPortsArray NULL, else number of UDP ports written.
|
* pusOutUdpPortsArray NULL, else number of UDP ports written.
|
||||||
*
|
*
|
||||||
* @return #eMetricsCollectorSuccess if open UDP ports are successfully obtained;
|
* @return #eMetricsCollectorSuccess if open UDP ports are successfully obtained;
|
||||||
@ -120,8 +120,8 @@ eMetricsCollectorStatus eGetOpenTcpPorts( uint16_t * pusOutTcpPortsArray,
|
|||||||
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
||||||
*/
|
*/
|
||||||
eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
||||||
uint32_t ulUdpPortsArrayLength,
|
size_t xUdpPortsArrayLength,
|
||||||
uint32_t * pulOutNumUdpOpenPorts );
|
size_t * pxOutNumUdpOpenPorts );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of established connections.
|
* @brief Get a list of established connections.
|
||||||
@ -133,17 +133,17 @@ eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
|||||||
* @param[out] pxOutConnectionsArray The array to write the established connections
|
* @param[out] pxOutConnectionsArray The array to write the established connections
|
||||||
* into. This can be NULL, if only the number of established connections is
|
* into. This can be NULL, if only the number of established connections is
|
||||||
* needed.
|
* needed.
|
||||||
* @param[in] ulConnectionsArrayLength Length of the pxOutConnectionsArray, if it
|
* @param[in] xConnectionsArrayLength Length of the pxOutConnectionsArray, if it
|
||||||
* is not NULL.
|
* is not NULL.
|
||||||
* @param[out] pulOutNumEstablishedConnections Number of established connections if @p
|
* @param[out] pxOutNumEstablishedConnections Number of established connections if @p
|
||||||
* pusOutNumEstablishedConnections NULL, else number of established connections written.
|
* pxOutNumEstablishedConnections NULL, else number of established connections written.
|
||||||
*
|
*
|
||||||
* @return #eMetricsCollectorSuccess if established connections are successfully obtained;
|
* @return #eMetricsCollectorSuccess if established connections are successfully obtained;
|
||||||
* #eMetricsCollectorBadParameter if invalid parameters are passed;
|
* #eMetricsCollectorBadParameter if invalid parameters are passed;
|
||||||
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
* #eMetricsCollectorCollectionFailed if the collection methods failed.
|
||||||
*/
|
*/
|
||||||
eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnectionsArray,
|
eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnectionsArray,
|
||||||
uint32_t ulConnectionsArrayLength,
|
size_t xConnectionsArrayLength,
|
||||||
uint32_t * pulOutNumEstablishedConnections );
|
size_t * pxOutNumEstablishedConnections );
|
||||||
|
|
||||||
#endif /* ifndef METRICS_COLLECTOR_H_ */
|
#endif /* ifndef METRICS_COLLECTOR_H_ */
|
||||||
|
@ -132,19 +132,19 @@
|
|||||||
* ]
|
* ]
|
||||||
*
|
*
|
||||||
* @param[in] pcBuffer The buffer to write the ports array.
|
* @param[in] pcBuffer The buffer to write the ports array.
|
||||||
* @param[in] ulBufferLength The length of the buffer.
|
* @param[in] xBufferLength The length of the buffer.
|
||||||
* @param[in] pusOpenPortsArray The array containing the open ports.
|
* @param[in] pusOpenPortsArray The array containing the open ports.
|
||||||
* @param[in] ulOpenPortsArrayLength Length of the pusOpenPortsArray array.
|
* @param[in] xOpenPortsArrayLength Length of the pusOpenPortsArray array.
|
||||||
* @param[out] pulOutCharsWritten Number of characters written to the buffer.
|
* @param[out] pxOutCharsWritten Number of characters written to the buffer.
|
||||||
*
|
*
|
||||||
* @return #ReportBuilderSuccess if the array is successfully written;
|
* @return #ReportBuilderSuccess if the array is successfully written;
|
||||||
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
||||||
*/
|
*/
|
||||||
static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const uint16_t * pusOpenPortsArray,
|
const uint16_t * pusOpenPortsArray,
|
||||||
uint32_t ulOpenPortsArrayLength,
|
size_t xOpenPortsArrayLength,
|
||||||
uint32_t * pulOutCharsWritten );
|
size_t * pxOutCharsWritten );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write established connections array to the given buffer in the format
|
* @brief Write established connections array to the given buffer in the format
|
||||||
@ -163,59 +163,60 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
|||||||
* ]
|
* ]
|
||||||
*
|
*
|
||||||
* @param[in] pcBuffer The buffer to write the connections array.
|
* @param[in] pcBuffer The buffer to write the connections array.
|
||||||
* @param[in] ulBufferLength The length of the buffer.
|
* @param[in] xBufferLength The length of the buffer.
|
||||||
* @param[in] pxConnectionsArray The array containing the established connections.
|
* @param[in] pxConnectionsArray The array containing the established connections.
|
||||||
* @param[in] ulConnectionsArrayLength Length of the pxConnectionsArray array.
|
* @param[in] xConnectionsArrayLength Length of the pxConnectionsArray array.
|
||||||
* @param[out] pulOutCharsWritten Number of characters written to the buffer.
|
* @param[out] pxOutCharsWritten Number of characters written to the buffer.
|
||||||
*
|
*
|
||||||
* @return #ReportBuilderSuccess if the array is successfully written;
|
* @return #ReportBuilderSuccess if the array is successfully written;
|
||||||
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
||||||
*/
|
*/
|
||||||
static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const Connection_t * pxConnectionsArray,
|
const Connection_t * pxConnectionsArray,
|
||||||
uint32_t ulConnectionsArrayLength,
|
size_t xConnectionsArrayLength,
|
||||||
uint32_t * pulOutCharsWritten );
|
size_t * pxOutCharsWritten );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write task ID array to the given buffer as a JSON array.
|
* @brief Write task ID array to the given buffer as a JSON array.
|
||||||
*
|
*
|
||||||
* @param[in] pcBuffer The buffer to write the array of task IDs.
|
* @param[in] pcBuffer The buffer to write the array of task IDs.
|
||||||
* @param[in] ulBufferLength The length of the buffer.
|
* @param[in] xBufferLength The length of the buffer.
|
||||||
* @param[in] pulTaskIdArray The array containing the task IDs.
|
* @param[in] pxTaskStatusArray The array containing the task statuses.
|
||||||
* @param[in] pulTaskIdArrayLength Length of the pulTaskIdsArray array.
|
* @param[in] xTaskStatusArrayLength Length of the pxTaskStatusArray array.
|
||||||
* @param[out] pulOutCharsWritten Number of characters written to the buffer.
|
* @param[out] pxOutCharsWritten Number of characters written to the buffer.
|
||||||
*
|
*
|
||||||
* @return #ReportBuilderSuccess if the array is successfully written;
|
* @return #ReportBuilderSuccess if the array is successfully written;
|
||||||
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full array.
|
||||||
*/
|
*/
|
||||||
static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const uint32_t * pulTaskIdArray,
|
const TaskStatus_t * pxTaskStatusArray,
|
||||||
uint32_t pulTaskIdArrayLength,
|
size_t xTaskStatusArrayLength,
|
||||||
uint32_t * pulOutCharsWritten );
|
size_t * pxOutCharsWritten );
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
uint32_t xBufferLength,
|
||||||
const uint16_t * pusOpenPortsArray,
|
const uint16_t * pusOpenPortsArray,
|
||||||
uint32_t ulOpenPortsArrayLength,
|
uint32_t xOpenPortsArrayLength,
|
||||||
uint32_t * pulOutCharsWritten )
|
uint32_t * pxOutCharsWritten )
|
||||||
{
|
{
|
||||||
char * pcCurrentWritePos = pcBuffer;
|
char * pcCurrentWritePos = pcBuffer;
|
||||||
uint32_t i, ulRemainingBufferLength = ulBufferLength;
|
uint32_t i;
|
||||||
|
size_t xRemainingBufferLength = xBufferLength;
|
||||||
int32_t lCharactersWritten;
|
int32_t lCharactersWritten;
|
||||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||||
|
|
||||||
configASSERT( pcBuffer != NULL );
|
configASSERT( pcBuffer != NULL );
|
||||||
configASSERT( pusOpenPortsArray != NULL );
|
configASSERT( pusOpenPortsArray != NULL );
|
||||||
configASSERT( pulOutCharsWritten != NULL );
|
configASSERT( pxOutCharsWritten != NULL );
|
||||||
|
|
||||||
/* Write the JSON array open marker. */
|
/* Write the JSON array open marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -224,20 +225,20 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write the array elements. */
|
/* Write the array elements. */
|
||||||
for( i = 0; ( ( i < ulOpenPortsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
for( i = 0; ( ( i < xOpenPortsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_PORT_OBJECT_FORMAT,
|
reportbuilderJSON_PORT_OBJECT_FORMAT,
|
||||||
pusOpenPortsArray[ i ] );
|
pusOpenPortsArray[ i ] );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= ( uint32_t ) lCharactersWritten;
|
xRemainingBufferLength -= ( uint32_t ) lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,19 +246,19 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
/* Discard the last comma. */
|
/* Discard the last comma. */
|
||||||
if( ulOpenPortsArrayLength > 0 )
|
if( xOpenPortsArrayLength > 0 )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos -= 1;
|
pcCurrentWritePos -= 1;
|
||||||
ulRemainingBufferLength += 1;
|
xRemainingBufferLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the JSON array close marker. */
|
/* Write the JSON array close marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
*pulOutCharsWritten = ulBufferLength - ulRemainingBufferLength;
|
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -270,26 +271,27 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const Connection_t * pxConnectionsArray,
|
const Connection_t * pxConnectionsArray,
|
||||||
uint32_t ulConnectionsArrayLength,
|
size_t xConnectionsArrayLength,
|
||||||
uint32_t * pulOutCharsWritten )
|
size_t * pxOutCharsWritten )
|
||||||
{
|
{
|
||||||
char * pcCurrentWritePos = pcBuffer;
|
char * pcCurrentWritePos = pcBuffer;
|
||||||
uint32_t i, ulRemainingBufferLength = ulBufferLength;
|
uint32_t i;
|
||||||
|
size_t xRemainingBufferLength = xBufferLength;
|
||||||
int32_t lCharactersWritten;
|
int32_t lCharactersWritten;
|
||||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||||
const Connection_t * pxConn;
|
const Connection_t * pxConn;
|
||||||
|
|
||||||
configASSERT( pcBuffer != NULL );
|
configASSERT( pcBuffer != NULL );
|
||||||
configASSERT( pxConnectionsArray != NULL );
|
configASSERT( pxConnectionsArray != NULL );
|
||||||
configASSERT( pulOutCharsWritten != NULL );
|
configASSERT( pxOutCharsWritten != NULL );
|
||||||
|
|
||||||
/* Write the JSON array open marker. */
|
/* Write the JSON array open marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -298,11 +300,11 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write the array elements. */
|
/* Write the array elements. */
|
||||||
for( i = 0; ( ( i < ulConnectionsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
for( i = 0; ( ( i < xConnectionsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||||
{
|
{
|
||||||
pxConn = &( pxConnectionsArray[ i ] );
|
pxConn = &( pxConnectionsArray[ i ] );
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_CONNECTION_OBJECT_FORMAT,
|
reportbuilderJSON_CONNECTION_OBJECT_FORMAT,
|
||||||
pxConn->usLocalPort,
|
pxConn->usLocalPort,
|
||||||
( pxConn->ulRemoteIp >> 24 ) & 0xFF,
|
( pxConn->ulRemoteIp >> 24 ) & 0xFF,
|
||||||
@ -311,13 +313,13 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
|||||||
( pxConn->ulRemoteIp ) & 0xFF,
|
( pxConn->ulRemoteIp ) & 0xFF,
|
||||||
pxConn->usRemotePort );
|
pxConn->usRemotePort );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,19 +327,19 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
/* Discard the last comma. */
|
/* Discard the last comma. */
|
||||||
if( ulConnectionsArrayLength > 0 )
|
if( xConnectionsArrayLength > 0 )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos -= 1;
|
pcCurrentWritePos -= 1;
|
||||||
ulRemainingBufferLength += 1;
|
xRemainingBufferLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the JSON array close marker. */
|
/* Write the JSON array close marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
*pulOutCharsWritten = ulBufferLength - ulRemainingBufferLength;
|
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -350,25 +352,26 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const uint32_t * pulTaskIdArray,
|
const TaskStatus_t * pxTaskStatusArray,
|
||||||
uint32_t pulTaskIdArrayLength,
|
size_t xTaskStatusArrayLength,
|
||||||
uint32_t * pulOutCharsWritten )
|
size_t * pxOutCharsWritten )
|
||||||
{
|
{
|
||||||
char * pcCurrentWritePos = pcBuffer;
|
char * pcCurrentWritePos = pcBuffer;
|
||||||
uint32_t i, ulRemainingBufferLength = ulBufferLength;
|
uint32_t i;
|
||||||
|
size_t xRemainingBufferLength = xBufferLength;
|
||||||
int32_t lCharactersWritten;
|
int32_t lCharactersWritten;
|
||||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||||
|
|
||||||
configASSERT( pcBuffer != NULL );
|
configASSERT( pcBuffer != NULL );
|
||||||
configASSERT( pulTaskIdArray != NULL );
|
configASSERT( pxTaskStatusArray != NULL );
|
||||||
configASSERT( pulOutCharsWritten != NULL );
|
configASSERT( pxOutCharsWritten != NULL );
|
||||||
|
|
||||||
/* Write the JSON array open marker. */
|
/* Write the JSON array open marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -377,20 +380,20 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write the array elements. */
|
/* Write the array elements. */
|
||||||
for( i = 0; ( ( i < pulTaskIdArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
for( i = 0; ( ( i < xTaskStatusArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
"%u,",
|
"%u,",
|
||||||
pulTaskIdArray[ i ] );
|
pxTaskStatusArray[ i ].xTaskNumber );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= ( uint32_t ) lCharactersWritten;
|
xRemainingBufferLength -= ( uint32_t ) lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,19 +401,19 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
/* Discard the last comma. */
|
/* Discard the last comma. */
|
||||||
if( pulTaskIdArrayLength > 0 )
|
if( xTaskStatusArrayLength > 0 )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos -= 1;
|
pcCurrentWritePos -= 1;
|
||||||
ulRemainingBufferLength += 1;
|
xRemainingBufferLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the JSON array close marker. */
|
/* Write the JSON array close marker. */
|
||||||
if( ulRemainingBufferLength > 1 )
|
if( xRemainingBufferLength > 1 )
|
||||||
{
|
{
|
||||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||||
ulRemainingBufferLength -= 1;
|
xRemainingBufferLength -= 1;
|
||||||
pcCurrentWritePos += 1;
|
pcCurrentWritePos += 1;
|
||||||
*pulOutCharsWritten = ulBufferLength - ulRemainingBufferLength;
|
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -423,35 +426,35 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const ReportMetrics_t * pxMetrics,
|
const ReportMetrics_t * pxMetrics,
|
||||||
uint32_t ulMajorReportVersion,
|
uint32_t ulMajorReportVersion,
|
||||||
uint32_t ulMinorReportVersion,
|
uint32_t ulMinorReportVersion,
|
||||||
uint32_t ulReportId,
|
uint32_t ulReportId,
|
||||||
uint32_t * pulOutReportLength )
|
size_t * pxOutReportLength )
|
||||||
{
|
{
|
||||||
char * pcCurrentWritePos = pcBuffer;
|
char * pcCurrentWritePos = pcBuffer;
|
||||||
uint32_t ulRemainingBufferLength = ulBufferLength;
|
size_t xRemainingBufferLength = xBufferLength;
|
||||||
uint32_t bufferWritten;
|
uint32_t bufferWritten;
|
||||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||||
int32_t lCharactersWritten;
|
int32_t lCharactersWritten;
|
||||||
|
|
||||||
configASSERT( pcBuffer != NULL );
|
configASSERT( pcBuffer != NULL );
|
||||||
configASSERT( pxMetrics != NULL );
|
configASSERT( pxMetrics != NULL );
|
||||||
configASSERT( pulOutReportLength != NULL );
|
configASSERT( pxOutReportLength != NULL );
|
||||||
configASSERT( ulBufferLength != 0 );
|
configASSERT( xBufferLength != 0 );
|
||||||
|
|
||||||
if( ( pcBuffer == NULL ) ||
|
if( ( pcBuffer == NULL ) ||
|
||||||
( ulBufferLength == 0 ) ||
|
( xBufferLength == 0 ) ||
|
||||||
( pxMetrics == NULL ) ||
|
( pxMetrics == NULL ) ||
|
||||||
( pulOutReportLength == NULL ) )
|
( pxOutReportLength == NULL ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Invalid parameters. pcBuffer: %p, ulBufferLength: %u"
|
LogError( ( "Invalid parameters. pcBuffer: %p, xBufferLength: %u"
|
||||||
" pMetrics: %p, pOutReprotLength: %p.",
|
" pMetrics: %p, pOutReprotLength: %p.",
|
||||||
pcBuffer,
|
pcBuffer,
|
||||||
ulBufferLength,
|
xBufferLength,
|
||||||
pxMetrics,
|
pxMetrics,
|
||||||
pulOutReportLength ) );
|
pxOutReportLength ) );
|
||||||
eStatus = eReportBuilderBadParameter;
|
eStatus = eReportBuilderBadParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,20 +462,20 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_REPORT_FORMAT_PART1,
|
reportbuilderJSON_REPORT_FORMAT_PART1,
|
||||||
ulReportId,
|
ulReportId,
|
||||||
ulMajorReportVersion,
|
ulMajorReportVersion,
|
||||||
ulMinorReportVersion );
|
ulMinorReportVersion );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to write part 1." ) );
|
LogError( ( "Failed to write part 1." ) );
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,15 +484,15 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
eStatus = prvWritePortsArray( pcCurrentWritePos,
|
eStatus = prvWritePortsArray( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
pxMetrics->pusOpenTcpPortsArray,
|
pxMetrics->pusOpenTcpPortsArray,
|
||||||
pxMetrics->ulOpenTcpPortsArrayLength,
|
pxMetrics->xOpenTcpPortsArrayLength,
|
||||||
&( bufferWritten ) );
|
&( bufferWritten ) );
|
||||||
|
|
||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos += bufferWritten;
|
pcCurrentWritePos += bufferWritten;
|
||||||
ulRemainingBufferLength -= bufferWritten;
|
xRemainingBufferLength -= bufferWritten;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -501,18 +504,18 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_REPORT_FORMAT_PART2,
|
reportbuilderJSON_REPORT_FORMAT_PART2,
|
||||||
pxMetrics->ulOpenTcpPortsArrayLength );
|
pxMetrics->xOpenTcpPortsArrayLength );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to write part 2." ) );
|
LogError( ( "Failed to write part 2." ) );
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,15 +524,15 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
eStatus = prvWritePortsArray( pcCurrentWritePos,
|
eStatus = prvWritePortsArray( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
pxMetrics->pusOpenUdpPortsArray,
|
pxMetrics->pusOpenUdpPortsArray,
|
||||||
pxMetrics->ulOpenUdpPortsArrayLength,
|
pxMetrics->xOpenUdpPortsArrayLength,
|
||||||
&( bufferWritten ) );
|
&( bufferWritten ) );
|
||||||
|
|
||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos += bufferWritten;
|
pcCurrentWritePos += bufferWritten;
|
||||||
ulRemainingBufferLength -= bufferWritten;
|
xRemainingBufferLength -= bufferWritten;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -541,23 +544,23 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_REPORT_FORMAT_PART3,
|
reportbuilderJSON_REPORT_FORMAT_PART3,
|
||||||
pxMetrics->ulOpenUdpPortsArrayLength,
|
pxMetrics->xOpenUdpPortsArrayLength,
|
||||||
pxMetrics->pxNetworkStats->ulBytesReceived,
|
pxMetrics->pxNetworkStats->ulBytesReceived,
|
||||||
pxMetrics->pxNetworkStats->ulBytesSent,
|
pxMetrics->pxNetworkStats->ulBytesSent,
|
||||||
pxMetrics->pxNetworkStats->ulPacketsReceived,
|
pxMetrics->pxNetworkStats->ulPacketsReceived,
|
||||||
pxMetrics->pxNetworkStats->ulPacketsSent,
|
pxMetrics->pxNetworkStats->ulPacketsSent,
|
||||||
DEFENDER_REPORT_ESTABLISHED_CONNECTIONS_KEY );
|
DEFENDER_REPORT_ESTABLISHED_CONNECTIONS_KEY );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to write part 3." ) );
|
LogError( ( "Failed to write part 3." ) );
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,15 +569,15 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
eStatus = prvWriteConnectionsArray( pcCurrentWritePos,
|
eStatus = prvWriteConnectionsArray( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
pxMetrics->pxEstablishedConnectionsArray,
|
pxMetrics->pxEstablishedConnectionsArray,
|
||||||
pxMetrics->ulEstablishedConnectionsArrayLength,
|
pxMetrics->xEstablishedConnectionsArrayLength,
|
||||||
&( bufferWritten ) );
|
&( bufferWritten ) );
|
||||||
|
|
||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos += bufferWritten;
|
pcCurrentWritePos += bufferWritten;
|
||||||
ulRemainingBufferLength -= bufferWritten;
|
xRemainingBufferLength -= bufferWritten;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -586,19 +589,19 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_REPORT_FORMAT_PART4,
|
reportbuilderJSON_REPORT_FORMAT_PART4,
|
||||||
pxMetrics->ulEstablishedConnectionsArrayLength,
|
pxMetrics->xEstablishedConnectionsArrayLength,
|
||||||
pxMetrics->ulStackHighWaterMark );
|
pxMetrics->ulStackHighWaterMark );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to write part 4." ) );
|
LogError( ( "Failed to write part 4." ) );
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -607,15 +610,15 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
eStatus = prvWriteTaskIdArray( pcCurrentWritePos,
|
eStatus = prvWriteTaskIdArray( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
pxMetrics->pulTaskIdArray,
|
pxMetrics->pxTaskStatusArray,
|
||||||
pxMetrics->ulTaskIdArrayLength,
|
pxMetrics->xTaskStatusArrayLength,
|
||||||
&( bufferWritten ) );
|
&( bufferWritten ) );
|
||||||
|
|
||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
pcCurrentWritePos += bufferWritten;
|
pcCurrentWritePos += bufferWritten;
|
||||||
ulRemainingBufferLength -= bufferWritten;
|
xRemainingBufferLength -= bufferWritten;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -627,19 +630,19 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
|||||||
if( eStatus == eReportBuilderSuccess )
|
if( eStatus == eReportBuilderSuccess )
|
||||||
{
|
{
|
||||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||||
ulRemainingBufferLength,
|
xRemainingBufferLength,
|
||||||
reportbuilderJSON_REPORT_FORMAT_PART5 );
|
reportbuilderJSON_REPORT_FORMAT_PART5 );
|
||||||
|
|
||||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, ulRemainingBufferLength ) )
|
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||||
{
|
{
|
||||||
LogError( ( "Failed to write part 5." ) );
|
LogError( ( "Failed to write part 5." ) );
|
||||||
eStatus = eReportBuilderBufferTooSmall;
|
eStatus = eReportBuilderBufferTooSmall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ulRemainingBufferLength -= lCharactersWritten;
|
xRemainingBufferLength -= lCharactersWritten;
|
||||||
pcCurrentWritePos += lCharactersWritten;
|
pcCurrentWritePos += lCharactersWritten;
|
||||||
*pulOutReportLength = ulBufferLength - ulRemainingBufferLength;
|
*pxOutReportLength = xBufferLength - xRemainingBufferLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ typedef struct ReportMetrics
|
|||||||
{
|
{
|
||||||
NetworkStats_t * pxNetworkStats;
|
NetworkStats_t * pxNetworkStats;
|
||||||
uint16_t * pusOpenTcpPortsArray;
|
uint16_t * pusOpenTcpPortsArray;
|
||||||
uint32_t ulOpenTcpPortsArrayLength;
|
size_t xOpenTcpPortsArrayLength;
|
||||||
uint16_t * pusOpenUdpPortsArray;
|
uint16_t * pusOpenUdpPortsArray;
|
||||||
uint32_t ulOpenUdpPortsArrayLength;
|
size_t xOpenUdpPortsArrayLength;
|
||||||
Connection_t * pxEstablishedConnectionsArray;
|
Connection_t * pxEstablishedConnectionsArray;
|
||||||
uint32_t ulEstablishedConnectionsArrayLength;
|
size_t xEstablishedConnectionsArrayLength;
|
||||||
/* Custom metrics */
|
/* Custom metrics */
|
||||||
uint32_t ulStackHighWaterMark;
|
uint32_t ulStackHighWaterMark;
|
||||||
uint32_t * pulTaskIdArray;
|
TaskStatus_t * pxTaskStatusArray;
|
||||||
uint32_t ulTaskIdArrayLength;
|
size_t xTaskStatusArrayLength;
|
||||||
} ReportMetrics_t;
|
} ReportMetrics_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,23 +69,23 @@ typedef struct ReportMetrics
|
|||||||
* Service.
|
* Service.
|
||||||
*
|
*
|
||||||
* @param[in] pcBuffer The buffer to write the report into.
|
* @param[in] pcBuffer The buffer to write the report into.
|
||||||
* @param[in] ulBufferLength The length of the buffer.
|
* @param[in] xBufferLength The length of the buffer.
|
||||||
* @param[in] pxMetrics Metrics to write in the generated report.
|
* @param[in] pxMetrics Metrics to write in the generated report.
|
||||||
* @param[in] ulMajorReportVersion Major version of the report.
|
* @param[in] ulMajorReportVersion Major version of the report.
|
||||||
* @param[in] ulMinorReportVersion Minor version of the report.
|
* @param[in] ulMinorReportVersion Minor version of the report.
|
||||||
* @param[in] ulReportId Value to be used as the ulReportId in the generated report.
|
* @param[in] ulReportId Value to be used as the ulReportId in the generated report.
|
||||||
* @param[out] pulOutReprotLength The length of the generated report.
|
* @param[out] pxOutReprotLength The length of the generated report.
|
||||||
*
|
*
|
||||||
* @return #ReportBuilderSuccess if the report is successfully generated;
|
* @return #ReportBuilderSuccess if the report is successfully generated;
|
||||||
* #ReportBuilderBadParameter if invalid parameters are passed;
|
* #ReportBuilderBadParameter if invalid parameters are passed;
|
||||||
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full report.
|
* #ReportBuilderBufferTooSmall if the buffer cannot hold the full report.
|
||||||
*/
|
*/
|
||||||
eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||||
uint32_t ulBufferLength,
|
size_t xBufferLength,
|
||||||
const ReportMetrics_t * pxMetrics,
|
const ReportMetrics_t * pxMetrics,
|
||||||
uint32_t ulMajorReportVersion,
|
uint32_t ulMajorReportVersion,
|
||||||
uint32_t ulMinorReportVersion,
|
uint32_t ulMinorReportVersion,
|
||||||
uint32_t ulReportId,
|
uint32_t ulReportId,
|
||||||
uint32_t * pulOutReportLength );
|
size_t * pxOutReportLength );
|
||||||
|
|
||||||
#endif /* ifndef REPORT_BUILDER_H_ */
|
#endif /* ifndef REPORT_BUILDER_H_ */
|
||||||
|
28
lexicon.txt
28
lexicon.txt
@ -1675,6 +1675,7 @@ prvcheckothertasksarestillrunning
|
|||||||
prvchecktask
|
prvchecktask
|
||||||
prvchecktaskcounters
|
prvchecktaskcounters
|
||||||
prvchecktimercallback
|
prvchecktimercallback
|
||||||
|
prvcollectdevicemetrics
|
||||||
prvcomtxtimercallback
|
prvcomtxtimercallback
|
||||||
prvconnectandcreatedemotasks
|
prvconnectandcreatedemotasks
|
||||||
prvcopycommand
|
prvcopycommand
|
||||||
@ -1703,6 +1704,7 @@ prvfirstregtesttask
|
|||||||
prvflashcoroutine
|
prvflashcoroutine
|
||||||
prvflashtimercallback
|
prvflashtimercallback
|
||||||
prvformatcommand
|
prvformatcommand
|
||||||
|
prvgeneratedevicemetricsreport
|
||||||
prvgetdisinheritpriorityaftertimeout
|
prvgetdisinheritpriorityaftertimeout
|
||||||
prvgetnextdelaytime
|
prvgetnextdelaytime
|
||||||
prvgettcbfromhandle
|
prvgettcbfromhandle
|
||||||
@ -1899,11 +1901,8 @@ pulmemchecktaskrunningcounter
|
|||||||
pulnotification
|
pulnotification
|
||||||
pulnotifiedvalue
|
pulnotifiedvalue
|
||||||
pulnumber
|
pulnumber
|
||||||
puloutcharswritten
|
|
||||||
puloutnumestablishedconnections
|
puloutnumestablishedconnections
|
||||||
puloutnumtcpopenports
|
|
||||||
puloutnumudpopenports
|
puloutnumudpopenports
|
||||||
puloutreportlength
|
|
||||||
puloutreprotlength
|
puloutreprotlength
|
||||||
pulstandardperipheralregister
|
pulstandardperipheralregister
|
||||||
pulsystemperipheralregister
|
pulsystemperipheralregister
|
||||||
@ -1912,7 +1911,6 @@ pultaskidarraylength
|
|||||||
pultaskidsarray
|
pultaskidsarray
|
||||||
pusername
|
pusername
|
||||||
pusopenportsarray
|
pusopenportsarray
|
||||||
pusoutnumestablishedconnections
|
|
||||||
pusouttcpportsarray
|
pusouttcpportsarray
|
||||||
pusoutudpportsarray
|
pusoutudpportsarray
|
||||||
putc
|
putc
|
||||||
@ -1969,8 +1967,14 @@ pxnetworkcontext
|
|||||||
pxnetworkcredentials
|
pxnetworkcredentials
|
||||||
pxnext
|
pxnext
|
||||||
pxopenedinterfacehandle
|
pxopenedinterfacehandle
|
||||||
|
pxoutcharswritten
|
||||||
pxoutconnectionsarray
|
pxoutconnectionsarray
|
||||||
pxoutnetworkstats
|
pxoutnetworkstats
|
||||||
|
pxoutnumestablishedconnections
|
||||||
|
pxoutnumtcpopenports
|
||||||
|
pxoutnumudpopenports
|
||||||
|
pxoutreportlength
|
||||||
|
pxoutreprotlength
|
||||||
pxpacketinfo
|
pxpacketinfo
|
||||||
pxpathlen
|
pxpathlen
|
||||||
pxport
|
pxport
|
||||||
@ -1987,6 +1991,7 @@ pxstaticstreambuffer
|
|||||||
pxstreambuffer
|
pxstreambuffer
|
||||||
pxsubscriptionlist
|
pxsubscriptionlist
|
||||||
pxtaskbuffer
|
pxtaskbuffer
|
||||||
|
pxtaskstatusarray
|
||||||
pxtcb
|
pxtcb
|
||||||
pxtickstowait
|
pxtickstowait
|
||||||
pxtimeout
|
pxtimeout
|
||||||
@ -2532,14 +2537,12 @@ ulbytesreceived
|
|||||||
ulbytessent
|
ulbytessent
|
||||||
ulcalculatedvalue
|
ulcalculatedvalue
|
||||||
ulcallcount
|
ulcallcount
|
||||||
ulconnectionsarraylength
|
|
||||||
ulcoursecyclecounter
|
ulcoursecyclecounter
|
||||||
ulcurrentversion
|
ulcurrentversion
|
||||||
ulcyclecount
|
ulcyclecount
|
||||||
ulcyclecounter
|
ulcyclecounter
|
||||||
ulcyclecounters
|
ulcyclecounters
|
||||||
uldata
|
uldata
|
||||||
uldefenderresponselength
|
|
||||||
uldemosoftwaretimercounter
|
uldemosoftwaretimercounter
|
||||||
uldigestlength
|
uldigestlength
|
||||||
uldirection
|
uldirection
|
||||||
@ -2590,7 +2593,6 @@ ulnotificationvalue
|
|||||||
ulnotifiedvalue
|
ulnotifiedvalue
|
||||||
uloffset
|
uloffset
|
||||||
ulong
|
ulong
|
||||||
ulopenportsarraylength
|
|
||||||
ulpacketsreceived
|
ulpacketsreceived
|
||||||
ulpacketssent
|
ulpacketssent
|
||||||
ulport
|
ulport
|
||||||
@ -2605,7 +2607,6 @@ ulreloadvalue
|
|||||||
ulreloadvalueforonehighresolutiontick
|
ulreloadvalueforonehighresolutiontick
|
||||||
ulremoteipaddress
|
ulremoteipaddress
|
||||||
ulreportid
|
ulreportid
|
||||||
ulreportlength
|
|
||||||
ulrestartoffset
|
ulrestartoffset
|
||||||
ulreturned
|
ulreturned
|
||||||
ulsecondnotificationvalueconst
|
ulsecondnotificationvalueconst
|
||||||
@ -2624,14 +2625,12 @@ ultaskendtrace
|
|||||||
ultasknotifytake
|
ultasknotifytake
|
||||||
ultasknotifytakeindexed
|
ultasknotifytakeindexed
|
||||||
ultasknotifyvalueclearindexed
|
ultasknotifyvalueclearindexed
|
||||||
ultcpportsarraylength
|
|
||||||
ultim
|
ultim
|
||||||
ultimeoutms
|
ultimeoutms
|
||||||
ultimer
|
ultimer
|
||||||
ultotalframelength
|
ultotalframelength
|
||||||
ultrascale
|
ultrascale
|
||||||
ultx
|
ultx
|
||||||
uludpportsarraylength
|
|
||||||
ulvaluetosend
|
ulvaluetosend
|
||||||
ulwantedbaud
|
ulwantedbaud
|
||||||
umount
|
umount
|
||||||
@ -2690,6 +2689,7 @@ usport
|
|||||||
usportnumber
|
usportnumber
|
||||||
usremoteport
|
usremoteport
|
||||||
usstackdepth
|
usstackdepth
|
||||||
|
usstackhighwatermark
|
||||||
usstacksize
|
usstacksize
|
||||||
ustaskstacksize
|
ustaskstacksize
|
||||||
usthingnamelength
|
usthingnamelength
|
||||||
@ -2987,6 +2987,7 @@ xcommand
|
|||||||
xcommandqueue
|
xcommandqueue
|
||||||
xcomporthandle
|
xcomporthandle
|
||||||
xconnectedsocket
|
xconnectedsocket
|
||||||
|
xconnectionsarraylength
|
||||||
xcontrolmessagebuffer
|
xcontrolmessagebuffer
|
||||||
xcorebmessagebuffers
|
xcorebmessagebuffers
|
||||||
xcreatedtask
|
xcreatedtask
|
||||||
@ -2995,12 +2996,14 @@ xcurbyte
|
|||||||
xdatalength
|
xdatalength
|
||||||
xdatamessagebuffers
|
xdatamessagebuffers
|
||||||
xdb
|
xdb
|
||||||
|
xdefenderresponselength
|
||||||
xdelayticks
|
xdelayticks
|
||||||
xdeleteresponsereceived
|
xdeleteresponsereceived
|
||||||
xdeletetaskstack
|
xdeletetaskstack
|
||||||
xdeltams
|
xdeltams
|
||||||
xdemotimer
|
xdemotimer
|
||||||
xdestinationaddress
|
xdestinationaddress
|
||||||
|
xdevicemetrics
|
||||||
xdigitcountertimer
|
xdigitcountertimer
|
||||||
xdirectprint
|
xdirectprint
|
||||||
xdolisten
|
xdolisten
|
||||||
@ -3130,6 +3133,7 @@ xnumbytessenttotal
|
|||||||
xnumreqbytes
|
xnumreqbytes
|
||||||
xoktogivemutex
|
xoktogivemutex
|
||||||
xoneshottimer
|
xoneshottimer
|
||||||
|
xopenportsarraylength
|
||||||
xoptionlength
|
xoptionlength
|
||||||
xor
|
xor
|
||||||
xosel
|
xosel
|
||||||
@ -3225,6 +3229,7 @@ xregtesterror
|
|||||||
xregteststacksize
|
xregteststacksize
|
||||||
xregteststatus
|
xregteststatus
|
||||||
xregulatoroffidletime
|
xregulatoroffidletime
|
||||||
|
xreportlength
|
||||||
xreportstatus
|
xreportstatus
|
||||||
xrequest
|
xrequest
|
||||||
xresponsecount
|
xresponsecount
|
||||||
@ -3328,12 +3333,14 @@ xtaskresumeall
|
|||||||
xtaskresumeallcallback
|
xtaskresumeallcallback
|
||||||
xtaskresumeallstub
|
xtaskresumeallstub
|
||||||
xtasksocket
|
xtasksocket
|
||||||
|
xtaskstatusarraylength
|
||||||
xtaskswaitingtoreceive
|
xtaskswaitingtoreceive
|
||||||
xtaskswaitingtosend
|
xtaskswaitingtosend
|
||||||
xtasktodelete
|
xtasktodelete
|
||||||
xtasktonotify
|
xtasktonotify
|
||||||
xtcbbuffer
|
xtcbbuffer
|
||||||
xtcp
|
xtcp
|
||||||
|
xtcpportsarraylength
|
||||||
xtcptestechoclientstaskparams
|
xtcptestechoclientstaskparams
|
||||||
xtea
|
xtea
|
||||||
xtensa
|
xtensa
|
||||||
@ -3369,6 +3376,7 @@ xtxdescriptors
|
|||||||
xtxhasended
|
xtxhasended
|
||||||
xtxmessages
|
xtxmessages
|
||||||
xtxtcbbuffer
|
xtxtcbbuffer
|
||||||
|
xudpportsarraylength
|
||||||
xupdatedmessagebuffer
|
xupdatedmessagebuffer
|
||||||
xurllen
|
xurllen
|
||||||
xurlparser
|
xurlparser
|
||||||
|
Reference in New Issue
Block a user