From 9d585edc46999b82b30b8cf3e88901f8b271ab63 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 8 Aug 2018 11:19:41 -0700 Subject: [PATCH] [types] move types into specific headers (#2946) --- .appveyor/make_release.cmd | 2 +- configure.ac | 2 +- etc/visual-studio/libopenthread_k.vcxproj | 3 +- .../libopenthread_k.vcxproj.filters | 9 +- examples/apps/cli/main.c | 2 +- examples/apps/ncp/main.c | 2 +- examples/apps/windows/otAdapter.h | 1 - examples/drivers/windows/include/otLwfIoctl.h | 2 - examples/drivers/windows/include/otNode.h | 4 +- examples/drivers/windows/otApi/precomp.h | 2 +- examples/drivers/windows/otCli/main.cpp | 1 - examples/drivers/windows/otLwf/precomp.h | 1 - examples/drivers/windows/otNodeApi/precomp.h | 1 - examples/platforms/cc1352/alarm.c | 2 - examples/platforms/cc1352/diag.c | 1 - examples/platforms/cc1352/logging.c | 1 + examples/platforms/cc1352/misc.c | 1 - examples/platforms/cc1352/platform-cc1352.h | 2 +- examples/platforms/cc1352/radio.c | 2 - examples/platforms/cc1352/random.c | 1 - examples/platforms/cc1352/system.c | 1 - examples/platforms/cc1352/uart.c | 1 - examples/platforms/cc2538/alarm.c | 1 - examples/platforms/cc2538/diag.c | 1 - examples/platforms/cc2538/logging.c | 1 + examples/platforms/cc2538/misc.c | 1 - examples/platforms/cc2538/platform-cc2538.h | 3 +- examples/platforms/cc2538/radio.c | 1 - examples/platforms/cc2538/random.c | 1 - examples/platforms/cc2538/uart.c | 1 - examples/platforms/cc2650/alarm.c | 1 - examples/platforms/cc2650/flash.c | 2 + examples/platforms/cc2650/logging.c | 1 + examples/platforms/cc2650/misc.c | 1 - examples/platforms/cc2650/platform-cc2650.h | 2 +- examples/platforms/cc2650/radio.c | 2 - examples/platforms/cc2650/random.c | 1 - examples/platforms/cc2650/system.c | 1 - examples/platforms/cc2650/uart.c | 1 - examples/platforms/cc2652/alarm.c | 2 - examples/platforms/cc2652/diag.c | 1 - examples/platforms/cc2652/logging.c | 1 + examples/platforms/cc2652/misc.c | 1 - examples/platforms/cc2652/platform-cc2652.h | 2 +- examples/platforms/cc2652/radio.c | 2 - examples/platforms/cc2652/random.c | 1 - examples/platforms/cc2652/system.c | 1 - examples/platforms/cc2652/uart.c | 1 - examples/platforms/da15000/logging.c | 3 + examples/platforms/da15000/platform-da15000.h | 3 +- examples/platforms/da15000/system.c | 2 +- examples/platforms/efr32/logging.c | 1 + examples/platforms/efr32/misc.c | 1 - examples/platforms/efr32/radio.c | 1 - examples/platforms/efr32/random.c | 1 - examples/platforms/efr32/uart.c | 1 - examples/platforms/emsk/logging.c | 3 +- examples/platforms/emsk/platform-emsk.h | 2 +- examples/platforms/emsk/radio.c | 8 +- examples/platforms/emsk/system.c | 1 - examples/platforms/emsk/uart.c | 1 - examples/platforms/gp712/alarm.c | 1 - examples/platforms/gp712/alarm_qorvo.h | 1 - examples/platforms/gp712/diag.c | 1 - examples/platforms/gp712/logging.c | 1 + examples/platforms/gp712/misc.c | 3 +- examples/platforms/gp712/platform_qorvo.h | 2 +- examples/platforms/gp712/radio.c | 2 - examples/platforms/gp712/radio_qorvo.h | 3 +- examples/platforms/gp712/random.c | 2 +- examples/platforms/gp712/random_qorvo.h | 1 - examples/platforms/gp712/uart_qorvo.h | 1 - examples/platforms/kw41z/alarm.c | 5 +- examples/platforms/kw41z/diag.c | 7 +- examples/platforms/kw41z/logging.c | 1 + examples/platforms/kw41z/misc.c | 1 - examples/platforms/kw41z/platform-kw41z.h | 4 +- examples/platforms/kw41z/random.c | 1 - examples/platforms/kw41z/system.c | 1 - examples/platforms/kw41z/uart.c | 1 - examples/platforms/nrf52840/alarm.c | 1 - examples/platforms/nrf52840/flash.c | 1 - examples/platforms/nrf52840/flash_nosd.c | 1 - examples/platforms/nrf52840/flash_sd.c | 1 - examples/platforms/nrf52840/logging.c | 1 - examples/platforms/nrf52840/platform-nrf5.h | 2 +- examples/platforms/nrf52840/radio.c | 1 - examples/platforms/nrf52840/softdevice.c | 1 - examples/platforms/nrf52840/spi-slave.c | 1 - examples/platforms/nrf52840/uart.c | 1 - examples/platforms/nrf52840/usb-cdc-uart.c | 1 - examples/platforms/openthread-system.h | 2 +- examples/platforms/posix/diag.c | 1 - examples/platforms/posix/logging.c | 1 + examples/platforms/posix/misc.c | 1 - examples/platforms/posix/platform-posix.h | 2 +- examples/platforms/posix/radio.c | 1 + examples/platforms/posix/random.c | 1 - examples/platforms/posix/sim/platform-sim.c | 1 - examples/platforms/posix/system.c | 1 - examples/platforms/samr21/logging.c | 1 + examples/platforms/samr21/platform-samr21.h | 2 +- examples/platforms/samr21/system.c | 2 + examples/platforms/utils/debug_uart.c | 1 - examples/platforms/utils/flash.h | 2 +- examples/platforms/utils/settings_flash.c | 2 +- include/openthread/Makefile.am | 3 +- include/openthread/border_router.h | 3 +- include/openthread/channel_manager.h | 2 +- include/openthread/channel_monitor.h | 2 +- include/openthread/child_supervision.h | 2 +- include/openthread/cli.h | 4 +- include/openthread/coap.h | 2 +- include/openthread/commissioner.h | 35 +- include/openthread/dataset.h | 203 ++- include/openthread/dataset_ftd.h | 3 +- include/openthread/dhcp6_client.h | 2 +- include/openthread/dhcp6_server.h | 2 +- include/openthread/diag.h | 2 +- include/openthread/dns.h | 2 +- include/openthread/{openthread.h => error.h} | 216 ++- include/openthread/icmp6.h | 2 +- include/openthread/instance.h | 45 +- include/openthread/ip6.h | 129 ++ include/openthread/jam_detection.h | 2 +- include/openthread/joiner.h | 2 +- include/openthread/link.h | 121 +- include/openthread/link_raw.h | 1 - include/openthread/message.h | 39 +- include/openthread/ncp.h | 4 +- include/openthread/netdata.h | 110 +- include/openthread/network_time.h | 2 +- include/openthread/platform/alarm-micro.h | 2 +- include/openthread/platform/alarm-milli.h | 2 +- include/openthread/platform/ble.h | 2 +- include/openthread/platform/debug_uart.h | 1 + include/openthread/platform/diag.h | 2 +- include/openthread/platform/logging.h | 89 +- include/openthread/platform/messagepool.h | 1 - include/openthread/platform/misc.h | 2 +- include/openthread/platform/radio.h | 37 +- include/openthread/platform/random.h | 2 +- include/openthread/platform/settings.h | 2 +- include/openthread/platform/spi-slave.h | 3 +- include/openthread/platform/time.h | 2 - include/openthread/platform/toolchain.h | 11 + include/openthread/platform/uart.h | 2 +- include/openthread/server.h | 31 +- include/openthread/tasklet.h | 2 +- include/openthread/thread.h | 105 +- include/openthread/thread_ftd.h | 45 +- include/openthread/types.h | 1239 ----------------- include/openthread/udp.h | 2 +- src/cli/cli.cpp | 1 - src/cli/cli.hpp | 1 - src/cli/cli_coap.hpp | 2 - src/cli/cli_dataset.cpp | 2 - src/cli/cli_dataset.hpp | 2 + src/cli/cli_instance.cpp | 2 - src/cli/cli_server.hpp | 2 - src/cli/cli_uart.hpp | 2 - src/cli/cli_udp.hpp | 2 +- src/cli/cli_udp_example.hpp | 1 - src/core/api/instance_api.cpp | 1 - src/core/common/instance.hpp | 2 +- src/core/common/locator.hpp | 2 +- src/core/common/logging.cpp | 2 - src/core/common/logging.hpp | 1 - src/core/common/notifier.hpp | 2 +- src/core/common/owner-locator.hpp | 1 - src/core/common/string.hpp | 3 +- src/core/common/tasklet.cpp | 2 - src/core/common/timer.hpp | 1 - src/core/common/tlvs.hpp | 2 - src/core/crypto/aes_ccm.hpp | 2 +- src/core/crypto/mbedtls.hpp | 2 + src/core/mac/mac_filter.cpp | 1 - src/core/mac/mac_filter.hpp | 2 - src/core/mac/mac_frame.hpp | 2 +- src/core/meshcop/border_agent.cpp | 2 - src/core/meshcop/commissioner.cpp | 1 - src/core/meshcop/dataset.hpp | 2 + src/core/meshcop/dataset_manager.cpp | 2 - src/core/meshcop/dataset_manager.hpp | 2 - src/core/meshcop/dtls.hpp | 2 - src/core/meshcop/joiner_router.hpp | 2 - src/core/meshcop/meshcop.hpp | 2 + src/core/meshcop/meshcop_tlvs.hpp | 3 +- src/core/meshcop/timestamp.cpp | 2 - src/core/net/dhcp6_client.cpp | 2 - src/core/net/dhcp6_server.cpp | 2 - src/core/net/dhcp6_server.hpp | 2 - src/core/net/dns_client.hpp | 1 - src/core/net/dns_headers.hpp | 2 - src/core/net/ip6_address.hpp | 2 - src/core/net/ip6_filter.hpp | 2 - src/core/net/ip6_headers.hpp | 2 - src/core/net/ip6_mpl.hpp | 2 - src/core/net/ip6_routes.hpp | 2 - src/core/net/socket.hpp | 2 - src/core/net/tcp.hpp | 2 - src/core/thread/address_resolver.hpp | 2 - src/core/thread/announce_begin_server.hpp | 2 - src/core/thread/announce_sender.hpp | 2 - src/core/thread/data_poll_manager.hpp | 2 - src/core/thread/energy_scan_server.hpp | 2 - src/core/thread/key_manager.hpp | 2 +- src/core/thread/link_quality.hpp | 1 - src/core/thread/mesh_forwarder.hpp | 2 - src/core/thread/mle.hpp | 2 - src/core/thread/mle_tlvs.hpp | 2 - src/core/thread/network_data.hpp | 3 +- src/core/thread/network_diagnostic.hpp | 2 - src/core/thread/network_diagnostic_tlvs.hpp | 2 +- src/core/thread/panid_query_server.hpp | 2 - src/core/thread/src_match_controller.hpp | 2 - src/core/thread/thread_netif.hpp | 2 - src/core/thread/thread_tlvs.hpp | 2 - src/core/thread/time_sync_service.hpp | 1 - src/core/thread/topology.hpp | 2 + src/core/utils/channel_manager.hpp | 1 - src/core/utils/channel_monitor.hpp | 1 - src/core/utils/child_supervision.cpp | 2 - src/core/utils/jam_detector.cpp | 2 - src/core/utils/slaac_address.cpp | 3 +- src/core/utils/slaac_address.hpp | 2 +- src/diag/diag_process.hpp | 1 - src/ncp/changed_props_set.hpp | 2 +- src/ncp/hdlc.hpp | 4 +- src/ncp/ncp_base.cpp | 1 - src/ncp/ncp_base.hpp | 1 - src/ncp/ncp_base_ftd.cpp | 1 - src/ncp/ncp_base_mtd.cpp | 1 - src/ncp/ncp_base_radio.cpp | 1 - src/ncp/ncp_buffer.hpp | 1 - src/ncp/spinel_decoder.hpp | 2 +- src/ncp/spinel_encoder.hpp | 2 +- src/posix/main.c | 2 +- src/posix/platform/debug_uart.c | 1 - src/posix/platform/diag.c | 1 - src/posix/platform/flash.h | 2 +- src/posix/platform/misc.c | 1 - src/posix/platform/openthread-system.h | 2 +- src/posix/platform/platform-posix.h | 2 +- src/posix/platform/radio_spinel.hpp | 2 + src/posix/platform/random.c | 1 - src/posix/platform/settings.cpp | 3 +- src/posix/platform/system.c | 1 - tests/fuzz/ip6_send.cpp | 1 - tests/fuzz/radio_receive_done.cpp | 1 - tests/unit/test_aes.cpp | 1 - tests/unit/test_child.cpp | 1 - tests/unit/test_child_table.cpp | 1 - tests/unit/test_hmac_sha256.cpp | 1 - tests/unit/test_link_quality.cpp | 2 - tests/unit/test_lowpan.hpp | 2 - tests/unit/test_mac_frame.cpp | 2 - tests/unit/test_message.cpp | 2 - tests/unit/test_message_queue.cpp | 1 - tests/unit/test_ncp_buffer.cpp | 2 - tests/unit/test_platform.h | 1 - tests/unit/test_priority_queue.cpp | 2 - tests/unit/test_pskc.cpp | 1 - tests/unit/test_spinel_decoder.cpp | 2 - tests/unit/test_spinel_encoder.cpp | 2 - tests/unit/test_string.cpp | 1 - tests/unit/test_toolchain.cpp | 1 + tests/unit/test_toolchain_c.c | 1 + tests/unit/test_util.cpp | 2 + tests/unit/test_util.h | 2 - 270 files changed, 1318 insertions(+), 1587 deletions(-) rename include/openthread/{openthread.h => error.h} (54%) delete mode 100644 include/openthread/types.h diff --git a/.appveyor/make_release.cmd b/.appveyor/make_release.cmd index bc69f2cf5..8ecf68c33 100644 --- a/.appveyor/make_release.cmd +++ b/.appveyor/make_release.cmd @@ -42,13 +42,13 @@ REM Copy the relavant include headers copy include\openthread\commissioner.h release\include\openthread copy include\openthread\dataset.h release\include\openthread +copy include\openthread\error.h release\include\openthread copy include\openthread\instance.h release\include\openthread copy include\openthread\ip6.h release\include\openthread copy include\openthread\joiner.h release\include\openthread copy include\openthread\link.h release\include\openthread copy include\openthread\message.h release\include\openthread copy include\openthread\netdata.h release\include\openthread -copy include\openthread\openthread.h release\include\openthread copy include\openthread\thread.h release\include\openthread copy include\openthread\types.h release\include\openthread copy include\openthread\platform\toolchain.h release\include\openthread\platform diff --git a/configure.ac b/configure.ac index b9e940230..80375dbd3 100644 --- a/configure.ac +++ b/configure.ac @@ -68,7 +68,7 @@ AC_SUBST(LIBOPENTHREAD_VERSION_INFO, [${LIBOPENTHREAD_VERSION_CURRENT}:${LIB # Check the sanity of the source directory by checking for the # presence of a key watch file # -AC_CONFIG_SRCDIR([include/openthread/openthread.h]) +AC_CONFIG_SRCDIR([include/openthread/error.h]) # # Tell autoconf where to find auxilliary build tools (e.g. config.guess, diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj index 7ea6ae8c2..7ef558d67 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj +++ b/etc/visual-studio/libopenthread_k.vcxproj @@ -173,6 +173,7 @@ + @@ -181,11 +182,9 @@ - - diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters index 0716824fa..85ca29a7a 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj.filters +++ b/etc/visual-studio/libopenthread_k.vcxproj.filters @@ -614,9 +614,6 @@ Header Files - - Header Files\openthread - Header Files @@ -644,6 +641,9 @@ Header Files\openthread + + Header Files\openthread + Header Files\openthread @@ -668,9 +668,6 @@ Header Files\openthread - - Header Files\openthread - Header Files\openthread diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c index ecbdc549e..e35ac5e37 100644 --- a/examples/apps/cli/main.c +++ b/examples/apps/cli/main.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include "openthread-system.h" diff --git a/examples/apps/ncp/main.c b/examples/apps/ncp/main.c index 4d87bd3c4..f2fbfe15b 100644 --- a/examples/apps/ncp/main.c +++ b/examples/apps/ncp/main.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include "openthread-system.h" diff --git a/examples/apps/windows/otAdapter.h b/examples/apps/windows/otAdapter.h index ff2df9e4b..f09c28037 100644 --- a/examples/apps/windows/otAdapter.h +++ b/examples/apps/windows/otAdapter.h @@ -29,7 +29,6 @@ #pragma once #define OTDLL 1 -#include #include #include #include diff --git a/examples/drivers/windows/include/otLwfIoctl.h b/examples/drivers/windows/include/otLwfIoctl.h index b32e9f295..ab6864109 100644 --- a/examples/drivers/windows/include/otLwfIoctl.h +++ b/examples/drivers/windows/include/otLwfIoctl.h @@ -35,8 +35,6 @@ #ifndef __OTLWFIOCTL_H__ #define __OTLWFIOCTL_H__ -#include - __inline LONG ThreadErrorToNtstatus(otError error) { return (LONG)-((int)error); } // User-mode IOCTL path for CreateFile diff --git a/examples/drivers/windows/include/otNode.h b/examples/drivers/windows/include/otNode.h index d647e333b..4c3014925 100644 --- a/examples/drivers/windows/include/otNode.h +++ b/examples/drivers/windows/include/otNode.h @@ -29,14 +29,12 @@ /** * @file * @brief - * This file defines a node interface for openthread.h to be used for certification tests + * This file defines a node interface for openthread to be used for certification tests */ #ifndef OTNODE_H_ #define OTNODE_H_ -#include - #ifndef OTNODEAPI #define OTNODEAPI __declspec(dllimport) #endif diff --git a/examples/drivers/windows/otApi/precomp.h b/examples/drivers/windows/otApi/precomp.h index 0308eb491..4bed0c1b1 100644 --- a/examples/drivers/windows/otApi/precomp.h +++ b/examples/drivers/windows/otApi/precomp.h @@ -21,9 +21,9 @@ #define OTDLL #define OTAPI EXTERN_C __declspec(dllexport) -#include #include #include +#include #include #include #include diff --git a/examples/drivers/windows/otCli/main.cpp b/examples/drivers/windows/otCli/main.cpp index 7b7337775..c2ad1fe96 100644 --- a/examples/drivers/windows/otCli/main.cpp +++ b/examples/drivers/windows/otCli/main.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include #include diff --git a/examples/drivers/windows/otLwf/precomp.h b/examples/drivers/windows/otLwf/precomp.h index 824eea70d..74485299a 100644 --- a/examples/drivers/windows/otLwf/precomp.h +++ b/examples/drivers/windows/otLwf/precomp.h @@ -61,7 +61,6 @@ RtlCopyBufferToMdl( #include #include -#include #include #include #include diff --git a/examples/drivers/windows/otNodeApi/precomp.h b/examples/drivers/windows/otNodeApi/precomp.h index a0d8e85ce..d7de64809 100644 --- a/examples/drivers/windows/otNodeApi/precomp.h +++ b/examples/drivers/windows/otNodeApi/precomp.h @@ -49,7 +49,6 @@ using namespace std; #define OTDLL #define OTNODEAPI EXTERN_C __declspec(dllexport) -#include #include #include #include diff --git a/examples/platforms/cc1352/alarm.c b/examples/platforms/cc1352/alarm.c index bf4826f80..acd44e37a 100644 --- a/examples/platforms/cc1352/alarm.c +++ b/examples/platforms/cc1352/alarm.c @@ -38,8 +38,6 @@ #include #include -#include - #include #include diff --git a/examples/platforms/cc1352/diag.c b/examples/platforms/cc1352/diag.c index 8658d8eee..beef3c2d1 100644 --- a/examples/platforms/cc1352/diag.c +++ b/examples/platforms/cc1352/diag.c @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc1352/logging.c b/examples/platforms/cc1352/logging.c index 190a4bfa1..7dcab8294 100644 --- a/examples/platforms/cc1352/logging.c +++ b/examples/platforms/cc1352/logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/cc1352/misc.c b/examples/platforms/cc1352/misc.c index a95a42236..a28859746 100644 --- a/examples/platforms/cc1352/misc.c +++ b/examples/platforms/cc1352/misc.c @@ -29,7 +29,6 @@ #include #include -#include #include /* diff --git a/examples/platforms/cc1352/platform-cc1352.h b/examples/platforms/cc1352/platform-cc1352.h index 927712526..4d973e65e 100644 --- a/examples/platforms/cc1352/platform-cc1352.h +++ b/examples/platforms/cc1352/platform-cc1352.h @@ -32,7 +32,7 @@ #include #include #include -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/examples/platforms/cc1352/radio.c b/examples/platforms/cc1352/radio.c index f7f2db0f7..ccd645a88 100644 --- a/examples/platforms/cc1352/radio.c +++ b/examples/platforms/cc1352/radio.c @@ -36,8 +36,6 @@ #include #include -#include -#include #include #include #include diff --git a/examples/platforms/cc1352/random.c b/examples/platforms/cc1352/random.c index 1e20a0449..e536b3873 100644 --- a/examples/platforms/cc1352/random.c +++ b/examples/platforms/cc1352/random.c @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc1352/system.c b/examples/platforms/cc1352/system.c index 078cb865b..243257fa7 100644 --- a/examples/platforms/cc1352/system.c +++ b/examples/platforms/cc1352/system.c @@ -36,7 +36,6 @@ #include "platform-cc1352.h" #include -#include #include "inc/hw_ccfg.h" #include "inc/hw_ccfg_simple_struct.h" diff --git a/examples/platforms/cc1352/uart.c b/examples/platforms/cc1352/uart.c index f7ec0845c..99881eb9f 100644 --- a/examples/platforms/cc1352/uart.c +++ b/examples/platforms/cc1352/uart.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/cc2538/alarm.c b/examples/platforms/cc2538/alarm.c index 1a54eb230..0bbbe2a53 100644 --- a/examples/platforms/cc2538/alarm.c +++ b/examples/platforms/cc2538/alarm.c @@ -36,7 +36,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc2538/diag.c b/examples/platforms/cc2538/diag.c index 19987ce04..96fc4f82d 100644 --- a/examples/platforms/cc2538/diag.c +++ b/examples/platforms/cc2538/diag.c @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc2538/logging.c b/examples/platforms/cc2538/logging.c index 190a4bfa1..7dcab8294 100644 --- a/examples/platforms/cc2538/logging.c +++ b/examples/platforms/cc2538/logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/cc2538/misc.c b/examples/platforms/cc2538/misc.c index 167cc3826..8f36b35ec 100644 --- a/examples/platforms/cc2538/misc.c +++ b/examples/platforms/cc2538/misc.c @@ -26,7 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include "platform-cc2538.h" diff --git a/examples/platforms/cc2538/platform-cc2538.h b/examples/platforms/cc2538/platform-cc2538.h index 2a61807cc..41bd0b988 100644 --- a/examples/platforms/cc2538/platform-cc2538.h +++ b/examples/platforms/cc2538/platform-cc2538.h @@ -38,8 +38,7 @@ #include #include #include - -#include +#include #include "cc2538-reg.h" diff --git a/examples/platforms/cc2538/radio.c b/examples/platforms/cc2538/radio.c index fc4050f85..4cff9eb34 100644 --- a/examples/platforms/cc2538/radio.c +++ b/examples/platforms/cc2538/radio.c @@ -33,7 +33,6 @@ */ #include -#include #include #include #include diff --git a/examples/platforms/cc2538/random.c b/examples/platforms/cc2538/random.c index be8ef2ea8..a349fb354 100644 --- a/examples/platforms/cc2538/random.c +++ b/examples/platforms/cc2538/random.c @@ -32,7 +32,6 @@ * */ -#include #include #include diff --git a/examples/platforms/cc2538/uart.c b/examples/platforms/cc2538/uart.c index bf024bec1..61f2feb54 100644 --- a/examples/platforms/cc2538/uart.c +++ b/examples/platforms/cc2538/uart.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/cc2650/alarm.c b/examples/platforms/cc2650/alarm.c index d3ce3b3f6..ed9e89d94 100644 --- a/examples/platforms/cc2650/alarm.c +++ b/examples/platforms/cc2650/alarm.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/examples/platforms/cc2650/flash.c b/examples/platforms/cc2650/flash.c index 54aa12391..49b69b1a1 100644 --- a/examples/platforms/cc2650/flash.c +++ b/examples/platforms/cc2650/flash.c @@ -28,6 +28,8 @@ #include "platform-cc2650.h" +#include + /** * @warning this file only implements stubs for the function calls. There is * not enough space on the cc2650 to support NV as an SoC. diff --git a/examples/platforms/cc2650/logging.c b/examples/platforms/cc2650/logging.c index 190a4bfa1..7dcab8294 100644 --- a/examples/platforms/cc2650/logging.c +++ b/examples/platforms/cc2650/logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/cc2650/misc.c b/examples/platforms/cc2650/misc.c index 09676a133..539e28741 100644 --- a/examples/platforms/cc2650/misc.c +++ b/examples/platforms/cc2650/misc.c @@ -27,7 +27,6 @@ */ #include -#include #include /** diff --git a/examples/platforms/cc2650/platform-cc2650.h b/examples/platforms/cc2650/platform-cc2650.h index ed3a098fb..33e1c3dbd 100644 --- a/examples/platforms/cc2650/platform-cc2650.h +++ b/examples/platforms/cc2650/platform-cc2650.h @@ -32,7 +32,7 @@ #include #include #include -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/examples/platforms/cc2650/radio.c b/examples/platforms/cc2650/radio.c index 614158d2d..11572422a 100644 --- a/examples/platforms/cc2650/radio.c +++ b/examples/platforms/cc2650/radio.c @@ -28,8 +28,6 @@ #include -#include - #include "cc2650_radio.h" #include #include diff --git a/examples/platforms/cc2650/random.c b/examples/platforms/cc2650/random.c index 6b9dc24d7..0442a55ca 100644 --- a/examples/platforms/cc2650/random.c +++ b/examples/platforms/cc2650/random.c @@ -27,7 +27,6 @@ */ #include -#include #include #include diff --git a/examples/platforms/cc2650/system.c b/examples/platforms/cc2650/system.c index bd95b801c..a5ec0793d 100644 --- a/examples/platforms/cc2650/system.c +++ b/examples/platforms/cc2650/system.c @@ -28,7 +28,6 @@ #include "platform-cc2650.h" #include -#include #include "inc/hw_ccfg_simple_struct.h" extern const ccfg_t __ccfg; diff --git a/examples/platforms/cc2650/uart.c b/examples/platforms/cc2650/uart.c index bd7cd449e..fe8b38840 100644 --- a/examples/platforms/cc2650/uart.c +++ b/examples/platforms/cc2650/uart.c @@ -34,7 +34,6 @@ #include #include -#include #include /** diff --git a/examples/platforms/cc2652/alarm.c b/examples/platforms/cc2652/alarm.c index dd3d1845b..13f3dde78 100644 --- a/examples/platforms/cc2652/alarm.c +++ b/examples/platforms/cc2652/alarm.c @@ -38,8 +38,6 @@ #include #include -#include - #include #include diff --git a/examples/platforms/cc2652/diag.c b/examples/platforms/cc2652/diag.c index ff00d80d4..b6dad2e7e 100644 --- a/examples/platforms/cc2652/diag.c +++ b/examples/platforms/cc2652/diag.c @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc2652/logging.c b/examples/platforms/cc2652/logging.c index 190a4bfa1..7dcab8294 100644 --- a/examples/platforms/cc2652/logging.c +++ b/examples/platforms/cc2652/logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/cc2652/misc.c b/examples/platforms/cc2652/misc.c index 0550e6599..d49400af9 100644 --- a/examples/platforms/cc2652/misc.c +++ b/examples/platforms/cc2652/misc.c @@ -29,7 +29,6 @@ #include #include -#include #include /* diff --git a/examples/platforms/cc2652/platform-cc2652.h b/examples/platforms/cc2652/platform-cc2652.h index 4a6b507c8..65063fe69 100644 --- a/examples/platforms/cc2652/platform-cc2652.h +++ b/examples/platforms/cc2652/platform-cc2652.h @@ -32,7 +32,7 @@ #include #include #include -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/examples/platforms/cc2652/radio.c b/examples/platforms/cc2652/radio.c index 86de3c81c..48f09d108 100644 --- a/examples/platforms/cc2652/radio.c +++ b/examples/platforms/cc2652/radio.c @@ -36,8 +36,6 @@ #include #include -#include -#include #include #include #include diff --git a/examples/platforms/cc2652/random.c b/examples/platforms/cc2652/random.c index b803e2aac..aa8c93fc8 100644 --- a/examples/platforms/cc2652/random.c +++ b/examples/platforms/cc2652/random.c @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/cc2652/system.c b/examples/platforms/cc2652/system.c index 6a96d2c3a..1425ac9b4 100644 --- a/examples/platforms/cc2652/system.c +++ b/examples/platforms/cc2652/system.c @@ -36,7 +36,6 @@ #include "platform-cc2652.h" #include -#include #include "inc/hw_ccfg.h" #include "inc/hw_ccfg_simple_struct.h" diff --git a/examples/platforms/cc2652/uart.c b/examples/platforms/cc2652/uart.c index 13fc515f5..493aa0870 100644 --- a/examples/platforms/cc2652/uart.c +++ b/examples/platforms/cc2652/uart.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/da15000/logging.c b/examples/platforms/da15000/logging.c index 81cfaac2c..9c0b03f72 100644 --- a/examples/platforms/da15000/logging.c +++ b/examples/platforms/da15000/logging.c @@ -32,7 +32,10 @@ * */ +#include +#include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/da15000/platform-da15000.h b/examples/platforms/da15000/platform-da15000.h index 208d6952a..6a2cfaf6c 100644 --- a/examples/platforms/da15000/platform-da15000.h +++ b/examples/platforms/da15000/platform-da15000.h @@ -31,7 +31,8 @@ #include #include -#include + +#include /** * This function initializes the radio service used by OpenThread. diff --git a/examples/platforms/da15000/system.c b/examples/platforms/da15000/system.c index 68dfb9466..0c26fa52f 100644 --- a/examples/platforms/da15000/system.c +++ b/examples/platforms/da15000/system.c @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include "platform-da15000.h" diff --git a/examples/platforms/efr32/logging.c b/examples/platforms/efr32/logging.c index dbb2b43e4..77383dcdb 100644 --- a/examples/platforms/efr32/logging.c +++ b/examples/platforms/efr32/logging.c @@ -35,6 +35,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/efr32/misc.c b/examples/platforms/efr32/misc.c index 1a039017b..757407bf4 100644 --- a/examples/platforms/efr32/misc.c +++ b/examples/platforms/efr32/misc.c @@ -31,7 +31,6 @@ * This file implements the OpenThread platform abstraction for miscellaneous behaviors. */ -#include #include #include "em_rmu.h" diff --git a/examples/platforms/efr32/radio.c b/examples/platforms/efr32/radio.c index d20952c87..dea88164f 100644 --- a/examples/platforms/efr32/radio.c +++ b/examples/platforms/efr32/radio.c @@ -35,7 +35,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/efr32/random.c b/examples/platforms/efr32/random.c index 3278a7366..5d1a6c42b 100644 --- a/examples/platforms/efr32/random.c +++ b/examples/platforms/efr32/random.c @@ -32,7 +32,6 @@ * */ -#include #include #include "utils/code_utils.h" diff --git a/examples/platforms/efr32/uart.c b/examples/platforms/efr32/uart.c index cb00e194f..32f0741c4 100644 --- a/examples/platforms/efr32/uart.c +++ b/examples/platforms/efr32/uart.c @@ -34,7 +34,6 @@ #include -#include #include #include "utils/code_utils.h" diff --git a/examples/platforms/emsk/logging.c b/examples/platforms/emsk/logging.c index 8aafa0548..77383dcdb 100644 --- a/examples/platforms/emsk/logging.c +++ b/examples/platforms/emsk/logging.c @@ -32,9 +32,10 @@ * */ -#include "openthread/platform/logging.h" #include #include +#include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/emsk/platform-emsk.h b/examples/platforms/emsk/platform-emsk.h index 430a0f937..7e7ab8abb 100644 --- a/examples/platforms/emsk/platform-emsk.h +++ b/examples/platforms/emsk/platform-emsk.h @@ -39,7 +39,7 @@ #include #include #include -#include "openthread/types.h" +#include #include "board/board.h" diff --git a/examples/platforms/emsk/radio.c b/examples/platforms/emsk/radio.c index d1d5251f3..418e16283 100644 --- a/examples/platforms/emsk/radio.c +++ b/examples/platforms/emsk/radio.c @@ -34,14 +34,16 @@ #include #include -#include "openthread/types.h" +#include #include "platform-emsk.h" -#include + +#include #include #include -#include +#include "utils/code_utils.h" + #include "device/device_hal/inc/dev_gpio.h" #include diff --git a/examples/platforms/emsk/system.c b/examples/platforms/emsk/system.c index e9f4ff4d6..87b52b33b 100644 --- a/examples/platforms/emsk/system.c +++ b/examples/platforms/emsk/system.c @@ -34,7 +34,6 @@ */ #include "platform-emsk.h" -#include "openthread/openthread.h" #include "openthread/platform/uart.h" #include diff --git a/examples/platforms/emsk/uart.c b/examples/platforms/emsk/uart.c index e045bea53..527802ad9 100644 --- a/examples/platforms/emsk/uart.c +++ b/examples/platforms/emsk/uart.c @@ -37,7 +37,6 @@ #include "platform-emsk.h" #include #include "openthread/platform/uart.h" -#include "openthread/types.h" #include #define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__) diff --git a/examples/platforms/gp712/alarm.c b/examples/platforms/gp712/alarm.c index 84be93fcb..1b90e840b 100644 --- a/examples/platforms/gp712/alarm.c +++ b/examples/platforms/gp712/alarm.c @@ -37,7 +37,6 @@ #include #include "alarm_qorvo.h" -#include #include #include diff --git a/examples/platforms/gp712/alarm_qorvo.h b/examples/platforms/gp712/alarm_qorvo.h index c818ceec1..c37fa6c1b 100644 --- a/examples/platforms/gp712/alarm_qorvo.h +++ b/examples/platforms/gp712/alarm_qorvo.h @@ -38,7 +38,6 @@ #include #include #include -#include typedef void (*qorvoAlarmCallback_t)( void* ); diff --git a/examples/platforms/gp712/diag.c b/examples/platforms/gp712/diag.c index 8148dc5fe..f374101e8 100644 --- a/examples/platforms/gp712/diag.c +++ b/examples/platforms/gp712/diag.c @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/gp712/logging.c b/examples/platforms/gp712/logging.c index 7c6fff125..66cde6b5b 100644 --- a/examples/platforms/gp712/logging.c +++ b/examples/platforms/gp712/logging.c @@ -42,6 +42,7 @@ #endif #include +#include #include "utils/code_utils.h" diff --git a/examples/platforms/gp712/misc.c b/examples/platforms/gp712/misc.c index 57ada14a6..f9a0886e8 100644 --- a/examples/platforms/gp712/misc.c +++ b/examples/platforms/gp712/misc.c @@ -33,7 +33,8 @@ #include "radio_qorvo.h" #include -#include + +#include #include extern int gArgumentsCount; diff --git a/examples/platforms/gp712/platform_qorvo.h b/examples/platforms/gp712/platform_qorvo.h index 006aa7659..1ce1004ad 100644 --- a/examples/platforms/gp712/platform_qorvo.h +++ b/examples/platforms/gp712/platform_qorvo.h @@ -37,8 +37,8 @@ #include #include + #include -#include typedef void (*qorvoPlatPollFunction_t)(uint8_t); typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t) (void); diff --git a/examples/platforms/gp712/radio.c b/examples/platforms/gp712/radio.c index 29c461910..102edb7bb 100644 --- a/examples/platforms/gp712/radio.c +++ b/examples/platforms/gp712/radio.c @@ -34,8 +34,6 @@ #include -#include - #include #include diff --git a/examples/platforms/gp712/radio_qorvo.h b/examples/platforms/gp712/radio_qorvo.h index e87bd0536..100af2074 100644 --- a/examples/platforms/gp712/radio_qorvo.h +++ b/examples/platforms/gp712/radio_qorvo.h @@ -36,7 +36,8 @@ #define RADIO_QORVO_H_ #include -#include + +#include #include /** diff --git a/examples/platforms/gp712/random.c b/examples/platforms/gp712/random.c index 550c8dc3a..d6e9142dd 100644 --- a/examples/platforms/gp712/random.c +++ b/examples/platforms/gp712/random.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include "utils/code_utils.h" diff --git a/examples/platforms/gp712/random_qorvo.h b/examples/platforms/gp712/random_qorvo.h index b4703e8fc..2bd1453d6 100644 --- a/examples/platforms/gp712/random_qorvo.h +++ b/examples/platforms/gp712/random_qorvo.h @@ -36,7 +36,6 @@ #define RANDOM_QORVO_H_ #include -#include /** * This function initializes the random number service used by OpenThread. diff --git a/examples/platforms/gp712/uart_qorvo.h b/examples/platforms/gp712/uart_qorvo.h index edd577556..7d6c1e388 100644 --- a/examples/platforms/gp712/uart_qorvo.h +++ b/examples/platforms/gp712/uart_qorvo.h @@ -36,7 +36,6 @@ #define UART_QORVO_H_ #include -#include /** * This function initializes the UART driver. diff --git a/examples/platforms/kw41z/alarm.c b/examples/platforms/kw41z/alarm.c index 2b6457747..0f38161f0 100644 --- a/examples/platforms/kw41z/alarm.c +++ b/examples/platforms/kw41z/alarm.c @@ -37,9 +37,8 @@ #include "fsl_pit.h" #include -#include "openthread/openthread.h" -#include "openthread/platform/alarm-milli.h" -#include "openthread/platform/diag.h" +#include +#include static volatile uint32_t sTime = 0; static uint32_t sAlarmTime = 0; diff --git a/examples/platforms/kw41z/diag.c b/examples/platforms/kw41z/diag.c index 81bb15c3a..aa5f0a904 100644 --- a/examples/platforms/kw41z/diag.c +++ b/examples/platforms/kw41z/diag.c @@ -36,11 +36,10 @@ #include #include #include -#include "openthread/config.h" -#include "openthread/openthread.h" -#include "openthread/platform/alarm-milli.h" -#include "openthread/platform/radio.h" +#include +#include +#include #if OPENTHREAD_ENABLE_DIAG diff --git a/examples/platforms/kw41z/logging.c b/examples/platforms/kw41z/logging.c index dbb2b43e4..77383dcdb 100644 --- a/examples/platforms/kw41z/logging.c +++ b/examples/platforms/kw41z/logging.c @@ -35,6 +35,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/kw41z/misc.c b/examples/platforms/kw41z/misc.c index 20ada534c..777389a1c 100644 --- a/examples/platforms/kw41z/misc.c +++ b/examples/platforms/kw41z/misc.c @@ -29,7 +29,6 @@ #include "openthread/platform/misc.h" #include "fsl_device_registers.h" #include -#include "openthread/types.h" void otPlatReset(otInstance *aInstance) { diff --git a/examples/platforms/kw41z/platform-kw41z.h b/examples/platforms/kw41z/platform-kw41z.h index aee52729d..79f74fa6f 100644 --- a/examples/platforms/kw41z/platform-kw41z.h +++ b/examples/platforms/kw41z/platform-kw41z.h @@ -37,9 +37,11 @@ #include #include + #include -#include "openthread/types.h" +#include + /** * This function initializes the alarm service used by OpenThread. * diff --git a/examples/platforms/kw41z/random.c b/examples/platforms/kw41z/random.c index b43d5a4dd..93d25e6f9 100644 --- a/examples/platforms/kw41z/random.c +++ b/examples/platforms/kw41z/random.c @@ -38,7 +38,6 @@ #include #include #include -#include "openthread/types.h" void kw41zRandomInit(void) { diff --git a/examples/platforms/kw41z/system.c b/examples/platforms/kw41z/system.c index f226493e8..c663f612c 100644 --- a/examples/platforms/kw41z/system.c +++ b/examples/platforms/kw41z/system.c @@ -39,7 +39,6 @@ #include "platform-kw41z.h" #include #include "openthread/platform/uart.h" -#include "openthread/types.h" otInstance *sInstance; diff --git a/examples/platforms/kw41z/uart.c b/examples/platforms/kw41z/uart.c index 5043d59c6..6f2b671b1 100644 --- a/examples/platforms/kw41z/uart.c +++ b/examples/platforms/kw41z/uart.c @@ -38,7 +38,6 @@ #include #include "openthread/platform/uart.h" -#include "openthread/types.h" #include "fsl_clock.h" #include "fsl_lpuart.h" diff --git a/examples/platforms/nrf52840/alarm.c b/examples/platforms/nrf52840/alarm.c index 170986fc3..65d9395a3 100644 --- a/examples/platforms/nrf52840/alarm.c +++ b/examples/platforms/nrf52840/alarm.c @@ -57,7 +57,6 @@ #include #include -#include // clang-format off #define RTC_FREQUENCY 32768ULL diff --git a/examples/platforms/nrf52840/flash.c b/examples/platforms/nrf52840/flash.c index 504f6cc4e..bb3ae9117 100644 --- a/examples/platforms/nrf52840/flash.c +++ b/examples/platforms/nrf52840/flash.c @@ -35,7 +35,6 @@ #include #include -#include #include #include "platform-nrf5.h" diff --git a/examples/platforms/nrf52840/flash_nosd.c b/examples/platforms/nrf52840/flash_nosd.c index c4f4eec3c..784600abe 100644 --- a/examples/platforms/nrf52840/flash_nosd.c +++ b/examples/platforms/nrf52840/flash_nosd.c @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/nrf52840/flash_sd.c b/examples/platforms/nrf52840/flash_sd.c index 567ecfba1..659635c10 100644 --- a/examples/platforms/nrf52840/flash_sd.c +++ b/examples/platforms/nrf52840/flash_sd.c @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/nrf52840/logging.c b/examples/platforms/nrf52840/logging.c index be8486ab9..9fecf6f3a 100644 --- a/examples/platforms/nrf52840/logging.c +++ b/examples/platforms/nrf52840/logging.c @@ -46,7 +46,6 @@ #include #include -#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/nrf52840/platform-nrf5.h b/examples/platforms/nrf52840/platform-nrf5.h index 024eb7677..ee9ca435a 100644 --- a/examples/platforms/nrf52840/platform-nrf5.h +++ b/examples/platforms/nrf52840/platform-nrf5.h @@ -37,7 +37,7 @@ #include -#include +#include #include "platform-config.h" diff --git a/examples/platforms/nrf52840/radio.c b/examples/platforms/nrf52840/radio.c index 1ecc2fae3..5b31221f0 100644 --- a/examples/platforms/nrf52840/radio.c +++ b/examples/platforms/nrf52840/radio.c @@ -57,7 +57,6 @@ #include #include -#include // clang-format off diff --git a/examples/platforms/nrf52840/softdevice.c b/examples/platforms/nrf52840/softdevice.c index e0435ad3a..300d1d469 100644 --- a/examples/platforms/nrf52840/softdevice.c +++ b/examples/platforms/nrf52840/softdevice.c @@ -44,7 +44,6 @@ #include "platform-softdevice.h" #include "platform-nrf5.h" -#include #include otError nrf5SdErrorToOtError(uint32_t aSdError) diff --git a/examples/platforms/nrf52840/spi-slave.c b/examples/platforms/nrf52840/spi-slave.c index 1d46abe34..50671c74c 100644 --- a/examples/platforms/nrf52840/spi-slave.c +++ b/examples/platforms/nrf52840/spi-slave.c @@ -33,7 +33,6 @@ */ #include -#include #include #include diff --git a/examples/platforms/nrf52840/uart.c b/examples/platforms/nrf52840/uart.c index aec403ed3..2caf9552e 100644 --- a/examples/platforms/nrf52840/uart.c +++ b/examples/platforms/nrf52840/uart.c @@ -39,7 +39,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/nrf52840/usb-cdc-uart.c b/examples/platforms/nrf52840/usb-cdc-uart.c index e05c35972..9b44acd3c 100644 --- a/examples/platforms/nrf52840/usb-cdc-uart.c +++ b/examples/platforms/nrf52840/usb-cdc-uart.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/openthread-system.h b/examples/platforms/openthread-system.h index 461fcc645..8ae241c6e 100644 --- a/examples/platforms/openthread-system.h +++ b/examples/platforms/openthread-system.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_SYSTEM_H_ #define OPENTHREAD_SYSTEM_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/examples/platforms/posix/diag.c b/examples/platforms/posix/diag.c index 7a49dd91a..800a0c0be 100644 --- a/examples/platforms/posix/diag.c +++ b/examples/platforms/posix/diag.c @@ -34,7 +34,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/posix/logging.c b/examples/platforms/posix/logging.c index 5bfffcffe..777945ad8 100644 --- a/examples/platforms/posix/logging.c +++ b/examples/platforms/posix/logging.c @@ -42,6 +42,7 @@ #endif #include +#include #include "utils/code_utils.h" diff --git a/examples/platforms/posix/misc.c b/examples/platforms/posix/misc.c index 25501abd3..04c0950da 100644 --- a/examples/platforms/posix/misc.c +++ b/examples/platforms/posix/misc.c @@ -32,7 +32,6 @@ #include #endif -#include #include #include "openthread-system.h" diff --git a/examples/platforms/posix/platform-posix.h b/examples/platforms/posix/platform-posix.h index b27a9042c..11cc1d489 100644 --- a/examples/platforms/posix/platform-posix.h +++ b/examples/platforms/posix/platform-posix.h @@ -79,7 +79,7 @@ __forceinline void timersub(struct timeval *a, struct timeval *b, struct timeval #define POLL poll #endif -#include +#include #include "openthread-core-config.h" diff --git a/examples/platforms/posix/radio.c b/examples/platforms/posix/radio.c index 6716b453c..d10570a2e 100644 --- a/examples/platforms/posix/radio.c +++ b/examples/platforms/posix/radio.c @@ -30,6 +30,7 @@ #if OPENTHREAD_POSIX_VIRTUAL_TIME == 0 +#include #include #include #include diff --git a/examples/platforms/posix/random.c b/examples/platforms/posix/random.c index 7b405e851..4ae38247b 100644 --- a/examples/platforms/posix/random.c +++ b/examples/platforms/posix/random.c @@ -37,7 +37,6 @@ #include "platform-posix.h" -#include #include #include "utils/code_utils.h" diff --git a/examples/platforms/posix/sim/platform-sim.c b/examples/platforms/posix/sim/platform-sim.c index 2451fbd18..2ea08929e 100644 --- a/examples/platforms/posix/sim/platform-sim.c +++ b/examples/platforms/posix/sim/platform-sim.c @@ -45,7 +45,6 @@ #include #include -#include #include #include diff --git a/examples/platforms/posix/system.c b/examples/platforms/posix/system.c index e8b1d225c..5ab78a386 100644 --- a/examples/platforms/posix/system.c +++ b/examples/platforms/posix/system.c @@ -48,7 +48,6 @@ #include #endif -#include #include #include diff --git a/examples/platforms/samr21/logging.c b/examples/platforms/samr21/logging.c index 190a4bfa1..7dcab8294 100644 --- a/examples/platforms/samr21/logging.c +++ b/examples/platforms/samr21/logging.c @@ -34,6 +34,7 @@ #include #include #include +#include #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \ (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL) diff --git a/examples/platforms/samr21/platform-samr21.h b/examples/platforms/samr21/platform-samr21.h index 72fe31389..237087052 100644 --- a/examples/platforms/samr21/platform-samr21.h +++ b/examples/platforms/samr21/platform-samr21.h @@ -37,7 +37,7 @@ #include -#include "openthread/types.h" +#include // Global OpenThread instance structure extern otInstance *sInstance; diff --git a/examples/platforms/samr21/system.c b/examples/platforms/samr21/system.c index 94eeba111..0c237272c 100644 --- a/examples/platforms/samr21/system.c +++ b/examples/platforms/samr21/system.c @@ -34,6 +34,8 @@ #include "asf.h" +#include + #include "openthread-system.h" #include "platform-samr21.h" diff --git a/examples/platforms/utils/debug_uart.c b/examples/platforms/utils/debug_uart.c index 40d0ea214..d34a54718 100644 --- a/examples/platforms/utils/debug_uart.c +++ b/examples/platforms/utils/debug_uart.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/examples/platforms/utils/flash.h b/examples/platforms/utils/flash.h index 8ffc29e49..10c7029bb 100644 --- a/examples/platforms/utils/flash.h +++ b/examples/platforms/utils/flash.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/examples/platforms/utils/settings_flash.c b/examples/platforms/utils/settings_flash.c index 6dbcab1e4..2a29c3499 100644 --- a/examples/platforms/utils/settings_flash.c +++ b/examples/platforms/utils/settings_flash.c @@ -38,7 +38,7 @@ #include -#include +#include #include #include "utils/code_utils.h" diff --git a/include/openthread/Makefile.am b/include/openthread/Makefile.am index 737c90882..54351f34f 100644 --- a/include/openthread/Makefile.am +++ b/include/openthread/Makefile.am @@ -62,6 +62,7 @@ openthread_headers = \ dhcp6_client.h \ dhcp6_server.h \ dns.h \ + error.h \ icmp6.h \ instance.h \ ip6.h \ @@ -73,12 +74,10 @@ openthread_headers = \ ncp.h \ netdata.h \ network_time.h \ - openthread.h \ server.h \ tasklet.h \ thread.h \ thread_ftd.h \ - types.h \ udp.h \ $(NULL) diff --git a/include/openthread/border_router.h b/include/openthread/border_router.h index f4d78ff9f..9846f723b 100644 --- a/include/openthread/border_router.h +++ b/include/openthread/border_router.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_BORDER_ROUTER_H_ #define OPENTHREAD_BORDER_ROUTER_H_ -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/channel_manager.h b/include/openthread/channel_manager.h index f91d868d4..3dcf33a51 100644 --- a/include/openthread/channel_manager.h +++ b/include/openthread/channel_manager.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_CHANNEL_MANAGER_H_ #define OPENTHREAD_CHANNEL_MANAGER_H_ -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/channel_monitor.h b/include/openthread/channel_monitor.h index 669b8cf9d..b503f177e 100644 --- a/include/openthread/channel_monitor.h +++ b/include/openthread/channel_monitor.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_CHANNEL_MONITOR_H_ #define OPENTHREAD_CHANNEL_MONITOR_H_ -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/child_supervision.h b/include/openthread/child_supervision.h index fb6a5d294..4e62e9fbb 100644 --- a/include/openthread/child_supervision.h +++ b/include/openthread/child_supervision.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_CHILD_SUPERVISION_H_ #define OPENTHREAD_CHILD_SUPERVISION_H_ -#include "openthread/types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/cli.h b/include/openthread/cli.h index 798db2191..3f2bf4226 100644 --- a/include/openthread/cli.h +++ b/include/openthread/cli.h @@ -37,7 +37,9 @@ #include #include -#include + +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/coap.h b/include/openthread/coap.h index dd3c335df..f60e2e242 100644 --- a/include/openthread/coap.h +++ b/include/openthread/coap.h @@ -37,8 +37,8 @@ #include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/commissioner.h b/include/openthread/commissioner.h index b40312ddd..cc5ab0ff3 100644 --- a/include/openthread/commissioner.h +++ b/include/openthread/commissioner.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_COMMISSIONER_H_ #define OPENTHREAD_COMMISSIONER_H_ -#include +#include +#include #include #ifdef __cplusplus @@ -62,6 +63,38 @@ typedef enum otCommissionerState { OT_COMMISSIONER_STATE_ACTIVE = 2, ///< Commissioner role is active. } otCommissionerState; +#define OT_COMMISSIONING_PASSPHRASE_MIN_SIZE 6 ///< Minimum size of the Commissioning Passphrase +#define OT_COMMISSIONING_PASSPHRASE_MAX_SIZE 255 ///< Maximum size of the Commissioning Passphrase + +#define OT_STEERING_DATA_MAX_LENGTH 16 ///< Max steering data length (bytes) + +/** + * This structure represents the steering data. + * + */ +typedef struct otSteeringData +{ + uint8_t mLength; ///< Length of steering data (bytes) + uint8_t m8[OT_STEERING_DATA_MAX_LENGTH]; ///< Byte values +} otSteeringData; + +/** + * This structure represents a Commissioning Dataset. + * + */ +typedef struct otCommissioningDataset +{ + uint16_t mLocator; ///< Border Router RLOC16 + uint16_t mSessionId; ///< Commissioner Session Id + otSteeringData mSteeringData; ///< Steering Data + uint16_t mJoinerUdpPort; ///< Joiner UDP Port + + bool mIsLocatorSet : 1; ///< TRUE if Border Router RLOC16 is set, FALSE otherwise. + bool mIsSessionIdSet : 1; ///< TRUE if Commissioner Session Id is set, FALSE otherwise. + bool mIsSteeringDataSet : 1; ///< TRUE if Steering Data is set, FALSE otherwise. + bool mIsJoinerUdpPortSet : 1; ///< TRUE if Joiner UDP Port is set, FALSE otherwise. +} otCommissioningDataset; + /** * This function enables the Thread Commissioner role. * diff --git a/include/openthread/dataset.h b/include/openthread/dataset.h index 31c23d4ec..053672105 100644 --- a/include/openthread/dataset.h +++ b/include/openthread/dataset.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_DATASET_H_ #define OPENTHREAD_DATASET_H_ -#include +#include +#include #ifdef __cplusplus extern "C" { @@ -48,6 +49,206 @@ extern "C" { * */ +#define OT_MASTER_KEY_SIZE 16 ///< Size of the Thread Master Key (bytes) + +/** + * @struct otMasterKey + * + * This structure represents a Thread Master Key. + * + */ +OT_TOOL_PACKED_BEGIN +struct otMasterKey +{ + uint8_t m8[OT_MASTER_KEY_SIZE]; ///< Byte values +} OT_TOOL_PACKED_END; + +/** + * This structure represents a Thread Master Key. + * + */ +typedef struct otMasterKey otMasterKey; + +#define OT_NETWORK_NAME_MAX_SIZE 16 ///< Maximum size of the Thread Network Name field (bytes) + +/** + * This structure represents a Network Name. + * + */ +typedef struct otNetworkName +{ + char m8[OT_NETWORK_NAME_MAX_SIZE + 1]; ///< Byte values +} otNetworkName; + +#define OT_EXT_PAN_ID_SIZE 8 ///< Size of a Thread PAN ID (bytes) + +/** + * This structure represents an Extended PAN ID. + * + */ +typedef struct otExtendedPanId +{ + uint8_t m8[OT_EXT_PAN_ID_SIZE]; ///< Byte values +} otExtendedPanId; + +#define OT_MESH_LOCAL_PREFIX_SIZE 8 ///< Size of the Mesh Local Prefix (bytes) + +/** + * This structure represents a Mesh Local Prefix. + * + */ +typedef struct otMeshLocalPrefix +{ + uint8_t m8[OT_MESH_LOCAL_PREFIX_SIZE]; ///< Byte values +} otMeshLocalPrefix; + +#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes) + +/** + * This structure represents PSKc. + * + */ +typedef struct otPSKc +{ + uint8_t m8[OT_PSKC_MAX_SIZE]; ///< Byte values +} otPSKc; + +/** + * This structure represent Security Policy. + * + */ +typedef struct otSecurityPolicy +{ + uint16_t mRotationTime; ///< The value for thrKeyRotation in units of hours + uint8_t mFlags; ///< Flags as defined in Thread 1.1 Section 8.10.1.15 +} otSecurityPolicy; + +/** + * This enumeration defines the Security Policy TLV flags. + * + */ +enum +{ + OT_SECURITY_POLICY_OBTAIN_MASTER_KEY = 1 << 7, ///< Obtaining the Master Key + OT_SECURITY_POLICY_NATIVE_COMMISSIONING = 1 << 6, ///< Native Commissioning + OT_SECURITY_POLICY_ROUTERS = 1 << 5, ///< Routers enabled + OT_SECURITY_POLICY_EXTERNAL_COMMISSIONER = 1 << 4, ///< External Commissioner allowed + OT_SECURITY_POLICY_BEACONS = 1 << 3, ///< Beacons enabled +}; + +/** + * This type represents Channel Mask Page 0. + * + */ +typedef uint32_t otChannelMaskPage0; + +#define OT_CHANNEL_11_MASK (1 << 11) ///< Channel 11 +#define OT_CHANNEL_12_MASK (1 << 12) ///< Channel 12 +#define OT_CHANNEL_13_MASK (1 << 13) ///< Channel 13 +#define OT_CHANNEL_14_MASK (1 << 14) ///< Channel 14 +#define OT_CHANNEL_15_MASK (1 << 15) ///< Channel 15 +#define OT_CHANNEL_16_MASK (1 << 16) ///< Channel 16 +#define OT_CHANNEL_17_MASK (1 << 17) ///< Channel 17 +#define OT_CHANNEL_18_MASK (1 << 18) ///< Channel 18 +#define OT_CHANNEL_19_MASK (1 << 19) ///< Channel 19 +#define OT_CHANNEL_20_MASK (1 << 20) ///< Channel 20 +#define OT_CHANNEL_21_MASK (1 << 21) ///< Channel 21 +#define OT_CHANNEL_22_MASK (1 << 22) ///< Channel 22 +#define OT_CHANNEL_23_MASK (1 << 23) ///< Channel 23 +#define OT_CHANNEL_24_MASK (1 << 24) ///< Channel 24 +#define OT_CHANNEL_25_MASK (1 << 25) ///< Channel 25 +#define OT_CHANNEL_26_MASK (1 << 26) ///< Channel 26 + +#define OT_CHANNEL_ALL 0xffffffff ///< All channels + +/** + * This structure represents presence of different components in Active or Pending Operational Dataset. + * + */ +typedef struct otOperationalDatasetComponents +{ + bool mIsActiveTimestampPresent : 1; ///< TRUE if Active Timestamp is present, FALSE otherwise. + bool mIsPendingTimestampPresent : 1; ///< TRUE if Pending Timestamp is present, FALSE otherwise. + bool mIsMasterKeyPresent : 1; ///< TRUE if Network Master Key is present, FALSE otherwise. + bool mIsNetworkNamePresent : 1; ///< TRUE if Network Name is present, FALSE otherwise. + bool mIsExtendedPanIdPresent : 1; ///< TRUE if Extended PAN ID is present, FALSE otherwise. + bool mIsMeshLocalPrefixPresent : 1; ///< TRUE if Mesh Local Prefix is present, FALSE otherwise. + bool mIsDelayPresent : 1; ///< TRUE if Delay Timer is present, FALSE otherwise. + bool mIsPanIdPresent : 1; ///< TRUE if PAN ID is present, FALSE otherwise. + bool mIsChannelPresent : 1; ///< TRUE if Channel is present, FALSE otherwise. + bool mIsPSKcPresent : 1; ///< TRUE if PSKc is present, FALSE otherwise. + bool mIsSecurityPolicyPresent : 1; ///< TRUE if Security Policy is present, FALSE otherwise. + bool mIsChannelMaskPage0Present : 1; ///< TRUE if Channel Mask Page 0 is present, FALSE otherwise. +} otOperationalDatasetComponents; + +/** + * This structure represents an Active or Pending Operational Dataset. + * + * Components in Dataset are optional. `mComponets` structure specifies which components are present in the Dataset. + * + */ +typedef struct otOperationalDataset +{ + uint64_t mActiveTimestamp; ///< Active Timestamp + uint64_t mPendingTimestamp; ///< Pending Timestamp + otMasterKey mMasterKey; ///< Network Master Key + otNetworkName mNetworkName; ///< Network Name + otExtendedPanId mExtendedPanId; ///< Extended PAN ID + otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix + uint32_t mDelay; ///< Delay Timer + otPanId mPanId; ///< PAN ID + uint16_t mChannel; ///< Channel + otPSKc mPSKc; ///< PSKc + otSecurityPolicy mSecurityPolicy; ///< Security Policy + otChannelMaskPage0 mChannelMaskPage0; ///< Channel Mask Page 0 + otOperationalDatasetComponents mComponents; ///< Specifies which components are set in the Dataset. +} otOperationalDataset; + +/** + * This enumeration represents meshcop TLV types. + * + */ +typedef enum otMeshcopTlvType { + OT_MESHCOP_TLV_CHANNEL = 0, ///< meshcop Channel TLV + OT_MESHCOP_TLV_PANID = 1, ///< meshcop Pan Id TLV + OT_MESHCOP_TLV_EXTPANID = 2, ///< meshcop Extended Pan Id TLV + OT_MESHCOP_TLV_NETWORKNAME = 3, ///< meshcop Network Name TLV + OT_MESHCOP_TLV_PSKC = 4, ///< meshcop PSKc TLV + OT_MESHCOP_TLV_MASTERKEY = 5, ///< meshcop Network Master Key TLV + OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE = 6, ///< meshcop Network Key Sequence TLV + OT_MESHCOP_TLV_MESHLOCALPREFIX = 7, ///< meshcop Mesh Local Prefix TLV + OT_MESHCOP_TLV_STEERING_DATA = 8, ///< meshcop Steering Data TLV + OT_MESHCOP_TLV_BORDER_AGENT_RLOC = 9, ///< meshcop Border Agent Locator TLV + OT_MESHCOP_TLV_COMMISSIONER_ID = 10, ///< meshcop Commissioner ID TLV + OT_MESHCOP_TLV_COMM_SESSION_ID = 11, ///< meshcop Commissioner Session ID TLV + OT_MESHCOP_TLV_SECURITYPOLICY = 12, ///< meshcop Security Policy TLV + OT_MESHCOP_TLV_GET = 13, ///< meshcop Get TLV + OT_MESHCOP_TLV_ACTIVETIMESTAMP = 14, ///< meshcop Active Timestamp TLV + OT_MESHCOP_TLV_STATE = 16, ///< meshcop State TLV + OT_MESHCOP_TLV_JOINER_DTLS = 17, ///< meshcop Joiner DTLS Encapsulation TLV + OT_MESHCOP_TLV_JOINER_UDP_PORT = 18, ///< meshcop Joiner UDP Port TLV + OT_MESHCOP_TLV_JOINER_IID = 19, ///< meshcop Joiner IID TLV + OT_MESHCOP_TLV_JOINER_RLOC = 20, ///< meshcop Joiner Router Locator TLV + OT_MESHCOP_TLV_JOINER_ROUTER_KEK = 21, ///< meshcop Joiner Router KEK TLV + OT_MESHCOP_TLV_PROVISIONING_URL = 32, ///< meshcop Provisioning URL TLV + OT_MESHCOP_TLV_VENDOR_NAME_TLV = 33, ///< meshcop Vendor Name TLV + OT_MESHCOP_TLV_VENDOR_MODEL_TLV = 34, ///< meshcop Vendor Model TLV + OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV = 35, ///< meshcop Vendor SW Version TLV + OT_MESHCOP_TLV_VENDOR_DATA_TLV = 36, ///< meshcop Vendor Data TLV + OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV = 37, ///< meshcop Vendor Stack Version TLV + OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV = 48, ///< meshcop UDP encapsulation TLV + OT_MESHCOP_TLV_IPV6_ADDRESS_TLV = 49, ///< meshcop IPv6 address TLV + OT_MESHCOP_TLV_PENDINGTIMESTAMP = 51, ///< meshcop Pending Timestamp TLV + OT_MESHCOP_TLV_DELAYTIMER = 52, ///< meshcop Delay Timer TLV + OT_MESHCOP_TLV_CHANNELMASK = 53, ///< meshcop Channel Mask TLV + OT_MESHCOP_TLV_COUNT = 54, ///< meshcop Count TLV + OT_MESHCOP_TLV_PERIOD = 55, ///< meshcop Period TLV + OT_MESHCOP_TLV_SCAN_DURATION = 56, ///< meshcop Scan Duration TLV + OT_MESHCOP_TLV_ENERGY_LIST = 57, ///< meshcop Energy List TLV + OT_MESHCOP_TLV_DISCOVERYREQUEST = 128, ///< meshcop Discovery Request TLV + OT_MESHCOP_TLV_DISCOVERYRESPONSE = 129, ///< meshcop Discovery Response TLV +} otMeshcopTlvType; + /** * This function indicates whether a valid network is present in the Active Operational Dataset or not. * diff --git a/include/openthread/dataset_ftd.h b/include/openthread/dataset_ftd.h index 0d7388698..de6251f95 100644 --- a/include/openthread/dataset_ftd.h +++ b/include/openthread/dataset_ftd.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_DATASET_FTD_H_ #define OPENTHREAD_DATASET_FTD_H_ -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dhcp6_client.h b/include/openthread/dhcp6_client.h index 78c9a55f4..751dc2642 100644 --- a/include/openthread/dhcp6_client.h +++ b/include/openthread/dhcp6_client.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_DHCP6_CLIENT_H_ #define OPENTHREAD_DHCP6_CLIENT_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dhcp6_server.h b/include/openthread/dhcp6_server.h index 3cba3683d..074b062ce 100644 --- a/include/openthread/dhcp6_server.h +++ b/include/openthread/dhcp6_server.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_DHCP6_SERVER_H_ #define OPENTHREAD_DHCP6_SERVER_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/diag.h b/include/openthread/diag.h index e43040376..87a61e7cd 100644 --- a/include/openthread/diag.h +++ b/include/openthread/diag.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_DIAG_H_ #define OPENTHREAD_DIAG_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dns.h b/include/openthread/dns.h index e3f78bbe0..9f06195ec 100644 --- a/include/openthread/dns.h +++ b/include/openthread/dns.h @@ -35,8 +35,8 @@ #ifndef OPENTHREAD_DNS_H_ #define OPENTHREAD_DNS_H_ +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/openthread.h b/include/openthread/error.h similarity index 54% rename from include/openthread/openthread.h rename to include/openthread/error.h index 8b4c1da02..42884985b 100644 --- a/include/openthread/openthread.h +++ b/include/openthread/error.h @@ -29,22 +29,13 @@ /** * @file * @brief - * This file defines the top-level functions for the OpenThread library. + * This file defines the errors used in the OpenThread. */ -#ifndef OPENTHREAD_H_ -#define OPENTHREAD_H_ +#ifndef OPENTHREAD_ERROR_H_ +#define OPENTHREAD_ERROR_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #ifdef __cplusplus extern "C" { @@ -57,7 +48,7 @@ extern "C" { * * @{ * - * @defgroup api-types Types + * @defgroup api-error Error * * @defgroup api-execution Execution * @@ -161,12 +152,196 @@ extern "C" { */ /** - * Get the OpenThread version string. + * @addtogroup api-error * - * @returns A pointer to the OpenThread version. + * @brief + * This module includes error definitions used in OpenThread. + * + * @{ * */ -OTAPI const char *OTCALL otGetVersionString(void); + +/** + * This enumeration represents error codes used throughout OpenThread. + * + */ +typedef enum otError { + /** + * No error. + */ + OT_ERROR_NONE = 0, + + /** + * Operational failed. + */ + OT_ERROR_FAILED = 1, + + /** + * Message was dropped. + */ + OT_ERROR_DROP = 2, + + /** + * Insufficient buffers. + */ + OT_ERROR_NO_BUFS = 3, + + /** + * No route available. + */ + OT_ERROR_NO_ROUTE = 4, + + /** + * Service is busy and could not service the operation. + */ + OT_ERROR_BUSY = 5, + + /** + * Failed to parse message or arguments. + */ + OT_ERROR_PARSE = 6, + + /** + * Input arguments are invalid. + */ + OT_ERROR_INVALID_ARGS = 7, + + /** + * Security checks failed. + */ + OT_ERROR_SECURITY = 8, + + /** + * Address resolution requires an address query operation. + */ + OT_ERROR_ADDRESS_QUERY = 9, + + /** + * Address is not in the source match table. + */ + OT_ERROR_NO_ADDRESS = 10, + + /** + * Operation was aborted. + */ + OT_ERROR_ABORT = 11, + + /** + * Function or method is not implemented. + */ + OT_ERROR_NOT_IMPLEMENTED = 12, + + /** + * Cannot complete due to invalid state. + */ + OT_ERROR_INVALID_STATE = 13, + + /** + * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006). + */ + OT_ERROR_NO_ACK = 14, + + /** + * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed + * (IEEE 802.15.4-2006). + */ + OT_ERROR_CHANNEL_ACCESS_FAILURE = 15, + + /** + * Not currently attached to a Thread Partition. + */ + OT_ERROR_DETACHED = 16, + + /** + * FCS check failure while receiving. + */ + OT_ERROR_FCS = 17, + + /** + * No frame received. + */ + OT_ERROR_NO_FRAME_RECEIVED = 18, + + /** + * Received a frame from an unknown neighbor. + */ + OT_ERROR_UNKNOWN_NEIGHBOR = 19, + + /** + * Received a frame from an invalid source address. + */ + OT_ERROR_INVALID_SOURCE_ADDRESS = 20, + + /** + * Received a frame filtered by the address filter (whitelisted or blacklisted). + */ + OT_ERROR_ADDRESS_FILTERED = 21, + + /** + * Received a frame filtered by the destination address check. + */ + OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22, + + /** + * The requested item could not be found. + */ + OT_ERROR_NOT_FOUND = 23, + + /** + * The operation is already in progress. + */ + OT_ERROR_ALREADY = 24, + + /** + * The creation of IPv6 address failed. + */ + OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26, + + /** + * Operation prevented by mode flags + */ + OT_ERROR_NOT_CAPABLE = 27, + + /** + * Coap response or acknowledgment or DNS response not received. + */ + OT_ERROR_RESPONSE_TIMEOUT = 28, + + /** + * Received a duplicated frame. + */ + OT_ERROR_DUPLICATED = 29, + + /** + * Message is being dropped from reassembly list due to timeout. + */ + OT_ERROR_REASSEMBLY_TIMEOUT = 30, + + /** + * Message is not a TMF Message. + */ + OT_ERROR_NOT_TMF = 31, + + /** + * Received a non-lowpan data frame. + */ + OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32, + + /** + * A feature/functionality disabled by build-time configuration options. + */ + OT_ERROR_DISABLED_FEATURE = 33, + + /** + * The link margin was too low. + */ + OT_ERROR_LINK_MARGIN_LOW = 34, + + /** + * Generic error (should not use). + */ + OT_ERROR_GENERIC = 255, +} otError; /** * This function converts an otError enum into a string. @@ -178,8 +353,13 @@ OTAPI const char *OTCALL otGetVersionString(void); */ OTAPI const char *OTCALL otThreadErrorToString(otError aError); +/** + * @} + * + */ + #ifdef __cplusplus } // extern "C" #endif -#endif // OPENTHREAD_H_ +#endif // OPENTHREAD_ERROR_H_ diff --git a/include/openthread/icmp6.h b/include/openthread/icmp6.h index 3c991e8b4..0fa25599b 100644 --- a/include/openthread/icmp6.h +++ b/include/openthread/icmp6.h @@ -35,8 +35,8 @@ #ifndef OPENTHREAD_ICMP6_H_ #define OPENTHREAD_ICMP6_H_ +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 3f1878291..eeae641a9 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -36,9 +36,13 @@ #define OPENTHREAD_INSTANCE_H_ #include +#ifdef OTDLL +#include +#endif -#include +#include #include +#include #ifdef __cplusplus extern "C" { @@ -54,8 +58,39 @@ extern "C" { * */ +/** + * This structure represents the OpenThread instance structure. + */ +typedef struct otInstance otInstance; + #ifdef OTDLL +/** + * This structure represents the handle to the OpenThread API. + * + */ +typedef struct otApiInstance otApiInstance; + +/** + * This structure represents a list of device GUIDs. + * + */ +typedef struct otDeviceList +{ + uint16_t aDevicesLength; + GUID aDevices[1]; +} otDeviceList; + +/** + * This function pointer is called to notify addition and removal of OpenThread devices. + * + * @param[in] aAdded A flag indicating if the device was added or removed. + * @param[in] aDeviceGuid A GUID indicating which device state changed. + * @param[in] aContext A pointer to application-specific context. + * + */ +typedef void(OTCALL *otDeviceAvailabilityChangedCallback)(bool aAdded, const GUID *aDeviceGuid, void *aContext); + /** * This function initializes a new instance of the OpenThread library. * @@ -343,6 +378,14 @@ otLogLevel otGetDynamicLogLevel(otInstance *aInstance); */ otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel); +/** + * Get the OpenThread version string. + * + * @returns A pointer to the OpenThread version. + * + */ +OTAPI const char *OTCALL otGetVersionString(void); + /** * @} * diff --git a/include/openthread/ip6.h b/include/openthread/ip6.h index 6ccc69d61..c2db49d8e 100644 --- a/include/openthread/ip6.h +++ b/include/openthread/ip6.h @@ -52,6 +52,135 @@ extern "C" { * */ +#define OT_IP6_PREFIX_SIZE 8 ///< Size of an IPv6 prefix (bytes) +#define OT_IP6_IID_SIZE 8 ///< Size of an IPv6 Interface Identifier (bytes) +#define OT_IP6_ADDRESS_SIZE 16 ///< Size of an IPv6 address (bytes) + +/** + * @struct otIp6Address + * + * This structure represents an IPv6 address. + * + */ +OT_TOOL_PACKED_BEGIN +struct otIp6Address +{ + union OT_TOOL_PACKED_FIELD + { + uint8_t m8[OT_IP6_ADDRESS_SIZE]; ///< 8-bit fields + uint16_t m16[OT_IP6_ADDRESS_SIZE / sizeof(uint16_t)]; ///< 16-bit fields + uint32_t m32[OT_IP6_ADDRESS_SIZE / sizeof(uint32_t)]; ///< 32-bit fields + } mFields; ///< IPv6 accessor fields +} OT_TOOL_PACKED_END; + +/** + * This structure represents an IPv6 address. + * + */ +typedef struct otIp6Address otIp6Address; + +/** + * This structure represents an IPv6 prefix. + * + */ +OT_TOOL_PACKED_BEGIN +struct otIp6Prefix +{ + otIp6Address mPrefix; ///< The IPv6 prefix. + uint8_t mLength; ///< The IPv6 prefix length. +} OT_TOOL_PACKED_END; + +/** + * This structure represents an IPv6 prefix. + * + */ +typedef struct otIp6Prefix otIp6Prefix; + +/** + * This structure represents an IPv6 network interface unicast address. + * + */ +typedef struct otNetifAddress +{ + otIp6Address mAddress; ///< The IPv6 unicast address. + uint8_t mPrefixLength; ///< The Prefix length. + bool mPreferred : 1; ///< TRUE if the address is preferred, FALSE otherwise. + bool mValid : 1; ///< TRUE if the address is valid, FALSE otherwise. + bool mScopeOverrideValid : 1; ///< TRUE if the mScopeOverride value is valid, FALSE otherwise. + unsigned int mScopeOverride : 4; ///< The IPv6 scope of this address. + bool mRloc : 1; ///< TRUE if the address is an RLOC, FALSE otherwise. + struct otNetifAddress *mNext; ///< A pointer to the next network interface address. +} otNetifAddress; + +/** + * This structure represents an IPv6 network interface multicast address. + * + */ +typedef struct otNetifMulticastAddress +{ + otIp6Address mAddress; ///< The IPv6 multicast address. + const struct otNetifMulticastAddress *mNext; ///< A pointer to the next network interface multicast address. +} otNetifMulticastAddress; + +/** + * This enumeration represents the list of allowable values for an InterfaceId. + * + */ +typedef enum otNetifInterfaceId { + OT_NETIF_INTERFACE_ID_HOST = -1, ///< The interface ID telling packets received by host side interfaces. + OT_NETIF_INTERFACE_ID_THREAD = 1, ///< The Thread Network interface ID. +} otNetifInterfaceId; + +/** + * This structure represents data used by Semantically Opaque IID Generator. + * + */ +typedef struct +{ + uint8_t *mInterfaceId; ///< String of bytes representing interface ID. Like "eth0" or "wlan0". + uint8_t mInterfaceIdLength; ///< Length of interface ID string. + + uint8_t *mNetworkId; ///< Network ID (or name). Can be null if mNetworkIdLength is 0. + uint8_t mNetworkIdLength; ///< Length of Network ID string. + + uint8_t mDadCounter; ///< Duplicate address detection counter. + + uint8_t *mSecretKey; ///< Secret key used to create IID. Cannot be null. + uint16_t mSecretKeyLength; ///< Secret key length in bytes. Should be at least 16 bytes == 128 bits. +} otSemanticallyOpaqueIidGeneratorData; + +/** + * This structure represents an IPv6 socket address. + * + */ +typedef struct otSockAddr +{ + otIp6Address mAddress; ///< An IPv6 address. + uint16_t mPort; ///< A transport-layer port. + int8_t mScopeId; ///< An IPv6 scope identifier. +} otSockAddr; + +/** + * This structure represents the local and peer IPv6 socket addresses. + * + */ +typedef struct otMessageInfo +{ + otIp6Address mSockAddr; ///< The local IPv6 address. + otIp6Address mPeerAddr; ///< The peer IPv6 address. + uint16_t mSockPort; ///< The local transport-layer port. + uint16_t mPeerPort; ///< The peer transport-layer port. + int8_t mInterfaceId; ///< The IPv6 interface identifier. + uint8_t mHopLimit; ///< The IPv6 hop limit. + + /** + * A pointer to link-specific information. In case @p mInterfaceId is set to OT_NETIF_INTERFACE_ID_THREAD, + * @p mLinkInfo points to @sa otThreadLinkInfo. This field is only valid for messages received from the + * Thread radio and is ignored on transmission. + */ + const void *mLinkInfo; +} otMessageInfo; + /** * This function brings up the IPv6 interface. * diff --git a/include/openthread/jam_detection.h b/include/openthread/jam_detection.h index 6c9bbb7d0..0dc11f882 100644 --- a/include/openthread/jam_detection.h +++ b/include/openthread/jam_detection.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_JAM_DETECTION_H_ #define OPENTHREAD_JAM_DETECTION_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/joiner.h b/include/openthread/joiner.h index af31e7d39..35c7f0ff0 100644 --- a/include/openthread/joiner.h +++ b/include/openthread/joiner.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_JOINER_H_ #define OPENTHREAD_JOINER_H_ -#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/link.h b/include/openthread/link.h index 6d6908084..222268bc7 100644 --- a/include/openthread/link.h +++ b/include/openthread/link.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_LINK_H_ #define OPENTHREAD_LINK_H_ -#include +#include +#include #include #ifdef __cplusplus @@ -52,6 +53,124 @@ extern "C" { * */ +/** + * This structure represents link-specific information for messages received from the Thread radio. + * + */ +typedef struct otThreadLinkInfo +{ + uint16_t mPanId; ///< Source PAN ID + uint8_t mChannel; ///< 802.15.4 Channel + int8_t mRss; ///< Received Signal Strength in dBm. + uint8_t mLqi; ///< Link Quality Indicator for a received message. + bool mLinkSecurity; ///< Indicates whether or not link security is enabled. + + // Applicable/Required only when time sync feature (`OPENTHREAD_CONFIG_ENABLE_TIME_SYNC`) is enabled. + uint8_t mTimeSyncSeq; ///< The time sync sequence. + int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time, in microseconds. +} otThreadLinkInfo; + +/** + * Used to indicate no fixed received signal strength was set + * + */ +#define OT_MAC_FILTER_FIXED_RSS_DISABLED 127 + +#define OT_MAC_FILTER_ITERATOR_INIT 0 ///< Initializer for otMacFilterIterator. + +typedef uint8_t otMacFilterIterator; ///< Used to iterate through mac filter entries. + +/** + * Defines address mode of the mac filter. + * + */ +typedef enum otMacFilterAddressMode { + OT_MAC_FILTER_ADDRESS_MODE_DISABLED, ///< Address filter is disabled. + OT_MAC_FILTER_ADDRESS_MODE_WHITELIST, ///< Whitelist address filter mode is enabled. + OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST, ///< Blacklist address filter mode is enabled. +} otMacFilterAddressMode; + +/** + * This structure represents a Mac Filter entry. + * + */ +typedef struct otMacFilterEntry +{ + otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address + int8_t mRssIn; ///< Received signal strength + bool mFiltered; ///< Indicates whether or not this entry is filtered. +} otMacFilterEntry; + +/** + * This structure represents the MAC layer counters. + * + */ +typedef struct otMacCounters +{ + uint32_t mTxTotal; ///< The total number of transmissions. + uint32_t mTxUnicast; ///< The total number of unicast transmissions. + uint32_t mTxBroadcast; ///< The total number of broadcast transmissions. + uint32_t mTxAckRequested; ///< The number of transmissions with ack request. + uint32_t mTxAcked; ///< The number of transmissions that were acked. + uint32_t mTxNoAckRequested; ///< The number of transmissions without ack request. + uint32_t mTxData; ///< The number of transmitted data. + uint32_t mTxDataPoll; ///< The number of transmitted data poll. + uint32_t mTxBeacon; ///< The number of transmitted beacon. + uint32_t mTxBeaconRequest; ///< The number of transmitted beacon request. + uint32_t mTxOther; ///< The number of transmitted other types of frames. + uint32_t mTxRetry; ///< The number of retransmission times. + uint32_t mTxErrCca; ///< The number of CCA failure times. + uint32_t mTxErrAbort; ///< The number of frame transmission failures due to abort error. + uint32_t mTxErrBusyChannel; ///< The number of frames that were dropped due to a busy channel. + uint32_t mRxTotal; ///< The total number of received packets. + uint32_t mRxUnicast; ///< The total number of unicast packets received. + uint32_t mRxBroadcast; ///< The total number of broadcast packets received. + uint32_t mRxData; ///< The number of received data. + uint32_t mRxDataPoll; ///< The number of received data poll. + uint32_t mRxBeacon; ///< The number of received beacon. + uint32_t mRxBeaconRequest; ///< The number of received beacon request. + uint32_t mRxOther; ///< The number of received other types of frames. + uint32_t mRxAddressFiltered; ///< The number of received packets filtered by address filter. + uint32_t mRxDestAddrFiltered; ///< The number of received packets filtered by destination check. + uint32_t mRxDuplicated; ///< The number of received duplicated packets. + uint32_t mRxErrNoFrame; ///< The number of received packets with no or malformed content. + uint32_t mRxErrUnknownNeighbor; ///< The number of received packets from unknown neighbor. + uint32_t mRxErrInvalidSrcAddr; ///< The number of received packets whose source address is invalid. + uint32_t mRxErrSec; ///< The number of received packets with security error. + uint32_t mRxErrFcs; ///< The number of received packets with FCS error. + uint32_t mRxErrOther; ///< The number of received packets with other error. +} otMacCounters; + +/** + * This structure represents a received IEEE 802.15.4 Beacon. + * + */ +typedef struct otActiveScanResult +{ + otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address + otNetworkName mNetworkName; ///< Thread Network Name + otExtendedPanId mExtendedPanId; ///< Thread Extended PAN ID + otSteeringData mSteeringData; ///< Steering Data + uint16_t mPanId; ///< IEEE 802.15.4 PAN ID + uint16_t mJoinerUdpPort; ///< Joiner UDP Port + uint8_t mChannel; ///< IEEE 802.15.4 Channel + int8_t mRssi; ///< RSSI (dBm) + uint8_t mLqi; ///< LQI + unsigned int mVersion : 4; ///< Version + bool mIsNative : 1; ///< Native Commissioner flag + bool mIsJoinable : 1; ///< Joining Permitted flag +} otActiveScanResult; + +/** + * This structure represents an energy scan result. + * + */ +typedef struct otEnergyScanResult +{ + uint8_t mChannel; ///< IEEE 802.15.4 Channel + int8_t mMaxRssi; ///< The max RSSI (dBm) +} otEnergyScanResult; + /** * This function pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or * the scan completes. diff --git a/include/openthread/link_raw.h b/include/openthread/link_raw.h index 78ee860f8..968ede23b 100644 --- a/include/openthread/link_raw.h +++ b/include/openthread/link_raw.h @@ -35,7 +35,6 @@ #ifndef OPENTHREAD_LINK_RAW_H_ #define OPENTHREAD_LINK_RAW_H_ -#include #include #ifdef __cplusplus diff --git a/include/openthread/message.h b/include/openthread/message.h index a20a19fa7..62a9b3d4a 100644 --- a/include/openthread/message.h +++ b/include/openthread/message.h @@ -35,7 +35,8 @@ #ifndef OPENTHREAD_MESSAGE_H_ #define OPENTHREAD_MESSAGE_H_ -#include +#include +#include #ifdef __cplusplus extern "C" { @@ -51,6 +52,42 @@ extern "C" { * */ +/** + * This structure points to an OpenThread message buffer. + */ +typedef struct otMessage +{ + struct otMessage *mNext; ///< A pointer to the next Message buffer. +} otMessage; + +/** + * This structure represents the message buffer information. + * + */ +typedef struct otBufferInfo +{ + uint16_t mTotalBuffers; ///< The number of buffers in the pool. + uint16_t mFreeBuffers; ///< The number of free message buffers. + uint16_t m6loSendMessages; ///< The number of messages in the 6lo send queue. + uint16_t m6loSendBuffers; ///< The number of buffers in the 6lo send queue. + uint16_t m6loReassemblyMessages; ///< The number of messages in the 6LoWPAN reassembly queue. + uint16_t m6loReassemblyBuffers; ///< The number of buffers in the 6LoWPAN reassembly queue. + uint16_t mIp6Messages; ///< The number of messages in the IPv6 send queue. + uint16_t mIp6Buffers; ///< The number of buffers in the IPv6 send queue. + uint16_t mMplMessages; ///< The number of messages in the MPL send queue. + uint16_t mMplBuffers; ///< The number of buffers in the MPL send queue. + uint16_t mMleMessages; ///< The number of messages in the MLE send queue. + uint16_t mMleBuffers; ///< The number of buffers in the MLE send queue. + uint16_t mArpMessages; ///< The number of messages in the ARP send queue. + uint16_t mArpBuffers; ///< The number of buffers in the ARP send queue. + uint16_t mCoapMessages; ///< The number of messages in the CoAP send queue. + uint16_t mCoapBuffers; ///< The number of buffers in the CoAP send queue. + uint16_t mCoapSecureMessages; ///< The number of messages in the CoAP secure send queue. + uint16_t mCoapSecureBuffers; ///< The number of buffers in the CoAP secure send queue. + uint16_t mApplicationCoapMessages; ///< The number of messages in the application CoAP send queue. + uint16_t mApplicationCoapBuffers; ///< The number of buffers in the application CoAP send queue. +} otBufferInfo; + /** * Free an allocated message buffer. * diff --git a/include/openthread/ncp.h b/include/openthread/ncp.h index 76f3c589a..98ef8b622 100644 --- a/include/openthread/ncp.h +++ b/include/openthread/ncp.h @@ -36,7 +36,9 @@ #define OPENTHREAD_NCP_H_ #include -#include + +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h index 4f756ed34..caeab6a89 100644 --- a/include/openthread/netdata.h +++ b/include/openthread/netdata.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_NETDATA_H_ #define OPENTHREAD_NETDATA_H_ -#include +#include #ifdef __cplusplus extern "C" { @@ -48,6 +48,114 @@ extern "C" { * */ +#define OT_NETWORK_DATA_ITERATOR_INIT 0 ///< Initializer for otNetworkDataIterator. + +typedef uint32_t otNetworkDataIterator; ///< Used to iterate through Network Data information. + +/** + * This structure represents a Border Router configuration. + */ +typedef struct otBorderRouterConfig +{ + /** + * The IPv6 prefix. + */ + otIp6Prefix mPrefix; + + /** + * A 2-bit signed integer indicating router preference as defined in RFC 4191. + */ + int mPreference : 2; + + /** + * TRUE, if @p mPrefix is preferred. FALSE, otherwise. + */ + bool mPreferred : 1; + + /** + * TRUE, if @p mPrefix should be used for address autoconfiguration. FALSE, otherwise. + */ + bool mSlaac : 1; + + /** + * TRUE, if this border router is a DHCPv6 Agent that supplies IPv6 address configuration. FALSE, otherwise. + */ + bool mDhcp : 1; + + /** + * TRUE, if this border router is a DHCPv6 Agent that supplies other configuration data. FALSE, otherwise. + */ + bool mConfigure : 1; + + /** + * TRUE, if this border router is a default route for @p mPrefix. FALSE, otherwise. + */ + bool mDefaultRoute : 1; + + /** + * TRUE, if this prefix is considered on-mesh. FALSE, otherwise. + */ + bool mOnMesh : 1; + + /** + * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. + */ + bool mStable : 1; + + /** + * The Border Agent Rloc. + */ + uint16_t mRloc16; +} otBorderRouterConfig; + +/** + * This structure represents an External Route configuration. + * + */ +typedef struct otExternalRouteConfig +{ + /** + * The prefix for the off-mesh route. + */ + otIp6Prefix mPrefix; + + /** + * The Rloc associated with the external route entry. + * + * This value is ignored when adding an external route. For any added route, the device's Rloc is used. + */ + uint16_t mRloc16; + + /** + * A 2-bit signed integer indicating router preference as defined in RFC 4191. + */ + int mPreference : 2; + + /** + * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. + */ + bool mStable : 1; + + /** + * TRUE if the external route entry's next hop is this device itself (i.e., the route was added earlier by this + * device). FALSE otherwise. + * + * This value is ignored when adding an external route. For any added route the next hop is this device. + */ + bool mNextHopIsThisDevice : 1; + +} otExternalRouteConfig; + +/** + * Defines valid values for member mPreference in otExternalRouteConfig and otBorderRouterConfig. + * + */ +typedef enum otRoutePreference { + OT_ROUTE_PREFERENCE_LOW = -1, ///< Low route preference. + OT_ROUTE_PREFERENCE_MED = 0, ///< Medium route preference. + OT_ROUTE_PREFERENCE_HIGH = 1, ///< High route preference. +} otRoutePreference; + /** * This method provides a full or stable copy of the Leader's Thread Network Data. * diff --git a/include/openthread/network_time.h b/include/openthread/network_time.h index 4401c049b..83adaa2f5 100644 --- a/include/openthread/network_time.h +++ b/include/openthread/network_time.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_NETWORK_TIME_H_ #define OPENTHREAD_NETWORK_TIME_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/alarm-micro.h b/include/openthread/platform/alarm-micro.h index 895b65019..e61640740 100644 --- a/include/openthread/platform/alarm-micro.h +++ b/include/openthread/platform/alarm-micro.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/alarm-milli.h b/include/openthread/platform/alarm-milli.h index 15b8a0260..dd7220163 100644 --- a/include/openthread/platform/alarm-milli.h +++ b/include/openthread/platform/alarm-milli.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/ble.h b/include/openthread/platform/ble.h index 0d14450ee..bffb97ab2 100644 --- a/include/openthread/platform/ble.h +++ b/include/openthread/platform/ble.h @@ -42,7 +42,7 @@ extern "C" { #include -#include +#include /** * @addtogroup plat-ble diff --git a/include/openthread/platform/debug_uart.h b/include/openthread/platform/debug_uart.h index d9d1ca706..938c193d7 100644 --- a/include/openthread/platform/debug_uart.h +++ b/include/openthread/platform/debug_uart.h @@ -29,6 +29,7 @@ #ifndef OPENTHREAD_PLATFORM_DEBUG_UART_H_ #define OPENTHREAD_PLATFORM_DEBUG_UART_H_ +#include #include /** diff --git a/include/openthread/platform/diag.h b/include/openthread/platform/diag.h index 13e5e9ae8..5413725cb 100644 --- a/include/openthread/platform/diag.h +++ b/include/openthread/platform/diag.h @@ -39,7 +39,7 @@ #include #include -#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/platform/logging.h b/include/openthread/platform/logging.h index a4f8703c7..b2c5bc14f 100644 --- a/include/openthread/platform/logging.h +++ b/include/openthread/platform/logging.h @@ -38,8 +38,6 @@ #include #include -#include - #ifdef __cplusplus extern "C" { #endif @@ -55,20 +53,87 @@ extern "C" { */ /** - * Log levels. + * Log level None. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. * - * Implementation note: These exist as defines (not enums) so that - * embedded code can remove code at compile time via if/else/endif */ +#define OT_LOG_LEVEL_NONE 0 -#define OT_LOG_LEVEL_NONE 0 ///< None -#define OT_LOG_LEVEL_CRIT 1 ///< Critical -#define OT_LOG_LEVEL_WARN 2 ///< Warning -#define OT_LOG_LEVEL_NOTE 3 ///< Note -#define OT_LOG_LEVEL_INFO 4 ///< Info -#define OT_LOG_LEVEL_DEBG 5 ///< Debug +/** + * Log level Critical. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_CRIT 1 -/* note: The enum otLogRegion is found in 'openthread/types.h' */ +/** + * Log level Warning. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_WARN 2 + +/** + * Log level Notice. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_NOTE 3 + +/** + * Log level Informational. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_INFO 4 + +/** + * Log level Debug. + * + * @note Log Levels are defines so that embedded implementations can eliminate code at compile time via + * #if/#else/#endif. + * + */ +#define OT_LOG_LEVEL_DEBG 5 + +/** + * This type represents the log level. + * + */ +typedef uint8_t otLogLevel; + +/** + * This enumeration represents log regions. + * + */ +typedef enum otLogRegion { + OT_LOG_REGION_API = 1, ///< OpenThread API + OT_LOG_REGION_MLE = 2, ///< MLE + OT_LOG_REGION_ARP = 3, ///< EID-to-RLOC mapping. + OT_LOG_REGION_NET_DATA = 4, ///< Network Data + OT_LOG_REGION_ICMP = 5, ///< ICMPv6 + OT_LOG_REGION_IP6 = 6, ///< IPv6 + OT_LOG_REGION_MAC = 7, ///< IEEE 802.15.4 MAC + OT_LOG_REGION_MEM = 8, ///< Memory + OT_LOG_REGION_NCP = 9, ///< NCP + OT_LOG_REGION_MESH_COP = 10, ///< Mesh Commissioning Protocol + OT_LOG_REGION_NET_DIAG = 11, ///< Network Diagnostic + OT_LOG_REGION_PLATFORM = 12, ///< Platform + OT_LOG_REGION_COAP = 13, ///< CoAP + OT_LOG_REGION_CLI = 14, ///< CLI + OT_LOG_REGION_CORE = 15, ///< OpenThread Core + OT_LOG_REGION_UTIL = 16, ///< Utility module +} otLogRegion; /** * This function outputs logs. diff --git a/include/openthread/platform/messagepool.h b/include/openthread/platform/messagepool.h index e7b4d62d9..3391c4a21 100644 --- a/include/openthread/platform/messagepool.h +++ b/include/openthread/platform/messagepool.h @@ -38,7 +38,6 @@ #include #include -#include /** * @addtogroup plat-messagepool diff --git a/include/openthread/platform/misc.h b/include/openthread/platform/misc.h index 364e5de97..7b87b8183 100644 --- a/include/openthread/platform/misc.h +++ b/include/openthread/platform/misc.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 15b99174c..f1f3066b3 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -38,7 +38,8 @@ #include -#include +#include +#include #ifdef __cplusplus extern "C" { @@ -92,6 +93,40 @@ typedef enum otRadioCaps { OT_RADIO_CAPS_CSMA_BACKOFF = 8, ///< Radio supports CSMA backoff for frame transmission (but no retry). } otRadioCaps; +#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID + +/** + * This type represents the IEEE 802.15.4 PAN ID. + * + */ +typedef uint16_t otPanId; + +/** + * This type represents the IEEE 802.15.4 Short Address. + * + */ +typedef uint16_t otShortAddress; + +#define OT_EXT_ADDRESS_SIZE 8 ///< Size of an IEEE 802.15.4 Extended Address (bytes) + +/** + * @struct otExtAddress + * + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +OT_TOOL_PACKED_BEGIN +struct otExtAddress +{ + uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes +} OT_TOOL_PACKED_END; + +/** + * This structure represents the IEEE 802.15.4 Extended Address. + * + */ +typedef struct otExtAddress otExtAddress; + /** * This structure represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame. */ diff --git a/include/openthread/platform/random.h b/include/openthread/platform/random.h index 2cc77a3bf..7dae2ce18 100644 --- a/include/openthread/platform/random.h +++ b/include/openthread/platform/random.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/settings.h b/include/openthread/platform/settings.h index aa3b35b56..c3e058347 100644 --- a/include/openthread/platform/settings.h +++ b/include/openthread/platform/settings.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_PLATFORM_SETTINGS_H_ #define OPENTHREAD_PLATFORM_SETTINGS_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/spi-slave.h b/include/openthread/platform/spi-slave.h index 5920e0fc9..3b846673e 100644 --- a/include/openthread/platform/spi-slave.h +++ b/include/openthread/platform/spi-slave.h @@ -35,9 +35,10 @@ #ifndef OPENTHREAD_PLATFORM_SPI_SLAVE_H_ #define OPENTHREAD_PLATFORM_SPI_SLAVE_H_ +#include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/time.h b/include/openthread/platform/time.h index 84f2023a6..113dc4b82 100644 --- a/include/openthread/platform/time.h +++ b/include/openthread/platform/time.h @@ -37,8 +37,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/openthread/platform/toolchain.h b/include/openthread/platform/toolchain.h index 5aec6762c..c892b9e74 100644 --- a/include/openthread/platform/toolchain.h +++ b/include/openthread/platform/toolchain.h @@ -57,10 +57,21 @@ #ifndef OPENTHREAD_PLATFORM_TOOLCHAIN_H_ #define OPENTHREAD_PLATFORM_TOOLCHAIN_H_ +#include + #ifdef __cplusplus extern "C" { #endif +#ifdef _WIN32 +#pragma warning(disable : 4214) // nonstandard extension used: bit field types other than int +#ifdef _KERNEL_MODE +#include +#else +#include +#endif +#endif /* _WIN32 */ + /** * @def OT_TOOL_PACKED_BEGIN * diff --git a/include/openthread/platform/uart.h b/include/openthread/platform/uart.h index f711e36c7..c6a89b460 100644 --- a/include/openthread/platform/uart.h +++ b/include/openthread/platform/uart.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/server.h b/include/openthread/server.h index 51059e137..e9b52e444 100644 --- a/include/openthread/server.h +++ b/include/openthread/server.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_SERVER_H_ #define OPENTHREAD_SERVER_H_ -#include +#include #ifdef __cplusplus extern "C" { @@ -51,6 +51,35 @@ extern "C" { * */ +#define OT_SERVICE_DATA_MAX_SIZE 252 ///< Maximum size of Service Data in bytes. +#define OT_SERVER_DATA_MAX_SIZE \ + 248 ///< Maximum size of Server Data in bytes. This is theoretical limit, practical one is much lower. + +/** + * This structure represents a Server configuration. + * + */ +typedef struct otServerConfig +{ + bool mStable : 1; ///< TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. + uint8_t mServerDataLength; ///< Length of server data. + uint8_t mServerData[OT_SERVER_DATA_MAX_SIZE]; ///< Server data bytes. + uint16_t mRloc16; ///< The Server RLOC16. +} otServerConfig; + +/** + * This structure represents a Service configuration. + * + */ +typedef struct otServiceConfig +{ + uint8_t mServiceID; ///< Used to return service ID when iterating over network data from leader. + uint32_t mEnterpriseNumber; ///< IANA Enterprise Number. + uint8_t mServiceDataLength; ///< Length of service data. + uint8_t mServiceData[OT_SERVICE_DATA_MAX_SIZE]; ///< Service data bytes. + otServerConfig mServerConfig; ///< The Server configuration. +} otServiceConfig; + /** * This method provides a full or stable copy of the local Thread Network Data. * diff --git a/include/openthread/tasklet.h b/include/openthread/tasklet.h index 25c01a3b1..d440a6872 100644 --- a/include/openthread/tasklet.h +++ b/include/openthread/tasklet.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_TASKLET_H_ #define OPENTHREAD_TASKLET_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/thread.h b/include/openthread/thread.h index 305c05915..949cefe37 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -35,9 +35,9 @@ #ifndef OPENTHREAD_THREAD_H_ #define OPENTHREAD_THREAD_H_ +#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -50,6 +50,109 @@ extern "C" { * */ +/** + * Maximum Number of Network Diagnostic TLV Types to Request or Reset. + */ +#define OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES 19 + +/** + * Represents a Thread device role. + * + */ +typedef enum { + OT_DEVICE_ROLE_DISABLED = 0, ///< The Thread stack is disabled. + OT_DEVICE_ROLE_DETACHED = 1, ///< Not currently participating in a Thread network/partition. + OT_DEVICE_ROLE_CHILD = 2, ///< The Thread Child role. + OT_DEVICE_ROLE_ROUTER = 3, ///< The Thread Router role. + OT_DEVICE_ROLE_LEADER = 4, ///< The Thread Leader role. +} otDeviceRole; + +/** + * This structure represents an MLE Link Mode configuration. + */ +OT_TOOL_ALIGN(4) +typedef struct otLinkModeConfig +{ + bool mRxOnWhenIdle : 1; ///< 1, if the sender has its receiver on when not transmitting. 0, otherwise. + bool mSecureDataRequests : 1; ///< 1, if the sender uses IEEE 802.15.4 to secure all data requests. 0, otherwise. + bool mDeviceType : 1; ///< 1, if the sender is an FFD. 0, otherwise. + bool mNetworkData : 1; ///< 1, if the sender requires the full Network Data. 0, otherwise. +} otLinkModeConfig; + +/** + * This structure holds diagnostic information for a neighboring Thread node + * + * `mFrameErrorRate` and `mMessageErrorRate` require `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` feature to be + * enabled. + * + */ +typedef struct +{ + otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address + uint32_t mAge; ///< Time last heard + uint16_t mRloc16; ///< RLOC16 + uint32_t mLinkFrameCounter; ///< Link Frame Counter + uint32_t mMleFrameCounter; ///< MLE Frame Counter + uint8_t mLinkQualityIn; ///< Link Quality In + int8_t mAverageRssi; ///< Average RSSI + int8_t mLastRssi; ///< Last observed RSSI + uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. + uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. + bool mRxOnWhenIdle : 1; ///< rx-on-when-idle + bool mSecureDataRequest : 1; ///< Secure Data Requests + bool mFullFunction : 1; ///< Full Function Device + bool mFullNetworkData : 1; ///< Full Network Data + bool mIsChild : 1; ///< Is the neighbor a child +} otNeighborInfo; + +#define OT_NEIGHBOR_INFO_ITERATOR_INIT 0 ///< Initializer for otNeighborInfoIterator. + +typedef int16_t otNeighborInfoIterator; ///< Used to iterate through neighbor table. + +/** + * This structure represents the Thread Leader Data. + * + */ +typedef struct otLeaderData +{ + uint32_t mPartitionId; ///< Partition ID + uint8_t mWeighting; ///< Leader Weight + uint8_t mDataVersion; ///< Full Network Data Version + uint8_t mStableDataVersion; ///< Stable Network Data Version + uint8_t mLeaderRouterId; ///< Leader Router ID +} otLeaderData; + +/** + * This structure holds diagnostic information for a Thread Router + * + */ +OT_TOOL_ALIGN(4) +typedef struct +{ + otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address + uint16_t mRloc16; ///< RLOC16 + uint8_t mRouterId; ///< Router ID + uint8_t mNextHop; ///< Next hop to router + uint8_t mPathCost; ///< Path cost to router + uint8_t mLinkQualityIn; ///< Link Quality In + uint8_t mLinkQualityOut; ///< Link Quality Out + uint8_t mAge; ///< Time last heard + bool mAllocated : 1; ///< Router ID allocated or not + bool mLinkEstablished : 1; ///< Link established with Router ID or not +} otRouterInfo; + +/** + * This structure represents the IP level counters. + * + */ +typedef struct otIpCounters +{ + uint32_t mTxSuccess; ///< The number of IPv6 packets successfully transmitted. + uint32_t mRxSuccess; ///< The number of IPv6 packets successfully received. + uint32_t mTxFailure; ///< The number of IPv6 packets failed to transmit. + uint32_t mRxFailure; ///< The number of IPv6 packets failed to receive. +} otIpCounters; + /** * This function starts Thread protocol operation. * diff --git a/include/openthread/thread_ftd.h b/include/openthread/thread_ftd.h index bd98b4c78..c51ef9fbc 100644 --- a/include/openthread/thread_ftd.h +++ b/include/openthread/thread_ftd.h @@ -37,7 +37,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { @@ -50,6 +50,49 @@ extern "C" { * */ +/** + * This structure holds diagnostic information for a Thread Child + * + * `mFrameErrorRate` and `mMessageErrorRate` require `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` feature to be + * enabled. + * + */ +typedef struct +{ + otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address + uint32_t mTimeout; ///< Timeout + uint32_t mAge; ///< Time last heard + uint16_t mRloc16; ///< RLOC16 + uint16_t mChildId; ///< Child ID + uint8_t mNetworkDataVersion; ///< Network Data Version + uint8_t mLinkQualityIn; ///< Link Quality In + int8_t mAverageRssi; ///< Average RSSI + int8_t mLastRssi; ///< Last observed RSSI + uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. + uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. + bool mRxOnWhenIdle : 1; ///< rx-on-when-idle + bool mSecureDataRequest : 1; ///< Secure Data Requests + bool mFullFunction : 1; ///< Full Function Device + bool mFullNetworkData : 1; ///< Full Network Data + bool mIsStateRestoring : 1; ///< Is in restoring state +} otChildInfo; + +#define OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0 ///< Initializer for otChildIP6AddressIterator + +typedef uint16_t otChildIp6AddressIterator; ///< Used to iterate through IPv6 addresses of a Thread Child entry. + +/** + * This structure represents an EID cache entry. + * + */ +typedef struct otEidCacheEntry +{ + otIp6Address mTarget; ///< Target + otShortAddress mRloc16; ///< RLOC16 + uint8_t mAge; ///< Age (order of use, 0 indicates most recently used entry) + bool mValid : 1; ///< Indicates whether or not the cache entry is valid +} otEidCacheEntry; + /** * Get the maximum number of children currently allowed. * diff --git a/include/openthread/types.h b/include/openthread/types.h deleted file mode 100644 index 71fe7ed43..000000000 --- a/include/openthread/types.h +++ /dev/null @@ -1,1239 +0,0 @@ -/* - * Copyright (c) 2016, The OpenThread Authors. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @file - * @brief - * This file defines the types and structures used in the OpenThread library API. - */ - -#ifndef OPENTHREAD_TYPES_H_ -#define OPENTHREAD_TYPES_H_ - -#include -#include -#ifdef OTDLL -#include -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 -#pragma warning(disable : 4214) // nonstandard extension used: bit field types other than int -#ifdef _KERNEL_MODE -#include -#else -#include -#endif -#endif /* _WIN32 */ - -/** - * @addtogroup api-types - * - * @brief - * This module includes API types - * - * @{ - * - */ - -/** - * This structure represents the OpenThread instance structure. - */ -typedef struct otInstance otInstance; - -#ifdef OTDLL - -/** - * This structure represents the handle to the OpenThread API. - * - */ -typedef struct otApiInstance otApiInstance; - -/** - * This structure represents a list of device GUIDs. - * - */ -typedef struct otDeviceList -{ - uint16_t aDevicesLength; - GUID aDevices[1]; -} otDeviceList; - -#endif - -/** - * This enumeration represents error codes used throughout OpenThread. - * - */ -typedef enum otError { - /** - * No error. - */ - OT_ERROR_NONE = 0, - - /** - * Operational failed. - */ - OT_ERROR_FAILED = 1, - - /** - * Message was dropped. - */ - OT_ERROR_DROP = 2, - - /** - * Insufficient buffers. - */ - OT_ERROR_NO_BUFS = 3, - - /** - * No route available. - */ - OT_ERROR_NO_ROUTE = 4, - - /** - * Service is busy and could not service the operation. - */ - OT_ERROR_BUSY = 5, - - /** - * Failed to parse message or arguments. - */ - OT_ERROR_PARSE = 6, - - /** - * Input arguments are invalid. - */ - OT_ERROR_INVALID_ARGS = 7, - - /** - * Security checks failed. - */ - OT_ERROR_SECURITY = 8, - - /** - * Address resolution requires an address query operation. - */ - OT_ERROR_ADDRESS_QUERY = 9, - - /** - * Address is not in the source match table. - */ - OT_ERROR_NO_ADDRESS = 10, - - /** - * Operation was aborted. - */ - OT_ERROR_ABORT = 11, - - /** - * Function or method is not implemented. - */ - OT_ERROR_NOT_IMPLEMENTED = 12, - - /** - * Cannot complete due to invalid state. - */ - OT_ERROR_INVALID_STATE = 13, - - /** - * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006). - */ - OT_ERROR_NO_ACK = 14, - - /** - * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed - * (IEEE 802.15.4-2006). - */ - OT_ERROR_CHANNEL_ACCESS_FAILURE = 15, - - /** - * Not currently attached to a Thread Partition. - */ - OT_ERROR_DETACHED = 16, - - /** - * FCS check failure while receiving. - */ - OT_ERROR_FCS = 17, - - /** - * No frame received. - */ - OT_ERROR_NO_FRAME_RECEIVED = 18, - - /** - * Received a frame from an unknown neighbor. - */ - OT_ERROR_UNKNOWN_NEIGHBOR = 19, - - /** - * Received a frame from an invalid source address. - */ - OT_ERROR_INVALID_SOURCE_ADDRESS = 20, - - /** - * Received a frame filtered by the address filter (whitelisted or blacklisted). - */ - OT_ERROR_ADDRESS_FILTERED = 21, - - /** - * Received a frame filtered by the destination address check. - */ - OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22, - - /** - * The requested item could not be found. - */ - OT_ERROR_NOT_FOUND = 23, - - /** - * The operation is already in progress. - */ - OT_ERROR_ALREADY = 24, - - /** - * The creation of IPv6 address failed. - */ - OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26, - - /** - * Operation prevented by mode flags - */ - OT_ERROR_NOT_CAPABLE = 27, - - /** - * Coap response or acknowledgment or DNS response not received. - */ - OT_ERROR_RESPONSE_TIMEOUT = 28, - - /** - * Received a duplicated frame. - */ - OT_ERROR_DUPLICATED = 29, - - /** - * Message is being dropped from reassembly list due to timeout. - */ - OT_ERROR_REASSEMBLY_TIMEOUT = 30, - - /** - * Message is not a TMF Message. - */ - OT_ERROR_NOT_TMF = 31, - - /** - * Received a non-lowpan data frame. - */ - OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32, - - /** - * A feature/functionality disabled by build-time configuration options. - */ - OT_ERROR_DISABLED_FEATURE = 33, - - /** - * The link margin was too low. - */ - OT_ERROR_LINK_MARGIN_LOW = 34, - - /** - * Generic error (should not use). - */ - OT_ERROR_GENERIC = 255, -} otError; - -#define OT_IP6_IID_SIZE 8 ///< Size of an IPv6 Interface Identifier (bytes) - -#define OT_MASTER_KEY_SIZE 16 ///< Size of the Thread Master Key (bytes) - -/** - * Maximum Number of Network Diagnostic TLV Types to Request or Reset. - */ -#define OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES 19 - -/** - * @struct otMasterKey - * - * This structure represents a Thread Master Key. - * - */ -OT_TOOL_PACKED_BEGIN -struct otMasterKey -{ - uint8_t m8[OT_MASTER_KEY_SIZE]; ///< Byte values -} OT_TOOL_PACKED_END; - -/** - * This structure represents a Thread Master Key. - * - */ -typedef struct otMasterKey otMasterKey; - -#define OT_NETWORK_NAME_MAX_SIZE 16 ///< Maximum size of the Thread Network Name field (bytes) - -/** - * This structure represents a Network Name. - * - */ -typedef struct otNetworkName -{ - char m8[OT_NETWORK_NAME_MAX_SIZE + 1]; ///< Byte values -} otNetworkName; - -#define OT_EXT_PAN_ID_SIZE 8 ///< Size of a Thread PAN ID (bytes) - -/** - * This structure represents an Extended PAN ID. - * - */ -typedef struct otExtendedPanId -{ - uint8_t m8[OT_EXT_PAN_ID_SIZE]; ///< Byte values -} otExtendedPanId; - -#define OT_MESH_LOCAL_PREFIX_SIZE 8 ///< Size of the Mesh Local Prefix (bytes) - -/** - * This structure represents a Mesh Local Prefix. - * - */ -typedef struct otMeshLocalPrefix -{ - uint8_t m8[OT_MESH_LOCAL_PREFIX_SIZE]; ///< Byte values -} otMeshLocalPrefix; - -#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes) - -#define OT_COMMISSIONING_PASSPHRASE_MIN_SIZE 6 ///< Minimum size of the Commissioning Passphrase -#define OT_COMMISSIONING_PASSPHRASE_MAX_SIZE 255 ///< Maximum size of the Commissioning Passphrase - -/** - * This structure represents PSKc. - * - */ -typedef struct otPSKc -{ - uint8_t m8[OT_PSKC_MAX_SIZE]; ///< Byte values -} otPSKc; - -/** - * This structure represent Security Policy. - * - */ -typedef struct otSecurityPolicy -{ - uint16_t mRotationTime; ///< The value for thrKeyRotation in units of hours - uint8_t mFlags; ///< Flags as defined in Thread 1.1 Section 8.10.1.15 -} otSecurityPolicy; - -/** - * This enumeration defines the Security Policy TLV flags. - * - */ -enum -{ - OT_SECURITY_POLICY_OBTAIN_MASTER_KEY = 1 << 7, ///< Obtaining the Master Key - OT_SECURITY_POLICY_NATIVE_COMMISSIONING = 1 << 6, ///< Native Commissioning - OT_SECURITY_POLICY_ROUTERS = 1 << 5, ///< Routers enabled - OT_SECURITY_POLICY_EXTERNAL_COMMISSIONER = 1 << 4, ///< External Commissioner allowed - OT_SECURITY_POLICY_BEACONS = 1 << 3, ///< Beacons enabled -}; - -/** - * This type represents Channel Mask Page 0. - * - */ -typedef uint32_t otChannelMaskPage0; - -/** - * This type represents the IEEE 802.15.4 PAN ID. - * - */ -typedef uint16_t otPanId; - -/** - * This type represents the IEEE 802.15.4 Short Address. - * - */ -typedef uint16_t otShortAddress; - -#define OT_EXT_ADDRESS_SIZE 8 ///< Size of an IEEE 802.15.4 Extended Address (bytes) - -/** - * @struct otExtAddress - * - * This structure represents the IEEE 802.15.4 Extended Address. - * - */ -OT_TOOL_PACKED_BEGIN -struct otExtAddress -{ - uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes -} OT_TOOL_PACKED_END; - -/** - * This structure represents the IEEE 802.15.4 Extended Address. - * - */ -typedef struct otExtAddress otExtAddress; - -#define OT_IP6_PREFIX_SIZE 8 ///< Size of an IPv6 prefix (bytes) -#define OT_IP6_ADDRESS_SIZE 16 ///< Size of an IPv6 address (bytes) - -/** - * @struct otIp6Address - * - * This structure represents an IPv6 address. - * - */ -OT_TOOL_PACKED_BEGIN -struct otIp6Address -{ - union OT_TOOL_PACKED_FIELD - { - uint8_t m8[OT_IP6_ADDRESS_SIZE]; ///< 8-bit fields - uint16_t m16[OT_IP6_ADDRESS_SIZE / sizeof(uint16_t)]; ///< 16-bit fields - uint32_t m32[OT_IP6_ADDRESS_SIZE / sizeof(uint32_t)]; ///< 32-bit fields - } mFields; ///< IPv6 accessor fields -} OT_TOOL_PACKED_END; - -/** - * This structure represents an IPv6 address. - * - */ -typedef struct otIp6Address otIp6Address; - -/** - * This structure represents the local and peer IPv6 socket addresses. - * - */ -typedef struct otMessageInfo -{ - /** - * The local IPv6 address. - */ - otIp6Address mSockAddr; - - /** - * The peer IPv6 address. - */ - otIp6Address mPeerAddr; - - /** - * The local transport-layer port. - */ - uint16_t mSockPort; - - /** - * The peer transport-layer port. - */ - uint16_t mPeerPort; - - /** - * An IPv6 interface identifier. - */ - int8_t mInterfaceId; - - /** - * The IPv6 Hop Limit. - */ - uint8_t mHopLimit; - - /** - * A pointer to link-specific information. In case @p mInterfaceId is set to OT_NETIF_INTERFACE_ID_THREAD, - * @p mLinkInfo points to @sa otThreadLinkInfo. This field is only valid for messages received from the - * Thread radio and is ignored on transmission. - */ - const void *mLinkInfo; -} otMessageInfo; - -/** - * This structure points to an OpenThread message buffer. - */ -typedef struct otMessage -{ - struct otMessage *mNext; ///< A pointer to the next Message buffer. -} otMessage; - -#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID - -#define OT_CHANNEL_11_MASK (1 << 11) ///< Channel 11 -#define OT_CHANNEL_12_MASK (1 << 12) ///< Channel 12 -#define OT_CHANNEL_13_MASK (1 << 13) ///< Channel 13 -#define OT_CHANNEL_14_MASK (1 << 14) ///< Channel 14 -#define OT_CHANNEL_15_MASK (1 << 15) ///< Channel 15 -#define OT_CHANNEL_16_MASK (1 << 16) ///< Channel 16 -#define OT_CHANNEL_17_MASK (1 << 17) ///< Channel 17 -#define OT_CHANNEL_18_MASK (1 << 18) ///< Channel 18 -#define OT_CHANNEL_19_MASK (1 << 19) ///< Channel 19 -#define OT_CHANNEL_20_MASK (1 << 20) ///< Channel 20 -#define OT_CHANNEL_21_MASK (1 << 21) ///< Channel 21 -#define OT_CHANNEL_22_MASK (1 << 22) ///< Channel 22 -#define OT_CHANNEL_23_MASK (1 << 23) ///< Channel 23 -#define OT_CHANNEL_24_MASK (1 << 24) ///< Channel 24 -#define OT_CHANNEL_25_MASK (1 << 25) ///< Channel 25 -#define OT_CHANNEL_26_MASK (1 << 26) ///< Channel 26 - -#define OT_CHANNEL_ALL 0xffffffff ///< All channels - -#define OT_STEERING_DATA_MAX_LENGTH 16 ///< Max steering data length (bytes) - -/** - * This structure represents the steering data. - * - */ -typedef struct otSteeringData -{ - uint8_t mLength; ///< Length of steering data (bytes) - uint8_t m8[OT_STEERING_DATA_MAX_LENGTH]; ///< Byte values -} otSteeringData; - -/** - * This structure represents a received IEEE 802.15.4 Beacon. - * - */ -typedef struct otActiveScanResult -{ - otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address - otNetworkName mNetworkName; ///< Thread Network Name - otExtendedPanId mExtendedPanId; ///< Thread Extended PAN ID - otSteeringData mSteeringData; ///< Steering Data - uint16_t mPanId; ///< IEEE 802.15.4 PAN ID - uint16_t mJoinerUdpPort; ///< Joiner UDP Port - uint8_t mChannel; ///< IEEE 802.15.4 Channel - int8_t mRssi; ///< RSSI (dBm) - uint8_t mLqi; ///< LQI - unsigned int mVersion : 4; ///< Version - bool mIsNative : 1; ///< Native Commissioner flag - bool mIsJoinable : 1; ///< Joining Permitted flag -} otActiveScanResult; - -/** - * This structure represents an energy scan result. - * - */ -typedef struct otEnergyScanResult -{ - uint8_t mChannel; ///< IEEE 802.15.4 Channel - int8_t mMaxRssi; ///< The max RSSI (dBm) -} otEnergyScanResult; - -/** - * This structure represents presence of different components in Active or Pending Operational Dataset. - * - */ -typedef struct otOperationalDatasetComponents -{ - bool mIsActiveTimestampPresent : 1; ///< TRUE if Active Timestamp is present, FALSE otherwise. - bool mIsPendingTimestampPresent : 1; ///< TRUE if Pending Timestamp is present, FALSE otherwise. - bool mIsMasterKeyPresent : 1; ///< TRUE if Network Master Key is present, FALSE otherwise. - bool mIsNetworkNamePresent : 1; ///< TRUE if Network Name is present, FALSE otherwise. - bool mIsExtendedPanIdPresent : 1; ///< TRUE if Extended PAN ID is present, FALSE otherwise. - bool mIsMeshLocalPrefixPresent : 1; ///< TRUE if Mesh Local Prefix is present, FALSE otherwise. - bool mIsDelayPresent : 1; ///< TRUE if Delay Timer is present, FALSE otherwise. - bool mIsPanIdPresent : 1; ///< TRUE if PAN ID is present, FALSE otherwise. - bool mIsChannelPresent : 1; ///< TRUE if Channel is present, FALSE otherwise. - bool mIsPSKcPresent : 1; ///< TRUE if PSKc is present, FALSE otherwise. - bool mIsSecurityPolicyPresent : 1; ///< TRUE if Security Policy is present, FALSE otherwise. - bool mIsChannelMaskPage0Present : 1; ///< TRUE if Channel Mask Page 0 is present, FALSE otherwise. -} otOperationalDatasetComponents; - -/** - * This structure represents an Active or Pending Operational Dataset. - * - * Components in Dataset are optional. `mComponets` structure specifies which components are present in the Dataset. - * - */ -typedef struct otOperationalDataset -{ - uint64_t mActiveTimestamp; ///< Active Timestamp - uint64_t mPendingTimestamp; ///< Pending Timestamp - otMasterKey mMasterKey; ///< Network Master Key - otNetworkName mNetworkName; ///< Network Name - otExtendedPanId mExtendedPanId; ///< Extended PAN ID - otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix - uint32_t mDelay; ///< Delay Timer - otPanId mPanId; ///< PAN ID - uint16_t mChannel; ///< Channel - otPSKc mPSKc; ///< PSKc - otSecurityPolicy mSecurityPolicy; ///< Security Policy - otChannelMaskPage0 mChannelMaskPage0; ///< Channel Mask Page 0 - otOperationalDatasetComponents mComponents; ///< Specifies which components are set in the Dataset. -} otOperationalDataset; - -/** - * This structure represents a Commissioning Dataset. - * - */ -typedef struct otCommissioningDataset -{ - uint16_t mLocator; ///< Border Router RLOC16 - uint16_t mSessionId; ///< Commissioner Session Id - otSteeringData mSteeringData; ///< Steering Data - uint16_t mJoinerUdpPort; ///< Joiner UDP Port - - bool mIsLocatorSet : 1; ///< TRUE if Border Router RLOC16 is set, FALSE otherwise. - bool mIsSessionIdSet : 1; ///< TRUE if Commissioner Session Id is set, FALSE otherwise. - bool mIsSteeringDataSet : 1; ///< TRUE if Steering Data is set, FALSE otherwise. - bool mIsJoinerUdpPortSet : 1; ///< TRUE if Joiner UDP Port is set, FALSE otherwise. -} otCommissioningDataset; - -/** - * This enumeration represents meshcop TLV types. - * - */ -typedef enum otMeshcopTlvType { - OT_MESHCOP_TLV_CHANNEL = 0, ///< meshcop Channel TLV - OT_MESHCOP_TLV_PANID = 1, ///< meshcop Pan Id TLV - OT_MESHCOP_TLV_EXTPANID = 2, ///< meshcop Extended Pan Id TLV - OT_MESHCOP_TLV_NETWORKNAME = 3, ///< meshcop Network Name TLV - OT_MESHCOP_TLV_PSKC = 4, ///< meshcop PSKc TLV - OT_MESHCOP_TLV_MASTERKEY = 5, ///< meshcop Network Master Key TLV - OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE = 6, ///< meshcop Network Key Sequence TLV - OT_MESHCOP_TLV_MESHLOCALPREFIX = 7, ///< meshcop Mesh Local Prefix TLV - OT_MESHCOP_TLV_STEERING_DATA = 8, ///< meshcop Steering Data TLV - OT_MESHCOP_TLV_BORDER_AGENT_RLOC = 9, ///< meshcop Border Agent Locator TLV - OT_MESHCOP_TLV_COMMISSIONER_ID = 10, ///< meshcop Commissioner ID TLV - OT_MESHCOP_TLV_COMM_SESSION_ID = 11, ///< meshcop Commissioner Session ID TLV - OT_MESHCOP_TLV_SECURITYPOLICY = 12, ///< meshcop Security Policy TLV - OT_MESHCOP_TLV_GET = 13, ///< meshcop Get TLV - OT_MESHCOP_TLV_ACTIVETIMESTAMP = 14, ///< meshcop Active Timestamp TLV - OT_MESHCOP_TLV_STATE = 16, ///< meshcop State TLV - OT_MESHCOP_TLV_JOINER_DTLS = 17, ///< meshcop Joiner DTLS Encapsulation TLV - OT_MESHCOP_TLV_JOINER_UDP_PORT = 18, ///< meshcop Joiner UDP Port TLV - OT_MESHCOP_TLV_JOINER_IID = 19, ///< meshcop Joiner IID TLV - OT_MESHCOP_TLV_JOINER_RLOC = 20, ///< meshcop Joiner Router Locator TLV - OT_MESHCOP_TLV_JOINER_ROUTER_KEK = 21, ///< meshcop Joiner Router KEK TLV - OT_MESHCOP_TLV_PROVISIONING_URL = 32, ///< meshcop Provisioning URL TLV - OT_MESHCOP_TLV_VENDOR_NAME_TLV = 33, ///< meshcop Vendor Name TLV - OT_MESHCOP_TLV_VENDOR_MODEL_TLV = 34, ///< meshcop Vendor Model TLV - OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV = 35, ///< meshcop Vendor SW Version TLV - OT_MESHCOP_TLV_VENDOR_DATA_TLV = 36, ///< meshcop Vendor Data TLV - OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV = 37, ///< meshcop Vendor Stack Version TLV - OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV = 48, ///< meshcop UDP encapsulation TLV - OT_MESHCOP_TLV_IPV6_ADDRESS_TLV = 49, ///< meshcop IPv6 address TLV - OT_MESHCOP_TLV_PENDINGTIMESTAMP = 51, ///< meshcop Pending Timestamp TLV - OT_MESHCOP_TLV_DELAYTIMER = 52, ///< meshcop Delay Timer TLV - OT_MESHCOP_TLV_CHANNELMASK = 53, ///< meshcop Channel Mask TLV - OT_MESHCOP_TLV_COUNT = 54, ///< meshcop Count TLV - OT_MESHCOP_TLV_PERIOD = 55, ///< meshcop Period TLV - OT_MESHCOP_TLV_SCAN_DURATION = 56, ///< meshcop Scan Duration TLV - OT_MESHCOP_TLV_ENERGY_LIST = 57, ///< meshcop Energy List TLV - OT_MESHCOP_TLV_DISCOVERYREQUEST = 128, ///< meshcop Discovery Request TLV - OT_MESHCOP_TLV_DISCOVERYRESPONSE = 129, ///< meshcop Discovery Response TLV -} otMeshcopTlvType; - -/** - * This structure represents an MLE Link Mode configuration. - */ -OT_TOOL_ALIGN(4) -typedef struct otLinkModeConfig -{ - /** - * 1, if the sender has its receiver on when not transmitting. 0, otherwise. - */ - bool mRxOnWhenIdle : 1; - - /** - * 1, if the sender uses IEEE 802.15.4 to secure all data requests. 0, otherwise. - */ - bool mSecureDataRequests : 1; - - /** - * 1, if the sender is an FFD. 0, otherwise. - */ - bool mDeviceType : 1; - - /** - * 1, if the sender requires the full Network Data. 0, otherwise. - */ - bool mNetworkData : 1; -} otLinkModeConfig; - -/** - * This structure represents an IPv6 prefix. - * - */ -OT_TOOL_PACKED_BEGIN -struct otIp6Prefix -{ - otIp6Address mPrefix; ///< The IPv6 prefix. - uint8_t mLength; ///< The IPv6 prefix length. -} OT_TOOL_PACKED_END; - -/** - * This structure represents an IPv6 prefix. - * - */ -typedef struct otIp6Prefix otIp6Prefix; - -#define OT_NETWORK_DATA_ITERATOR_INIT 0 ///< Initializer for otNetworkDataIterator. - -typedef uint32_t otNetworkDataIterator; ///< Used to iterate through Network Data information. - -/** - * This structure represents a Border Router configuration. - */ -typedef struct otBorderRouterConfig -{ - /** - * The IPv6 prefix. - */ - otIp6Prefix mPrefix; - - /** - * A 2-bit signed integer indicating router preference as defined in RFC 4191. - */ - int mPreference : 2; - - /** - * TRUE, if @p mPrefix is preferred. FALSE, otherwise. - */ - bool mPreferred : 1; - - /** - * TRUE, if @p mPrefix should be used for address autoconfiguration. FALSE, otherwise. - */ - bool mSlaac : 1; - - /** - * TRUE, if this border router is a DHCPv6 Agent that supplies IPv6 address configuration. FALSE, otherwise. - */ - bool mDhcp : 1; - - /** - * TRUE, if this border router is a DHCPv6 Agent that supplies other configuration data. FALSE, otherwise. - */ - bool mConfigure : 1; - - /** - * TRUE, if this border router is a default route for @p mPrefix. FALSE, otherwise. - */ - bool mDefaultRoute : 1; - - /** - * TRUE, if this prefix is considered on-mesh. FALSE, otherwise. - */ - bool mOnMesh : 1; - - /** - * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. - */ - bool mStable : 1; - - /** - * The Border Agent Rloc. - */ - uint16_t mRloc16; -} otBorderRouterConfig; - -/** - * This structure represents an External Route configuration. - * - */ -typedef struct otExternalRouteConfig -{ - /** - * The prefix for the off-mesh route. - */ - otIp6Prefix mPrefix; - - /** - * The Rloc associated with the external route entry. - * - * This value is ignored when adding an external route. For any added route, the device's Rloc is used. - */ - uint16_t mRloc16; - - /** - * A 2-bit signed integer indicating router preference as defined in RFC 4191. - */ - int mPreference : 2; - - /** - * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. - */ - bool mStable : 1; - - /** - * TRUE if the external route entry's next hop is this device itself (i.e., the route was added earlier by this - * device). FALSE otherwise. - * - * This value is ignored when adding an external route. For any added route the next hop is this device. - */ - bool mNextHopIsThisDevice : 1; - -} otExternalRouteConfig; - -/** - * Defines valid values for member mPreference in otExternalRouteConfig and otBorderRouterConfig. - * - */ -typedef enum otRoutePreference { - OT_ROUTE_PREFERENCE_LOW = -1, ///< Low route preference. - OT_ROUTE_PREFERENCE_MED = 0, ///< Medium route preference. - OT_ROUTE_PREFERENCE_HIGH = 1, ///< High route preference. -} otRoutePreference; - -#define OT_SERVICE_DATA_MAX_SIZE 252 ///< Maximum size of Service Data in bytes. -#define OT_SERVER_DATA_MAX_SIZE \ - 248 ///< Maximum size of Server Data in bytes. This is theoretical limit, practical one is much lower. - -/** - * This structure represents a Server configuration. - * - */ -typedef struct otServerConfig -{ - /** - * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. - */ - bool mStable : 1; - - /** - * Length of server data. - */ - uint8_t mServerDataLength; - - /** - * Server data bytes - */ - uint8_t mServerData[OT_SERVER_DATA_MAX_SIZE]; - - /** - * The Server Rloc. - */ - uint16_t mRloc16; -} otServerConfig; - -/** - * This structure represents a Service configuration. - * - */ -typedef struct otServiceConfig -{ - /** - * Service ID. This field is used to return service ID when iterating over network data from leader. - */ - uint8_t mServiceID; - - /** - * IANA Enterprise Number. - */ - uint32_t mEnterpriseNumber; - - /** - * Length of service data. - */ - uint8_t mServiceDataLength; - - /** - * Service data bytes - */ - uint8_t mServiceData[OT_SERVICE_DATA_MAX_SIZE]; - - /** - * The Server configuration. - */ - otServerConfig mServerConfig; -} otServiceConfig; - -/** - * Used to indicate no fixed received signal strength was set - * - */ -#define OT_MAC_FILTER_FIXED_RSS_DISABLED 127 - -#define OT_MAC_FILTER_ITERATOR_INIT 0 ///< Initializer for otMacFilterIterator. - -typedef uint8_t otMacFilterIterator; ///< Used to iterate through mac filter entries. - -/** - * Defines address mode of the mac filter. - * - */ -typedef enum otMacFilterAddressMode { - OT_MAC_FILTER_ADDRESS_MODE_DISABLED, ///< Address filter is disabled. - OT_MAC_FILTER_ADDRESS_MODE_WHITELIST, ///< Whitelist address filter mode is enabled. - OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST, ///< Blacklist address filter mode is enabled. -} otMacFilterAddressMode; - -/** - * This structure represents a Mac Filter entry. - * - */ -typedef struct otMacFilterEntry -{ - otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address - int8_t mRssIn; ///< Received signal strength - bool mFiltered; ///< Indicates whether or not this entry is filtered. -} otMacFilterEntry; - -/** - * Represents a Thread device role. - * - */ -typedef enum { - OT_DEVICE_ROLE_DISABLED = 0, ///< The Thread stack is disabled. - OT_DEVICE_ROLE_DETACHED = 1, ///< Not currently participating in a Thread network/partition. - OT_DEVICE_ROLE_CHILD = 2, ///< The Thread Child role. - OT_DEVICE_ROLE_ROUTER = 3, ///< The Thread Router role. - OT_DEVICE_ROLE_LEADER = 4, ///< The Thread Leader role. -} otDeviceRole; - -/** - * This structure holds diagnostic information for a neighboring Thread node - * - * `mFrameErrorRate` and `mMessageErrorRate` require `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` feature to be - * enabled. - * - */ -typedef struct -{ - otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address - uint32_t mAge; ///< Time last heard - uint16_t mRloc16; ///< RLOC16 - uint32_t mLinkFrameCounter; ///< Link Frame Counter - uint32_t mMleFrameCounter; ///< MLE Frame Counter - uint8_t mLinkQualityIn; ///< Link Quality In - int8_t mAverageRssi; ///< Average RSSI - int8_t mLastRssi; ///< Last observed RSSI - uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. - uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. - bool mRxOnWhenIdle : 1; ///< rx-on-when-idle - bool mSecureDataRequest : 1; ///< Secure Data Requests - bool mFullFunction : 1; ///< Full Function Device - bool mFullNetworkData : 1; ///< Full Network Data - bool mIsChild : 1; ///< Is the neighbor a child -} otNeighborInfo; - -#define OT_NEIGHBOR_INFO_ITERATOR_INIT 0 ///< Initializer for otNeighborInfoIterator. - -typedef int16_t otNeighborInfoIterator; ///< Used to iterate through neighbor table. - -/** - * This structure holds diagnostic information for a Thread Child - * - * `mFrameErrorRate` and `mMessageErrorRate` require `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` feature to be - * enabled. - * - */ -typedef struct -{ - otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address - uint32_t mTimeout; ///< Timeout - uint32_t mAge; ///< Time last heard - uint16_t mRloc16; ///< RLOC16 - uint16_t mChildId; ///< Child ID - uint8_t mNetworkDataVersion; ///< Network Data Version - uint8_t mLinkQualityIn; ///< Link Quality In - int8_t mAverageRssi; ///< Average RSSI - int8_t mLastRssi; ///< Last observed RSSI - uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. - uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. - bool mRxOnWhenIdle : 1; ///< rx-on-when-idle - bool mSecureDataRequest : 1; ///< Secure Data Requests - bool mFullFunction : 1; ///< Full Function Device - bool mFullNetworkData : 1; ///< Full Network Data - bool mIsStateRestoring : 1; ///< Is in restoring state -} otChildInfo; - -#define OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0 ///< Initializer for otChildIP6AddressIterator - -typedef uint16_t otChildIp6AddressIterator; ///< Used to iterate through IPv6 addresses of a Thread Child entry. - -/** - * This structure holds diagnostic information for a Thread Router - * - */ -OT_TOOL_ALIGN(4) -typedef struct -{ - otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address - uint16_t mRloc16; ///< RLOC16 - uint8_t mRouterId; ///< Router ID - uint8_t mNextHop; ///< Next hop to router - uint8_t mPathCost; ///< Path cost to router - uint8_t mLinkQualityIn; ///< Link Quality In - uint8_t mLinkQualityOut; ///< Link Quality Out - uint8_t mAge; ///< Time last heard - bool mAllocated : 1; ///< Router ID allocated or not - bool mLinkEstablished : 1; ///< Link established with Router ID or not -} otRouterInfo; - -/** - * This structure represents an EID cache entry. - * - */ -typedef struct otEidCacheEntry -{ - otIp6Address mTarget; ///< Target - otShortAddress mRloc16; ///< RLOC16 - uint8_t mAge; ///< Age (order of use, 0 indicates most recently used entry) - bool mValid : 1; ///< Indicates whether or not the cache entry is valid -} otEidCacheEntry; - -/** - * This structure represents the Thread Leader Data. - * - */ -typedef struct otLeaderData -{ - uint32_t mPartitionId; ///< Partition ID - uint8_t mWeighting; ///< Leader Weight - uint8_t mDataVersion; ///< Full Network Data Version - uint8_t mStableDataVersion; ///< Stable Network Data Version - uint8_t mLeaderRouterId; ///< Leader Router ID -} otLeaderData; - -/** - * This structure represents the MAC layer counters. - * - */ -typedef struct otMacCounters -{ - uint32_t mTxTotal; ///< The total number of transmissions. - uint32_t mTxUnicast; ///< The total number of unicast transmissions. - uint32_t mTxBroadcast; ///< The total number of broadcast transmissions. - uint32_t mTxAckRequested; ///< The number of transmissions with ack request. - uint32_t mTxAcked; ///< The number of transmissions that were acked. - uint32_t mTxNoAckRequested; ///< The number of transmissions without ack request. - uint32_t mTxData; ///< The number of transmitted data. - uint32_t mTxDataPoll; ///< The number of transmitted data poll. - uint32_t mTxBeacon; ///< The number of transmitted beacon. - uint32_t mTxBeaconRequest; ///< The number of transmitted beacon request. - uint32_t mTxOther; ///< The number of transmitted other types of frames. - uint32_t mTxRetry; ///< The number of retransmission times. - uint32_t mTxErrCca; ///< The number of CCA failure times. - uint32_t mTxErrAbort; ///< The number of frame transmission failures due to abort error. - uint32_t mTxErrBusyChannel; ///< The number of frames that were dropped due to a busy channel. - uint32_t mRxTotal; ///< The total number of received packets. - uint32_t mRxUnicast; ///< The total number of unicast packets received. - uint32_t mRxBroadcast; ///< The total number of broadcast packets received. - uint32_t mRxData; ///< The number of received data. - uint32_t mRxDataPoll; ///< The number of received data poll. - uint32_t mRxBeacon; ///< The number of received beacon. - uint32_t mRxBeaconRequest; ///< The number of received beacon request. - uint32_t mRxOther; ///< The number of received other types of frames. - uint32_t - mRxAddressFiltered; ///< The number of received packets filtered by address filter (whitelist or blacklist). - uint32_t mRxDestAddrFiltered; ///< The number of received packets filtered by destination check. - uint32_t mRxDuplicated; ///< The number of received duplicated packets. - uint32_t mRxErrNoFrame; ///< The number of received packets with no or malformed content. - uint32_t mRxErrUnknownNeighbor; ///< The number of received packets from unknown neighbor. - uint32_t mRxErrInvalidSrcAddr; ///< The number of received packets whose source address is invalid. - uint32_t mRxErrSec; ///< The number of received packets with security error. - uint32_t mRxErrFcs; ///< The number of received packets with FCS error. - uint32_t mRxErrOther; ///< The number of received packets with other error. -} otMacCounters; - -/** - * This structure represents the IP level counters. - * - */ -typedef struct otIpCounters -{ - uint32_t mTxSuccess; ///< The number of IPv6 packets successfully transmitted. - uint32_t mRxSuccess; ///< The number of IPv6 packets successfully received. - uint32_t mTxFailure; ///< The number of IPv6 packets failed to transmit. - uint32_t mRxFailure; ///< The number of IPv6 packets failed to receive. -} otIpCounters; - -/** - * This structure represents the message buffer information. - * - */ -typedef struct otBufferInfo -{ - uint16_t mTotalBuffers; ///< The number of buffers in the pool. - uint16_t mFreeBuffers; ///< The number of free message buffers. - uint16_t m6loSendMessages; ///< The number of messages in the 6lo send queue. - uint16_t m6loSendBuffers; ///< The number of buffers in the 6lo send queue. - uint16_t m6loReassemblyMessages; ///< The number of messages in the 6LoWPAN reassembly queue. - uint16_t m6loReassemblyBuffers; ///< The number of buffers in the 6LoWPAN reassembly queue. - uint16_t mIp6Messages; ///< The number of messages in the IPv6 send queue. - uint16_t mIp6Buffers; ///< The number of buffers in the IPv6 send queue. - uint16_t mMplMessages; ///< The number of messages in the MPL send queue. - uint16_t mMplBuffers; ///< The number of buffers in the MPL send queue. - uint16_t mMleMessages; ///< The number of messages in the MLE send queue. - uint16_t mMleBuffers; ///< The number of buffers in the MLE send queue. - uint16_t mArpMessages; ///< The number of messages in the ARP send queue. - uint16_t mArpBuffers; ///< The number of buffers in the ARP send queue. - uint16_t mCoapMessages; ///< The number of messages in the CoAP send queue. - uint16_t mCoapBuffers; ///< The number of buffers in the CoAP send queue. - uint16_t mCoapSecureMessages; ///< The number of messages in the CoAP secure send queue. - uint16_t mCoapSecureBuffers; ///< The number of buffers in the CoAP secure send queue. - uint16_t mApplicationCoapMessages; ///< The number of messages in the application CoAP send queue. - uint16_t mApplicationCoapBuffers; ///< The number of buffers in the application CoAP send queue. -} otBufferInfo; - -/** - * This structure represents an IPv6 network interface unicast address. - * - */ -typedef struct otNetifAddress -{ - otIp6Address mAddress; ///< The IPv6 unicast address. - uint8_t mPrefixLength; ///< The Prefix length. - bool mPreferred : 1; ///< TRUE if the address is preferred, FALSE otherwise. - bool mValid : 1; ///< TRUE if the address is valid, FALSE otherwise. - bool mScopeOverrideValid : 1; ///< TRUE if the mScopeOverride value is valid, FALSE otherwise. - unsigned int mScopeOverride : 4; ///< The IPv6 scope of this address. - bool mRloc : 1; ///< TRUE if the address is an RLOC, FALSE otherwise. - struct otNetifAddress *mNext; ///< A pointer to the next network interface address. -} otNetifAddress; - -/** - * This structure represents an IPv6 network interface multicast address. - * - */ -typedef struct otNetifMulticastAddress -{ - otIp6Address mAddress; ///< The IPv6 multicast address. - const struct otNetifMulticastAddress *mNext; ///< A pointer to the next network interface multicast address. -} otNetifMulticastAddress; - -/** - * This enumeration represents the list of allowable values for an InterfaceId. - * - */ -typedef enum otNetifInterfaceId { - OT_NETIF_INTERFACE_ID_HOST = -1, ///< The interface ID telling packets received by host side interfaces. - OT_NETIF_INTERFACE_ID_THREAD = 1, ///< The Thread Network interface ID. -} otNetifInterfaceId; - -/** - * This structure represents data used by Semantically Opaque IID Generator. - * - */ -typedef struct -{ - uint8_t *mInterfaceId; ///< String of bytes representing interface ID. Like "eth0" or "wlan0". - uint8_t mInterfaceIdLength; ///< Length of interface ID string. - - uint8_t *mNetworkId; ///< Network ID (or name). Can be null if mNetworkIdLength is 0. - uint8_t mNetworkIdLength; ///< Length of Network ID string. - - uint8_t mDadCounter; ///< Duplicate address detection counter. - - uint8_t *mSecretKey; ///< Secret key used to create IID. Cannot be null. - uint16_t mSecretKeyLength; ///< Secret key length in bytes. Should be at least 16 bytes == 128 bits. -} otSemanticallyOpaqueIidGeneratorData; - -/** - * This structure represents an IPv6 socket address. - * - */ -typedef struct otSockAddr -{ - otIp6Address mAddress; ///< An IPv6 address. - uint16_t mPort; ///< A transport-layer port. - int8_t mScopeId; ///< An IPv6 scope identifier. -} otSockAddr; - -/** - * This structure represents link-specific information for messages received from the Thread radio. - * - */ -typedef struct otThreadLinkInfo -{ - uint16_t mPanId; ///< Source PAN ID - uint8_t mChannel; ///< 802.15.4 Channel - int8_t mRss; ///< Received Signal Strength in dBm. - uint8_t mLqi; ///< Link Quality Indicator for a received message. - bool mLinkSecurity; ///< Indicates whether or not link security is enabled. - - // Applicable/Required only when time sync feature (`OPENTHREAD_CONFIG_ENABLE_TIME_SYNC`) is enabled. - uint8_t mTimeSyncSeq; ///< The time sync sequence. - int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time, in microseconds. -} otThreadLinkInfo; - -#ifdef OTDLL - -/** - * This function pointer is called to notify addition and removal of OpenThread devices. - * - * @param[in] aAdded A flag indicating if the device was added or removed. - * @param[in] aDeviceGuid A GUID indicating which device state changed. - * @param[in] aContext A pointer to application-specific context. - * - */ -typedef void(OTCALL *otDeviceAvailabilityChangedCallback)(bool aAdded, const GUID *aDeviceGuid, void *aContext); - -#endif // OTDLL - -/** - * Log levels. - * - * Implementation note: Log Levels are defines so that embedded implementations can eliminate code at compile time via - * #if/#else/#endif. See `openthread/platform/logging.h` for details. - * - * @sa OT_LOG_LEVEL_NONE and related macros. - * - */ -typedef uint8_t otLogLevel; - -/** - * This enumeration represents log regions. - * - */ -typedef enum otLogRegion { - OT_LOG_REGION_API = 1, ///< OpenThread API - OT_LOG_REGION_MLE = 2, ///< MLE - OT_LOG_REGION_ARP = 3, ///< EID-to-RLOC mapping. - OT_LOG_REGION_NET_DATA = 4, ///< Network Data - OT_LOG_REGION_ICMP = 5, ///< ICMPv6 - OT_LOG_REGION_IP6 = 6, ///< IPv6 - OT_LOG_REGION_MAC = 7, ///< IEEE 802.15.4 MAC - OT_LOG_REGION_MEM = 8, ///< Memory - OT_LOG_REGION_NCP = 9, ///< NCP - OT_LOG_REGION_MESH_COP = 10, ///< Mesh Commissioning Protocol - OT_LOG_REGION_NET_DIAG = 11, ///< Network Diagnostic - OT_LOG_REGION_PLATFORM = 12, ///< Platform - OT_LOG_REGION_COAP = 13, ///< CoAP - OT_LOG_REGION_CLI = 14, ///< CLI - OT_LOG_REGION_CORE = 15, ///< OpenThread Core - OT_LOG_REGION_UTIL = 16, ///< Utility module -} otLogRegion; - -/** - * @} - * - */ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // OPENTHREAD_TYPES_H_ diff --git a/include/openthread/udp.h b/include/openthread/udp.h index ba2a9c552..1324283c6 100644 --- a/include/openthread/udp.h +++ b/include/openthread/udp.h @@ -36,8 +36,8 @@ #ifndef OPENTHREAD_UDP_H_ #define OPENTHREAD_UDP_H_ +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 284ff6f42..29bfbb1ff 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -48,7 +48,6 @@ #if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC #include #endif -#include #if OPENTHREAD_FTD #include diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 49f66318a..d031033ca 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -40,7 +40,6 @@ #include #include -#include #include #include "cli/cli_server.hpp" diff --git a/src/cli/cli_coap.hpp b/src/cli/cli_coap.hpp index 2513d9c59..5b1ea75fc 100644 --- a/src/cli/cli_coap.hpp +++ b/src/cli/cli_coap.hpp @@ -38,8 +38,6 @@ #if OPENTHREAD_ENABLE_APPLICATION_COAP -#include - #include "coap/coap_header.hpp" namespace ot { diff --git a/src/cli/cli_dataset.cpp b/src/cli/cli_dataset.cpp index 9899fac34..bb826a645 100644 --- a/src/cli/cli_dataset.cpp +++ b/src/cli/cli_dataset.cpp @@ -37,8 +37,6 @@ #include #include "utils/wrap_string.h" -#include - #if OPENTHREAD_FTD #include #endif diff --git a/src/cli/cli_dataset.hpp b/src/cli/cli_dataset.hpp index 4d059a2ef..f926311a1 100644 --- a/src/cli/cli_dataset.hpp +++ b/src/cli/cli_dataset.hpp @@ -38,6 +38,8 @@ #include +#include + #include "cli/cli_server.hpp" namespace ot { diff --git a/src/cli/cli_instance.cpp b/src/cli/cli_instance.cpp index 23b037332..558abc40a 100644 --- a/src/cli/cli_instance.cpp +++ b/src/cli/cli_instance.cpp @@ -38,8 +38,6 @@ #include #include "utils/wrap_string.h" -#include - #include "cli.hpp" namespace ot { diff --git a/src/cli/cli_server.hpp b/src/cli/cli_server.hpp index 58cc7bcbf..6e3c1f65e 100644 --- a/src/cli/cli_server.hpp +++ b/src/cli/cli_server.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - namespace ot { namespace Cli { diff --git a/src/cli/cli_uart.hpp b/src/cli/cli_uart.hpp index 0c6435733..f3e5133ff 100644 --- a/src/cli/cli_uart.hpp +++ b/src/cli/cli_uart.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "cli/cli.hpp" #include "cli/cli_server.hpp" #include "common/instance.hpp" diff --git a/src/cli/cli_udp.hpp b/src/cli/cli_udp.hpp index 1c7742593..6cb527809 100644 --- a/src/cli/cli_udp.hpp +++ b/src/cli/cli_udp.hpp @@ -36,7 +36,7 @@ #include "openthread-core-config.h" -#include +#include #include "cli/cli.hpp" #include "cli/cli_server.hpp" diff --git a/src/cli/cli_udp_example.hpp b/src/cli/cli_udp_example.hpp index 7fcc2fec7..cb18f38d1 100644 --- a/src/cli/cli_udp_example.hpp +++ b/src/cli/cli_udp_example.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" -#include #include namespace ot { diff --git a/src/core/api/instance_api.cpp b/src/core/api/instance_api.cpp index 85baf4593..ab216cb7c 100644 --- a/src/core/api/instance_api.cpp +++ b/src/core/api/instance_api.cpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" #include -#include #include #include "common/instance.hpp" diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index c68d0848f..7d2320e02 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -39,7 +39,7 @@ #include "utils/wrap_stdbool.h" #include "utils/wrap_stdint.h" -#include +#include #include #if OPENTHREAD_RADIO || OPENTHREAD_ENABLE_RAW_LINK_API diff --git a/src/core/common/locator.hpp b/src/core/common/locator.hpp index ca35bc8c2..f10149f1b 100644 --- a/src/core/common/locator.hpp +++ b/src/core/common/locator.hpp @@ -36,7 +36,7 @@ #include "openthread-core-config.h" -#include +#include namespace ot { diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp index 7e555d891..c30bc44c7 100644 --- a/src/core/common/logging.cpp +++ b/src/core/common/logging.cpp @@ -35,8 +35,6 @@ #include "logging.hpp" -#include - #include "common/instance.hpp" /* diff --git a/src/core/common/logging.hpp b/src/core/common/logging.hpp index afa747f4c..ab0ee5263 100644 --- a/src/core/common/logging.hpp +++ b/src/core/common/logging.hpp @@ -41,7 +41,6 @@ #include "utils/wrap_string.h" #include -#include #include #ifdef WINDOWS_LOGGING diff --git a/src/core/common/notifier.hpp b/src/core/common/notifier.hpp index c1428079d..34744b323 100644 --- a/src/core/common/notifier.hpp +++ b/src/core/common/notifier.hpp @@ -40,7 +40,7 @@ #include "utils/wrap_stdint.h" #include -#include +#include #include "common/locator.hpp" #include "common/tasklet.hpp" diff --git a/src/core/common/owner-locator.hpp b/src/core/common/owner-locator.hpp index 7d193e5c2..608da5c18 100644 --- a/src/core/common/owner-locator.hpp +++ b/src/core/common/owner-locator.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" -#include #include "common/instance.hpp" #include "common/locator.hpp" diff --git a/src/core/common/string.hpp b/src/core/common/string.hpp index ac76b1851..895b0fd9b 100644 --- a/src/core/common/string.hpp +++ b/src/core/common/string.hpp @@ -37,10 +37,11 @@ #include "openthread-core-config.h" #include +#include #include #include "utils/wrap_string.h" -#include +#include #include "common/code_utils.hpp" diff --git a/src/core/common/tasklet.cpp b/src/core/common/tasklet.cpp index 1e61e0921..c824f9cf8 100644 --- a/src/core/common/tasklet.cpp +++ b/src/core/common/tasklet.cpp @@ -33,8 +33,6 @@ #include "tasklet.hpp" -#include - #include "common/code_utils.hpp" #include "common/debug.hpp" #include "common/instance.hpp" diff --git a/src/core/common/timer.hpp b/src/core/common/timer.hpp index 568e6a9fc..ca4aa34bc 100644 --- a/src/core/common/timer.hpp +++ b/src/core/common/timer.hpp @@ -39,7 +39,6 @@ #include #include "utils/wrap_stdint.h" -#include #include #include diff --git a/src/core/common/tlvs.hpp b/src/core/common/tlvs.hpp index 0ff58b036..ef3305a55 100644 --- a/src/core/common/tlvs.hpp +++ b/src/core/common/tlvs.hpp @@ -38,8 +38,6 @@ #include "utils/wrap_string.h" -#include - #include "common/encoding.hpp" #include "common/message.hpp" diff --git a/src/core/crypto/aes_ccm.hpp b/src/core/crypto/aes_ccm.hpp index 30142e04e..f4ca1df91 100644 --- a/src/core/crypto/aes_ccm.hpp +++ b/src/core/crypto/aes_ccm.hpp @@ -38,7 +38,7 @@ #include "utils/wrap_stdint.h" -#include +#include #include "crypto/aes_ecb.hpp" diff --git a/src/core/crypto/mbedtls.hpp b/src/core/crypto/mbedtls.hpp index 3cb33f4fd..bfa4097be 100644 --- a/src/core/crypto/mbedtls.hpp +++ b/src/core/crypto/mbedtls.hpp @@ -36,6 +36,8 @@ #include "openthread-core-config.h" +#include + #if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES namespace ot { diff --git a/src/core/mac/mac_filter.cpp b/src/core/mac/mac_filter.cpp index 48232b2df..eb87f51ab 100644 --- a/src/core/mac/mac_filter.cpp +++ b/src/core/mac/mac_filter.cpp @@ -33,7 +33,6 @@ #include "mac_filter.hpp" -#include #include "utils/wrap_string.h" #include "common/code_utils.hpp" diff --git a/src/core/mac/mac_filter.hpp b/src/core/mac/mac_filter.hpp index e6bcd00e4..fdef414f0 100644 --- a/src/core/mac/mac_filter.hpp +++ b/src/core/mac/mac_filter.hpp @@ -38,8 +38,6 @@ #include "utils/wrap_stdint.h" -#include - #include "mac/mac_frame.hpp" #if OPENTHREAD_ENABLE_MAC_FILTER diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index fd45070ab..e89ca5451 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -40,7 +40,7 @@ #include "utils/wrap_stdint.h" #include "utils/wrap_string.h" -#include +#include #include #include "common/encoding.hpp" diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp index f483106da..0581ca375 100644 --- a/src/core/meshcop/border_agent.cpp +++ b/src/core/meshcop/border_agent.cpp @@ -35,8 +35,6 @@ #include "border_agent.hpp" -#include - #include "coap/coap_header.hpp" #include "common/instance.hpp" #include "common/logging.hpp" diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index f6025f62f..4e5cae9c3 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -38,7 +38,6 @@ #include #include "utils/wrap_string.h" -#include #include #include "coap/coap_header.hpp" diff --git a/src/core/meshcop/dataset.hpp b/src/core/meshcop/dataset.hpp index f2c1c903e..1644cf2a1 100644 --- a/src/core/meshcop/dataset.hpp +++ b/src/core/meshcop/dataset.hpp @@ -37,6 +37,8 @@ #include "openthread-core-config.h" +#include + #include "common/locator.hpp" #include "common/message.hpp" #include "meshcop/meshcop_tlvs.hpp" diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index 2abd3d6fe..7a058b712 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -38,8 +38,6 @@ #include -#include - #include "common/instance.hpp" #include "common/logging.hpp" #include "common/owner-locator.hpp" diff --git a/src/core/meshcop/dataset_manager.hpp b/src/core/meshcop/dataset_manager.hpp index 9a1274908..a24aaef04 100644 --- a/src/core/meshcop/dataset_manager.hpp +++ b/src/core/meshcop/dataset_manager.hpp @@ -37,8 +37,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/meshcop/dtls.hpp b/src/core/meshcop/dtls.hpp index bf94011e6..80085fd18 100644 --- a/src/core/meshcop/dtls.hpp +++ b/src/core/meshcop/dtls.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include #include #include diff --git a/src/core/meshcop/joiner_router.hpp b/src/core/meshcop/joiner_router.hpp index f3b5d8ab7..a85c34d34 100644 --- a/src/core/meshcop/joiner_router.hpp +++ b/src/core/meshcop/joiner_router.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "coap/coap_header.hpp" #include "common/locator.hpp" diff --git a/src/core/meshcop/meshcop.hpp b/src/core/meshcop/meshcop.hpp index 4853d0e5a..283672934 100644 --- a/src/core/meshcop/meshcop.hpp +++ b/src/core/meshcop/meshcop.hpp @@ -37,6 +37,8 @@ #include "openthread-core-config.h" +#include + #include "coap/coap.hpp" #include "common/message.hpp" #include "mac/mac_frame.hpp" diff --git a/src/core/meshcop/meshcop_tlvs.hpp b/src/core/meshcop/meshcop_tlvs.hpp index af364c2b5..202cf7f1d 100644 --- a/src/core/meshcop/meshcop_tlvs.hpp +++ b/src/core/meshcop/meshcop_tlvs.hpp @@ -39,7 +39,8 @@ #include "utils/wrap_string.h" -#include +#include +#include #include "common/crc16.hpp" #include "common/encoding.hpp" diff --git a/src/core/meshcop/timestamp.cpp b/src/core/meshcop/timestamp.cpp index 7a0aed501..77fc9899f 100644 --- a/src/core/meshcop/timestamp.cpp +++ b/src/core/meshcop/timestamp.cpp @@ -35,8 +35,6 @@ #include "utils/wrap_string.h" -#include - namespace ot { namespace MeshCoP { diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp index 9aae866cb..80ab906f6 100644 --- a/src/core/net/dhcp6_client.cpp +++ b/src/core/net/dhcp6_client.cpp @@ -35,8 +35,6 @@ #include "dhcp6_client.hpp" -#include - #include "common/code_utils.hpp" #include "common/encoding.hpp" #include "common/instance.hpp" diff --git a/src/core/net/dhcp6_server.cpp b/src/core/net/dhcp6_server.cpp index d9796df0b..d6200faae 100644 --- a/src/core/net/dhcp6_server.cpp +++ b/src/core/net/dhcp6_server.cpp @@ -35,8 +35,6 @@ #include "dhcp6_server.hpp" -#include - #include "common/code_utils.hpp" #include "common/encoding.hpp" #include "common/instance.hpp" diff --git a/src/core/net/dhcp6_server.hpp b/src/core/net/dhcp6_server.hpp index 15d5e3122..d3c3de8f4 100644 --- a/src/core/net/dhcp6_server.hpp +++ b/src/core/net/dhcp6_server.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "mac/mac.hpp" #include "mac/mac_frame.hpp" diff --git a/src/core/net/dns_client.hpp b/src/core/net/dns_client.hpp index 6313ce44d..7db5bc5a8 100644 --- a/src/core/net/dns_client.hpp +++ b/src/core/net/dns_client.hpp @@ -32,7 +32,6 @@ #include "openthread-core-config.h" #include -#include #include "common/message.hpp" #include "common/timer.hpp" diff --git a/src/core/net/dns_headers.hpp b/src/core/net/dns_headers.hpp index 1b8a99b1a..4fea324bf 100644 --- a/src/core/net/dns_headers.hpp +++ b/src/core/net/dns_headers.hpp @@ -38,8 +38,6 @@ #include "utils/wrap_string.h" -#include - #include "common/encoding.hpp" #include "common/message.hpp" diff --git a/src/core/net/ip6_address.hpp b/src/core/net/ip6_address.hpp index 21d44c44f..8da0f0be2 100644 --- a/src/core/net/ip6_address.hpp +++ b/src/core/net/ip6_address.hpp @@ -38,8 +38,6 @@ #include "utils/wrap_stdint.h" -#include - #include "common/string.hpp" #include "mac/mac_frame.hpp" diff --git a/src/core/net/ip6_filter.hpp b/src/core/net/ip6_filter.hpp index 8a0d04978..8e91c67d7 100644 --- a/src/core/net/ip6_filter.hpp +++ b/src/core/net/ip6_filter.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/message.hpp" namespace ot { diff --git a/src/core/net/ip6_headers.hpp b/src/core/net/ip6_headers.hpp index e08153179..433f3c1eb 100644 --- a/src/core/net/ip6_headers.hpp +++ b/src/core/net/ip6_headers.hpp @@ -38,8 +38,6 @@ #include -#include - #include "common/encoding.hpp" #include "common/message.hpp" #include "net/ip6_address.hpp" diff --git a/src/core/net/ip6_mpl.hpp b/src/core/net/ip6_mpl.hpp index 8d038cddb..42ab1df98 100644 --- a/src/core/net/ip6_mpl.hpp +++ b/src/core/net/ip6_mpl.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "common/message.hpp" #include "common/timer.hpp" diff --git a/src/core/net/ip6_routes.hpp b/src/core/net/ip6_routes.hpp index 823ce8e74..ff1646096 100644 --- a/src/core/net/ip6_routes.hpp +++ b/src/core/net/ip6_routes.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "common/message.hpp" #include "net/ip6_address.hpp" diff --git a/src/core/net/socket.hpp b/src/core/net/socket.hpp index c250526d3..7f365ca6b 100644 --- a/src/core/net/socket.hpp +++ b/src/core/net/socket.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "net/ip6_address.hpp" namespace ot { diff --git a/src/core/net/tcp.hpp b/src/core/net/tcp.hpp index 3acd2a85f..78f598fb2 100644 --- a/src/core/net/tcp.hpp +++ b/src/core/net/tcp.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "net/ip6_headers.hpp" namespace ot { diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index 25190b12d..1228a1177 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/announce_begin_server.hpp b/src/core/thread/announce_begin_server.hpp index 2c5dafdad..97174e112 100644 --- a/src/core/thread/announce_begin_server.hpp +++ b/src/core/thread/announce_begin_server.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/announce_sender.hpp b/src/core/thread/announce_sender.hpp index fe76d3976..f7ce1e2c0 100644 --- a/src/core/thread/announce_sender.hpp +++ b/src/core/thread/announce_sender.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "common/notifier.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/data_poll_manager.hpp b/src/core/thread/data_poll_manager.hpp index a2748e976..03b3d1dd6 100644 --- a/src/core/thread/data_poll_manager.hpp +++ b/src/core/thread/data_poll_manager.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/code_utils.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/energy_scan_server.hpp b/src/core/thread/energy_scan_server.hpp index 32d31b5da..abcad60bb 100644 --- a/src/core/thread/energy_scan_server.hpp +++ b/src/core/thread/energy_scan_server.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "common/notifier.hpp" diff --git a/src/core/thread/key_manager.hpp b/src/core/thread/key_manager.hpp index fe3a7a1f4..660f5296f 100644 --- a/src/core/thread/key_manager.hpp +++ b/src/core/thread/key_manager.hpp @@ -38,7 +38,7 @@ #include "utils/wrap_stdint.h" -#include +#include #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/link_quality.hpp b/src/core/thread/link_quality.hpp index 91a00c52d..d40cff03a 100644 --- a/src/core/thread/link_quality.hpp +++ b/src/core/thread/link_quality.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" -#include #include #include "common/string.hpp" diff --git a/src/core/thread/mesh_forwarder.hpp b/src/core/thread/mesh_forwarder.hpp index e6647b62f..985120c88 100644 --- a/src/core/thread/mesh_forwarder.hpp +++ b/src/core/thread/mesh_forwarder.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "common/tasklet.hpp" #include "mac/mac.hpp" diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index d8fa2d06d..12339aadc 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/encoding.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/mle_tlvs.hpp b/src/core/thread/mle_tlvs.hpp index 39e0739ae..54f22bb73 100644 --- a/src/core/thread/mle_tlvs.hpp +++ b/src/core/thread/mle_tlvs.hpp @@ -38,8 +38,6 @@ #include "utils/wrap_string.h" -#include - #include "common/encoding.hpp" #include "common/message.hpp" #include "common/tlvs.hpp" diff --git a/src/core/thread/network_data.hpp b/src/core/thread/network_data.hpp index a9a37f05d..727a2caa5 100644 --- a/src/core/thread/network_data.hpp +++ b/src/core/thread/network_data.hpp @@ -36,7 +36,8 @@ #include "openthread-core-config.h" -#include +#include +#include #include "coap/coap.hpp" #include "common/locator.hpp" diff --git a/src/core/thread/network_diagnostic.hpp b/src/core/thread/network_diagnostic.hpp index c76069e65..0dfa9d483 100644 --- a/src/core/thread/network_diagnostic.hpp +++ b/src/core/thread/network_diagnostic.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "net/udp6.hpp" diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index 8a9e48665..02c8069ad 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -38,7 +38,7 @@ #include "utils/wrap_string.h" -#include +#include #include "common/encoding.hpp" #include "common/message.hpp" diff --git a/src/core/thread/panid_query_server.hpp b/src/core/thread/panid_query_server.hpp index bb37c5d44..aa145fa27 100644 --- a/src/core/thread/panid_query_server.hpp +++ b/src/core/thread/panid_query_server.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "common/locator.hpp" #include "common/timer.hpp" diff --git a/src/core/thread/src_match_controller.hpp b/src/core/thread/src_match_controller.hpp index 21eb0df63..110d6e605 100644 --- a/src/core/thread/src_match_controller.hpp +++ b/src/core/thread/src_match_controller.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/locator.hpp" #include "thread/topology.hpp" diff --git a/src/core/thread/thread_netif.hpp b/src/core/thread/thread_netif.hpp index 49d392ecb..083d9a344 100644 --- a/src/core/thread/thread_netif.hpp +++ b/src/core/thread/thread_netif.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "coap/coap.hpp" #include "coap/coap_secure.hpp" #include "mac/mac.hpp" diff --git a/src/core/thread/thread_tlvs.hpp b/src/core/thread/thread_tlvs.hpp index f857b32df..8c366181b 100644 --- a/src/core/thread/thread_tlvs.hpp +++ b/src/core/thread/thread_tlvs.hpp @@ -36,8 +36,6 @@ #include "openthread-core-config.h" -#include - #include "common/encoding.hpp" #include "common/message.hpp" #include "common/tlvs.hpp" diff --git a/src/core/thread/time_sync_service.hpp b/src/core/thread/time_sync_service.hpp index 71a8f4fc2..461e0bc41 100644 --- a/src/core/thread/time_sync_service.hpp +++ b/src/core/thread/time_sync_service.hpp @@ -38,7 +38,6 @@ #if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC #include -#include #include "common/locator.hpp" #include "common/message.hpp" diff --git a/src/core/thread/topology.hpp b/src/core/thread/topology.hpp index 0d3367327..7fd0b3eb0 100644 --- a/src/core/thread/topology.hpp +++ b/src/core/thread/topology.hpp @@ -36,6 +36,8 @@ #include "openthread-core-config.h" +#include + #include "common/message.hpp" #include "common/random.hpp" #include "mac/mac_frame.hpp" diff --git a/src/core/utils/channel_manager.hpp b/src/core/utils/channel_manager.hpp index 24742d018..8cb0c8514 100644 --- a/src/core/utils/channel_manager.hpp +++ b/src/core/utils/channel_manager.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" -#include #include #include "common/locator.hpp" diff --git a/src/core/utils/channel_monitor.hpp b/src/core/utils/channel_monitor.hpp index ea3574487..5bb705530 100644 --- a/src/core/utils/channel_monitor.hpp +++ b/src/core/utils/channel_monitor.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" -#include #include #include "common/locator.hpp" diff --git a/src/core/utils/child_supervision.cpp b/src/core/utils/child_supervision.cpp index 71d026454..cb0bc057e 100644 --- a/src/core/utils/child_supervision.cpp +++ b/src/core/utils/child_supervision.cpp @@ -33,8 +33,6 @@ #include "child_supervision.hpp" -#include - #include "openthread-core-config.h" #include "common/code_utils.hpp" #include "common/instance.hpp" diff --git a/src/core/utils/jam_detector.cpp b/src/core/utils/jam_detector.cpp index 1ec2d22f2..2bb4a5736 100644 --- a/src/core/utils/jam_detector.cpp +++ b/src/core/utils/jam_detector.cpp @@ -33,8 +33,6 @@ #include "jam_detector.hpp" -#include - #include "common/code_utils.hpp" #include "common/instance.hpp" #include "common/logging.hpp" diff --git a/src/core/utils/slaac_address.cpp b/src/core/utils/slaac_address.cpp index de1dbef1b..ccd3d81c4 100644 --- a/src/core/utils/slaac_address.cpp +++ b/src/core/utils/slaac_address.cpp @@ -35,7 +35,8 @@ #include "utils/wrap_string.h" -#include +#include +#include #include "common/code_utils.hpp" #include "common/debug.hpp" diff --git a/src/core/utils/slaac_address.hpp b/src/core/utils/slaac_address.hpp index 7715aa590..34a4df920 100644 --- a/src/core/utils/slaac_address.hpp +++ b/src/core/utils/slaac_address.hpp @@ -36,7 +36,7 @@ #include "openthread-core-config.h" -#include +#include namespace ot { namespace Utils { diff --git a/src/diag/diag_process.hpp b/src/diag/diag_process.hpp index 361c5f7d9..c304193d3 100644 --- a/src/diag/diag_process.hpp +++ b/src/diag/diag_process.hpp @@ -38,7 +38,6 @@ #include -#include #include #include #include diff --git a/src/ncp/changed_props_set.hpp b/src/ncp/changed_props_set.hpp index 79c8e94cb..c92db15de 100644 --- a/src/ncp/changed_props_set.hpp +++ b/src/ncp/changed_props_set.hpp @@ -37,7 +37,7 @@ #include -#include +#include #include "spinel.h" diff --git a/src/ncp/hdlc.hpp b/src/ncp/hdlc.hpp index 7b5fba5a7..6252d802c 100644 --- a/src/ncp/hdlc.hpp +++ b/src/ncp/hdlc.hpp @@ -35,7 +35,9 @@ #include "openthread-core-config.h" -#include +#include + +#include namespace ot { diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 3f0e2ddc6..5b955dada 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index f28569989..e8631f6b5 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -46,7 +46,6 @@ #include #include #include -#include #include "changed_props_set.hpp" #include "common/instance.hpp" diff --git a/src/ncp/ncp_base_ftd.cpp b/src/ncp/ncp_base_ftd.cpp index d78d487f9..c06c549f9 100644 --- a/src/ncp/ncp_base_ftd.cpp +++ b/src/ncp/ncp_base_ftd.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 145357626..4b37182cb 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -52,7 +52,6 @@ #if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC #include #endif -#include #include #include #if OPENTHREAD_FTD diff --git a/src/ncp/ncp_base_radio.cpp b/src/ncp/ncp_base_radio.cpp index d49399e4e..369882134 100644 --- a/src/ncp/ncp_base_radio.cpp +++ b/src/ncp/ncp_base_radio.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "common/code_utils.hpp" diff --git a/src/ncp/ncp_buffer.hpp b/src/ncp/ncp_buffer.hpp index 6dc9a3ead..8ae19309e 100644 --- a/src/ncp/ncp_buffer.hpp +++ b/src/ncp/ncp_buffer.hpp @@ -36,7 +36,6 @@ #include "openthread-core-config.h" #include -#include namespace ot { namespace Ncp { diff --git a/src/ncp/spinel_decoder.hpp b/src/ncp/spinel_decoder.hpp index d267c7c70..96780cdd5 100644 --- a/src/ncp/spinel_decoder.hpp +++ b/src/ncp/spinel_decoder.hpp @@ -35,8 +35,8 @@ #include +#include #include -#include #include "openthread-core-config.h" #include "ncp/spinel.h" diff --git a/src/ncp/spinel_encoder.hpp b/src/ncp/spinel_encoder.hpp index c729107d7..b5652c921 100644 --- a/src/ncp/spinel_encoder.hpp +++ b/src/ncp/spinel_encoder.hpp @@ -35,9 +35,9 @@ #include "openthread-core-config.h" +#include #include #include -#include #include "openthread-core-config.h" #include "ncp/ncp_buffer.hpp" diff --git a/src/posix/main.c b/src/posix/main.c index c757d28d2..fb0d1f1b3 100644 --- a/src/posix/main.c +++ b/src/posix/main.c @@ -35,6 +35,7 @@ #define OPENTHREAD_POSIX_APP_CLI 2 #include +#include #if OPENTHREAD_POSIX_APP == OPENTHREAD_POSIX_APP_NCP #include #elif OPENTHREAD_POSIX_APP == OPENTHREAD_POSIX_APP_CLI @@ -42,7 +43,6 @@ #else #error "Unknown posix app mode!" #endif -#include #include #include "openthread-system.h" diff --git a/src/posix/platform/debug_uart.c b/src/posix/platform/debug_uart.c index 40d0ea214..d34a54718 100644 --- a/src/posix/platform/debug_uart.c +++ b/src/posix/platform/debug_uart.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/src/posix/platform/diag.c b/src/posix/platform/diag.c index 7a49dd91a..800a0c0be 100644 --- a/src/posix/platform/diag.c +++ b/src/posix/platform/diag.c @@ -34,7 +34,6 @@ #include #include -#include #include #include diff --git a/src/posix/platform/flash.h b/src/posix/platform/flash.h index 8ffc29e49..10c7029bb 100644 --- a/src/posix/platform/flash.h +++ b/src/posix/platform/flash.h @@ -37,7 +37,7 @@ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/posix/platform/misc.c b/src/posix/platform/misc.c index ee4b296d5..012142cc2 100644 --- a/src/posix/platform/misc.c +++ b/src/posix/platform/misc.c @@ -30,7 +30,6 @@ #include -#include #include #include "openthread-system.h" diff --git a/src/posix/platform/openthread-system.h b/src/posix/platform/openthread-system.h index 461fcc645..8ae241c6e 100644 --- a/src/posix/platform/openthread-system.h +++ b/src/posix/platform/openthread-system.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_SYSTEM_H_ #define OPENTHREAD_SYSTEM_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/posix/platform/platform-posix.h b/src/posix/platform/platform-posix.h index 9ea6d949b..20ed4e2c9 100644 --- a/src/posix/platform/platform-posix.h +++ b/src/posix/platform/platform-posix.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include "openthread-core-config.h" diff --git a/src/posix/platform/radio_spinel.hpp b/src/posix/platform/radio_spinel.hpp index cc0061a46..21f28bf46 100644 --- a/src/posix/platform/radio_spinel.hpp +++ b/src/posix/platform/radio_spinel.hpp @@ -34,6 +34,8 @@ #ifndef RADIO_SPINEL_HPP_ #define RADIO_SPINEL_HPP_ +#include + #include "frame_queue.hpp" #include "hdlc.hpp" #include "spinel.h" diff --git a/src/posix/platform/random.c b/src/posix/platform/random.c index 37c132dcc..a708c198d 100644 --- a/src/posix/platform/random.c +++ b/src/posix/platform/random.c @@ -37,7 +37,6 @@ #include "platform-posix.h" -#include #include #include "code_utils.h" diff --git a/src/posix/platform/settings.cpp b/src/posix/platform/settings.cpp index 9f9ee8105..47b013761 100644 --- a/src/posix/platform/settings.cpp +++ b/src/posix/platform/settings.cpp @@ -39,8 +39,7 @@ #include -#include "openthread/platform/settings.h" -#include "openthread/types.h" +#include #include diff --git a/src/posix/platform/system.c b/src/posix/platform/system.c index 859bc5f77..c6c842732 100644 --- a/src/posix/platform/system.c +++ b/src/posix/platform/system.c @@ -43,7 +43,6 @@ #include #include -#include #include #include diff --git a/tests/fuzz/ip6_send.cpp b/tests/fuzz/ip6_send.cpp index 3c4125f46..be67e091a 100644 --- a/tests/fuzz/ip6_send.cpp +++ b/tests/fuzz/ip6_send.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include "common/code_utils.hpp" diff --git a/tests/fuzz/radio_receive_done.cpp b/tests/fuzz/radio_receive_done.cpp index 2a16b473c..6b84214f1 100644 --- a/tests/fuzz/radio_receive_done.cpp +++ b/tests/fuzz/radio_receive_done.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "common/code_utils.hpp" diff --git a/tests/unit/test_aes.cpp b/tests/unit/test_aes.cpp index f6eda4b44..c42bc9dbc 100644 --- a/tests/unit/test_aes.cpp +++ b/tests/unit/test_aes.cpp @@ -27,7 +27,6 @@ */ #include -#include #include "common/debug.hpp" #include "crypto/aes_ccm.hpp" diff --git a/tests/unit/test_child.cpp b/tests/unit/test_child.cpp index adc54fea7..604a44a62 100644 --- a/tests/unit/test_child.cpp +++ b/tests/unit/test_child.cpp @@ -29,7 +29,6 @@ #include "test_platform.h" #include -#include #include "test_util.h" #include "common/code_utils.hpp" diff --git a/tests/unit/test_child_table.cpp b/tests/unit/test_child_table.cpp index d6061847e..ad5e11046 100644 --- a/tests/unit/test_child_table.cpp +++ b/tests/unit/test_child_table.cpp @@ -29,7 +29,6 @@ #include "test_platform.h" #include -#include #include "test_util.h" #include "common/code_utils.hpp" diff --git a/tests/unit/test_hmac_sha256.cpp b/tests/unit/test_hmac_sha256.cpp index dd9f7449a..729e5c621 100644 --- a/tests/unit/test_hmac_sha256.cpp +++ b/tests/unit/test_hmac_sha256.cpp @@ -27,7 +27,6 @@ */ #include -#include #include "common/debug.hpp" #include "crypto/hmac_sha256.hpp" diff --git a/tests/unit/test_link_quality.cpp b/tests/unit/test_link_quality.cpp index feeb73829..caccb117c 100644 --- a/tests/unit/test_link_quality.cpp +++ b/tests/unit/test_link_quality.cpp @@ -26,8 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "common/code_utils.hpp" #include "thread/link_quality.hpp" #include "utils/wrap_string.h" diff --git a/tests/unit/test_lowpan.hpp b/tests/unit/test_lowpan.hpp index 5bed5c94b..b2af72011 100644 --- a/tests/unit/test_lowpan.hpp +++ b/tests/unit/test_lowpan.hpp @@ -29,8 +29,6 @@ #ifndef TEST_LOWPAN_HPP #define TEST_LOWPAN_HPP -#include - #include "common/instance.hpp" #include "mac/mac.hpp" #include "net/ip6_headers.hpp" diff --git a/tests/unit/test_mac_frame.cpp b/tests/unit/test_mac_frame.cpp index 9daeec60a..ea75f584e 100644 --- a/tests/unit/test_mac_frame.cpp +++ b/tests/unit/test_mac_frame.cpp @@ -26,8 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "common/code_utils.hpp" #include "common/debug.hpp" #include "mac/mac.hpp" diff --git a/tests/unit/test_message.cpp b/tests/unit/test_message.cpp index 377c25b73..f508f4ef5 100644 --- a/tests/unit/test_message.cpp +++ b/tests/unit/test_message.cpp @@ -26,8 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "common/debug.hpp" #include "common/instance.hpp" #include "common/message.hpp" diff --git a/tests/unit/test_message_queue.cpp b/tests/unit/test_message_queue.cpp index d0186d970..b4c187558 100644 --- a/tests/unit/test_message_queue.cpp +++ b/tests/unit/test_message_queue.cpp @@ -31,7 +31,6 @@ #include "test_platform.h" #include -#include #include "common/debug.hpp" #include "common/instance.hpp" diff --git a/tests/unit/test_ncp_buffer.cpp b/tests/unit/test_ncp_buffer.cpp index 4ac0b0457..28b494362 100644 --- a/tests/unit/test_ncp_buffer.cpp +++ b/tests/unit/test_ncp_buffer.cpp @@ -28,8 +28,6 @@ #include -#include - #include "common/code_utils.hpp" #include "common/instance.hpp" #include "common/message.hpp" diff --git a/tests/unit/test_platform.h b/tests/unit/test_platform.h index 9290029cb..5471fa6ea 100644 --- a/tests/unit/test_platform.h +++ b/tests/unit/test_platform.h @@ -38,7 +38,6 @@ #include #include -#include #include #include #include diff --git a/tests/unit/test_priority_queue.cpp b/tests/unit/test_priority_queue.cpp index cb97d3639..a3b8d0d01 100644 --- a/tests/unit/test_priority_queue.cpp +++ b/tests/unit/test_priority_queue.cpp @@ -28,8 +28,6 @@ #include -#include - #include "common/debug.hpp" #include "common/instance.hpp" #include "common/message.hpp" diff --git a/tests/unit/test_pskc.cpp b/tests/unit/test_pskc.cpp index 0ee9d0229..4e79e3bd0 100644 --- a/tests/unit/test_pskc.cpp +++ b/tests/unit/test_pskc.cpp @@ -26,7 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include #include "common/logging.hpp" #include "meshcop/commissioner.hpp" diff --git a/tests/unit/test_spinel_decoder.cpp b/tests/unit/test_spinel_decoder.cpp index c6680bd31..4af4f9fe5 100644 --- a/tests/unit/test_spinel_decoder.cpp +++ b/tests/unit/test_spinel_decoder.cpp @@ -28,8 +28,6 @@ #include -#include - #include "common/code_utils.hpp" #include "common/instance.hpp" #include "ncp/spinel_decoder.hpp" diff --git a/tests/unit/test_spinel_encoder.cpp b/tests/unit/test_spinel_encoder.cpp index e430d1e0c..b19a825d6 100644 --- a/tests/unit/test_spinel_encoder.cpp +++ b/tests/unit/test_spinel_encoder.cpp @@ -28,8 +28,6 @@ #include -#include - #include "common/code_utils.hpp" #include "common/instance.hpp" #include "ncp/spinel_encoder.hpp" diff --git a/tests/unit/test_string.cpp b/tests/unit/test_string.cpp index 60973cacc..b8abdf10b 100644 --- a/tests/unit/test_string.cpp +++ b/tests/unit/test_string.cpp @@ -29,7 +29,6 @@ #include "test_platform.h" #include -#include #include "test_util.h" #include "common/code_utils.hpp" diff --git a/tests/unit/test_toolchain.cpp b/tests/unit/test_toolchain.cpp index 7409604d4..800ccca72 100644 --- a/tests/unit/test_toolchain.cpp +++ b/tests/unit/test_toolchain.cpp @@ -28,6 +28,7 @@ #include +#include #include #include "test_util.h" diff --git a/tests/unit/test_toolchain_c.c b/tests/unit/test_toolchain_c.c index fa465a22e..0159e4296 100644 --- a/tests/unit/test_toolchain_c.c +++ b/tests/unit/test_toolchain_c.c @@ -31,6 +31,7 @@ #include #include +#include #include #include "test_util.h" diff --git a/tests/unit/test_util.cpp b/tests/unit/test_util.cpp index 8caa4424e..1c84bd354 100644 --- a/tests/unit/test_util.cpp +++ b/tests/unit/test_util.cpp @@ -33,6 +33,8 @@ #include #include +#include + void otTestHexToVector(std::string &aHex, std::vector &aOutBytes) { std::istringstream ss(aHex); diff --git a/tests/unit/test_util.h b/tests/unit/test_util.h index 14b7a30c0..3021b7812 100644 --- a/tests/unit/test_util.h +++ b/tests/unit/test_util.h @@ -32,8 +32,6 @@ #include #include -#include - #ifndef _WIN32 #ifdef __cplusplus