28 #ifndef AWS_IOT_DEFENDER_INTERNAL_H_ 29 #define AWS_IOT_DEFENDER_INTERNAL_H_ 32 #include "iot_config.h" 38 #include "iot_serializer.h" 55 #if AWS_IOT_DEFENDER_ENABLE_ASSERTS == 1 56 #ifndef AwsIotDefender_Assert 57 #ifdef Iot_DefaultAssert 58 #define AwsIotDefender_Assert( expression ) Iot_DefaultAssert( expression ) 60 #error "Asserts are enabled for Defender, but AwsIotDefender_Assert is not defined" 64 #define AwsIotDefender_Assert( expression ) 68 #ifdef AWS_IOT_LOG_LEVEL_DEFENDER 69 #define LIBRARY_LOG_LEVEL AWS_IOT_LOG_LEVEL_DEFENDER 71 #ifdef AWS_IOT_LOG_LEVEL_GLOBAL 72 #define LIBRARY_LOG_LEVEL IOT_LOG_LEVEL_GLOBAL 74 #define LIBRARY_LOG_LEVEL IOT_LOG_NONE 78 #define LIBRARY_LOG_NAME ( "Defender" ) 85 #if IOT_STATIC_MEMORY_ONLY == 1 93 #define AwsIotDefender_MallocReport Iot_MallocMessageBuffer 100 #define AwsIotDefender_FreeReport Iot_FreeMessageBuffer 107 #define AwsIotDefender_MallocTopic Iot_MallocMessageBuffer 114 #define AwsIotDefender_FreeTopic Iot_FreeMessageBuffer 116 #ifndef AwsIotDefender_MallocReport 117 #ifdef Iot_DefaultMalloc 118 #define AwsIotDefender_MallocReport Iot_DefaultMalloc 120 #error "No malloc function defined for AwsIotDefender_MallocReport" 124 #ifndef AwsIotDefender_FreeReport 125 #ifdef Iot_DefaultFree 126 #define AwsIotDefender_FreeReport Iot_DefaultFree 128 #error "No free function defined for AwsIotDefender_FreeReport" 132 #ifndef AwsIotDefender_MallocTopic 133 #ifdef Iot_DefaultMalloc 134 #define AwsIotDefender_MallocTopic Iot_DefaultMalloc 136 #error "No malloc function defined for AwsIotDefender_MallocTopic" 140 #ifndef AwsIotDefender_FreeTopic 141 #ifdef Iot_DefaultFree 142 #define AwsIotDefender_FreeTopic Iot_DefaultFree 144 #error "No free function defined for AwsIotDefender_FreeTopic" 209 #ifndef AWS_IOT_DEFENDER_DEFAULT_PERIOD_SECONDS 210 #define AWS_IOT_DEFENDER_DEFAULT_PERIOD_SECONDS ( 300 ) 213 #ifndef AWS_IOT_DEFENDER_WAIT_SERVER_MAX_SECONDS 214 #define AWS_IOT_DEFENDER_WAIT_SERVER_MAX_SECONDS ( 3 ) 217 #ifndef AWS_IOT_DEFENDER_MQTT_CONNECT_TIMEOUT_SECONDS 218 #define AWS_IOT_DEFENDER_MQTT_CONNECT_TIMEOUT_SECONDS ( 10U ) 221 #ifndef AWS_IOT_DEFENDER_MQTT_SUBSCRIBE_TIMEOUT_SECONDS 222 #define AWS_IOT_DEFENDER_MQTT_SUBSCRIBE_TIMEOUT_SECONDS ( 10U ) 225 #ifndef AWS_IOT_DEFENDER_MQTT_PUBLISH_TIMEOUT_SECONDS 226 #define AWS_IOT_DEFENDER_MQTT_PUBLISH_TIMEOUT_SECONDS ( 10U ) 229 #ifndef AWS_IOT_DEFENDER_FORMAT 230 #define AWS_IOT_DEFENDER_FORMAT AWS_IOT_DEFENDER_FORMAT_CBOR 234 #if AWS_IOT_DEFENDER_FORMAT == AWS_IOT_DEFENDER_FORMAT_JSON 235 #error "AWS_IOT_DEFENDER_FORMAT_JSON is not supported." 239 #ifndef AWS_IOT_DEFENDER_USE_LONG_TAG 240 #define AWS_IOT_DEFENDER_USE_LONG_TAG ( 0 ) 246 #define DEFENDER_METRICS_GROUP_COUNT 1 251 #if AWS_IOT_DEFENDER_FORMAT == AWS_IOT_DEFENDER_FORMAT_CBOR 252 #define DEFENDER_FORMAT "cbor" 254 #error "AWS_IOT_DEFENDER_FORMAT must be AWS_IOT_DEFENDER_FORMAT_CBOR." 260 #if AWS_IOT_DEFENDER_USE_LONG_TAG == 1 261 #define AwsIotDefenderInternal_SelectTag( long_tag, short_tag ) ( long_tag ) 263 #define AwsIotDefenderInternal_SelectTag( long_tag, short_tag ) ( short_tag ) 269 #define _defenderToMilliseconds( secondValue ) ( secondValue ) * 1000 270 #define _defenderToSeconds( millisecondValue ) \ 271 ( millisecondValue ) / 1000 \ 277 typedef struct _defenderMetrics
282 uint32_t metricsFlag[ DEFENDER_METRICS_GROUP_COUNT ];
295 bool AwsIotDefenderInternal_CreateReport(
void );
300 uint8_t * AwsIotDefenderInternal_GetReportBuffer(
void );
305 size_t AwsIotDefenderInternal_GetReportBufferSize(
void );
310 void AwsIotDefenderInternal_DeleteReport(
void );
320 void AwsIotDefenderInternal_DeleteTopicsNames(
void );
331 IotMqttError_t AwsIotDefenderInternal_MqttPublish( uint8_t * pData,
342 void AwsIotDefenderInternal_MqttDisconnect(
void );
348 extern const IotSerializerEncodeInterface_t * _pAwsIotDefenderEncoder;
349 extern const IotSerializerDecodeInterface_t * _pAwsIotDefenderDecoder;
User-facing functions and structs of AWS IoT Device Defender library.
AwsIotDefenderError_t
Return codes of defender functions.
Definition: aws_iot_defender.h:139
IotMutex_t mutex
Definition: aws_iot_defender_internal.h:289
Definition: aws_iot_defender_internal.h:277