|
AWS IoT Device SDK C:
Defender
AWS IoT Device Defender library
|
| Return to main page ↑ |
User-facing functions and structs of AWS IoT Device Defender library. More...
Go to the source code of this file.
Data Structures | |
| struct | AwsIotDefenderCallbackInfo_t |
| Callback parameters. More... | |
| struct | AwsIotDefenderCallback_t |
| User provided callback handle. More... | |
| struct | AwsIotDefenderStartInfo_t |
| Parameters of AwsIotDefender_Start function. More... | |
Macros | |
Serialization Format | |
| #define | AWS_IOT_DEFENDER_FORMAT_CBOR 1 |
| #define | AWS_IOT_DEFENDER_FORMAT_JSON 2 |
Metrics Flags | |
Bit flags or metrics used by AwsIotDefender_SetMetrics function. These metrics are subset of metrics supported by AWS IoT Device Defender service. For details, refer to developer document of AWS IoT Device Defender. | |
| #define | AWS_IOT_DEFENDER_METRICS_ALL 0xffffffff |
| #define | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_TOTAL 0x00000001 |
| #define | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_REMOTE_ADDR 0x00000004 |
| #define | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_CONNECTIONS ( AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_REMOTE_ADDR ) \ |
| #define | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED ( AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_CONNECTIONS | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_TOTAL ) \ |
Initializers | |
| #define | AWS_IOT_DEFENDER_CALLBACK_INITIALIZER |
| #define | AWS_IOT_DEFENDER_START_INFO_INITIALIZER |
Enumerations | |
| enum | AwsIotDefenderMetricsGroup_t { AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS } |
| Metrics group options for AwsIotDefender_SetMetrics() function. More... | |
| enum | AwsIotDefenderError_t { AWS_IOT_DEFENDER_SUCCESS = 0, AWS_IOT_DEFENDER_INVALID_INPUT, AWS_IOT_DEFENDER_ALREADY_STARTED, AWS_IOT_DEFENDER_PERIOD_TOO_SHORT, AWS_IOT_DEFENDER_ERROR_NO_MEMORY, AWS_IOT_DEFENDER_INTERNAL_FAILURE } |
| Return codes of defender functions. More... | |
| enum | AwsIotDefenderEventType_t { AWS_IOT_DEFENDER_METRICS_ACCEPTED = 0, AWS_IOT_DEFENDER_METRICS_REJECTED, AWS_IOT_DEFENDER_FAILURE_MQTT, AWS_IOT_DEFENDER_FAILURE_METRICS_REPORT } |
| Event codes passed into AwsIotDefenderCallbackInfo_t. More... | |
Functions | |
| AwsIotDefenderError_t | AwsIotDefender_SetMetrics (AwsIotDefenderMetricsGroup_t metricsGroup, uint32_t metrics) |
| Set metrics that defender agent needs to collect for a metrics group. More... | |
| AwsIotDefenderError_t | AwsIotDefender_Start (AwsIotDefenderStartInfo_t *pStartInfo) |
| Start the defender agent. More... | |
| void | AwsIotDefender_Stop (void) |
| Stop the defender agent. More... | |
| AwsIotDefenderError_t | AwsIotDefender_SetPeriod (uint32_t periodSeconds) |
| Set period in seconds. More... | |
| uint32_t | AwsIotDefender_GetPeriod (void) |
| Get period in seconds. More... | |
| const char * | AwsIotDefender_strerror (AwsIotDefenderError_t error) |
| Return a string that describes AwsIotDefenderError_t. More... | |
| const char * | AwsIotDefender_EventType (AwsIotDefenderEventType_t eventType) |
| Return a string that describes AwsIotDefenderEventType_t. More... | |
User-facing functions and structs of AWS IoT Device Defender library.
| #define AWS_IOT_DEFENDER_FORMAT_CBOR 1 |
CBOR format.
| #define AWS_IOT_DEFENDER_FORMAT_JSON 2 |
JSON format (NOT supported).
| #define AWS_IOT_DEFENDER_METRICS_ALL 0xffffffff |
Flag to indicate including all metrics.
| #define AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_TOTAL 0x00000001 |
Total count of established TCP connections.
| #define AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_REMOTE_ADDR 0x00000004 |
Remote address (IP:port) of established TCP connections. For example, 192.168.0.1:8000.
| #define AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_CONNECTIONS ( AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_REMOTE_ADDR ) \ |
Connections metrics including only remote address. Local port number is not supported.
| #define AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED ( AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_CONNECTIONS | AWS_IOT_DEFENDER_METRICS_TCP_CONNECTIONS_ESTABLISHED_TOTAL ) \ |
Established connections metrics including connections metrics and total count.
| #define AWS_IOT_DEFENDER_CALLBACK_INITIALIZER |
Initializer of AwsIotDefenderCallback_t.
| #define AWS_IOT_DEFENDER_START_INFO_INITIALIZER |
Initializer of AwsIotDefenderStartInfo_t.
| AwsIotDefenderError_t AwsIotDefender_SetMetrics | ( | AwsIotDefenderMetricsGroup_t | metricsGroup, |
| uint32_t | metrics | ||
| ) |
Set metrics that defender agent needs to collect for a metrics group.
| [in] | metricsGroup | Metrics group defined in AwsIotDefenderMetricsGroup_t |
| [in] | metrics | Bit-flags to specify what metrics to collect. If all metrics in a group is needed, simply set metrics to AWS_IOT_DEFENDER_METRICS_ALL. See Metrics flags for details. |
| AwsIotDefenderError_t AwsIotDefender_Start | ( | AwsIotDefenderStartInfo_t * | pStartInfo | ) |
Start the defender agent.
| [in] | pStartInfo | Pointer of parameters of start function |
Periodically, defender agent collects metrics and publish to specific AWS reserved MQTT topic.
Example:
| void AwsIotDefender_Stop | ( | void | ) |
Stop the defender agent.
It waits for the current metrics-publishing iteration to finish before freeing the resource allocated. It also clears the metrics set previously so that user is expected to SetMetrics again before restarting defender agent.
| AwsIotDefenderError_t AwsIotDefender_SetPeriod | ( | uint32_t | periodSeconds | ) |
Set period in seconds.
| [in] | periodSeconds | Period is specified in seconds. Minimum is 300 (5 minutes) |
| uint32_t AwsIotDefender_GetPeriod | ( | void | ) |
Get period in seconds.
| const char* AwsIotDefender_strerror | ( | AwsIotDefenderError_t | error | ) |
Return a string that describes AwsIotDefenderError_t.
| const char* AwsIotDefender_EventType | ( | AwsIotDefenderEventType_t | eventType | ) |
Return a string that describes AwsIotDefenderEventType_t.