

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# AWS IoT Device Defender 库
<a name="afr-device-defender-library"></a>

**注意**  <a name="out-of-date-message"></a>
此页面上的内容可能不是最新的。有关最新更新，请参阅 [FreeRTOS.org 库页面](https://www.freertos.org/Documentation/03-Libraries/01-Library-overview/01-All-libraries)。

## 简介
<a name="freertos-defender-introduction"></a>

您可以使用 AWS IoT Device Defender 库从 IoT 设备将安全指标发送给 AWS IoT Device Defender。您可以使用 AWS IoT Device Defender 来持续监控设备的这些安全指标，以确定是否与您为每台设备定义的适当行为存在偏差。如果发现有问题，AWS IoT Device Defender 会发出警报，以便您采取措施来解决问题。使用 [MQTT](https://freertos.org/mqtt/index.html) 与 AWS IoT Device Defender 交互（一种轻量级的发布-订阅协议）。该库提供了一个 API 来编写和识别 AWS IoT Device Defender 使用的 MQTT 主题字符串。

 有关更多信息，请参阅 *AWS IoT 开发人员指南*中的 [AWS IoT Device Defender](https://docs.aws.amazon.com/iot/latest/developerguide/device-defender.html)。

该库使用 C 语言编写，设计符合 [ISO C90](https://en.wikipedia.org/wiki/ANSI_C#C90) 和 [MISRA C:2012](https://misra.org.uk/product/misra-c2012-third-edition-first-revision/)。除了标准 C 库之外，该库不依赖于任何其他库。该库没有平台依赖关系，例如线程或同步。它可以与任何 MQTT 库以及任何 [JSON](https://freertos.org/json/json-terminology.html) 或 [CBOR](https://cbor.io/) 库一起使用。该库有[证据](https://www.cprover.org/cbmc/)表明内存使用安全，没有堆分配，因此适用于 IoT 微控制器，但也完全可移植到其他平台。

AWS IoT Device Defender 库可免费使用，并根据 [MIT 开源许可证](https://freertos.org/a00114.html)分发。


****  

| AWS IoT Device Defender 的代码大小（使用 GCC for ARM Cortex-M 生成的示例） | 文件 | 使用 -O1 优化 | 使用 -Os 优化 | 
| --- | --- | --- | --- | 
| defender.c | 1.1K | 0.6K | 
| 估计总数 | 1.1K | 0.6K | 