mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 11:17:46 +00:00
* Convert FTD/MTD methods and remove if/else/endif from Makefiles
This commit is contained in:
committed by
Jonathan Hui
parent
79ab4b7c0b
commit
358ca8ee77
+3
-3
@@ -37,13 +37,13 @@ set -x
|
||||
[ $BUILD_TARGET != pretty-check ] || {
|
||||
export PATH=/tmp/astyle/build/gcc/bin:$PATH || die
|
||||
./bootstrap || die
|
||||
./configure --enable-ftd --enable-cli --enable-diag --enable-dhcp6-client --enable-dhcp6-server --enable-dns-client --enable-commissioner --enable-joiner --enable-application-coap --with-examples=posix || die
|
||||
./configure --enable-cli-app=all --enable-ncp-app=all --enable-diag --enable-dhcp6-client --enable-dhcp6-server --enable-dns-client --enable-commissioner --enable-joiner --enable-application-coap --with-examples=posix || die
|
||||
make pretty-check || die
|
||||
}
|
||||
|
||||
[ $BUILD_TARGET != scan-build ] || {
|
||||
./bootstrap || die
|
||||
scan-build ./configure --with-examples=posix --enable-ftd --enable-cli --enable-ncp || die
|
||||
scan-build ./configure --with-examples=posix --enable-cli-app=all --enable-ncp-app=all --with-ncp-bus=uart || die
|
||||
scan-build --status-bugs -analyze-headers -v make || die
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ set -x
|
||||
|
||||
[ $BUILD_TARGET != posix-ncp-spi ] || {
|
||||
./bootstrap || die
|
||||
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ftd --enable-ncp=spi --with-examples=posix --with-platform-info=POSIX" || die
|
||||
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ncp-app=ftd --with-ncp-bus=spi --with-examples=posix --with-platform-info=POSIX" || die
|
||||
}
|
||||
|
||||
[ $BUILD_TARGET != posix-ncp ] || {
|
||||
|
||||
+3
-3
@@ -32,9 +32,9 @@ AM_MAKEFLAGS = --no-print-directory
|
||||
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--enable-address-sanitizer \
|
||||
--enable-ftd \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=all \
|
||||
--enable-ncp-app=all \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-diag \
|
||||
--with-examples=posix \
|
||||
--enable-commissioner \
|
||||
|
||||
+141
-57
@@ -349,81 +349,161 @@ NL_ENABLE_TESTS([yes])
|
||||
|
||||
AM_CONDITIONAL([OPENTHREAD_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
|
||||
|
||||
#
|
||||
# Full Thread Device
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([whether to enable FTD])
|
||||
AC_ARG_ENABLE(ftd,
|
||||
[AS_HELP_STRING([--enable-ftd],[Enable Full Thread Device features @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
|
||||
no|yes)
|
||||
enable_ftd=${enableval}
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${enable_ftd} for --enable-ftd])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_ftd=no])
|
||||
AC_MSG_RESULT(${enable_ftd})
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_FTD], [test "${enable_ftd}" = "yes"])
|
||||
|
||||
#
|
||||
# CLI Library
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the CLI app])
|
||||
AC_ARG_ENABLE(cli,
|
||||
[AS_HELP_STRING([--enable-cli],[Enable CLI support @<:@default=no@:>@.])],
|
||||
AC_ARG_ENABLE(cli-app,
|
||||
[AS_HELP_STRING([--enable-cli-app],[Enable CLI support (no|mtd|ftd|all) @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
all|both)
|
||||
enable_cli_app=yes
|
||||
enable_cli_app_mtd=yes
|
||||
enable_cli_app_ftd=yes
|
||||
;;
|
||||
no|yes)
|
||||
enable_cli_app=${enableval}
|
||||
enable_cli_app_mtd=${enableval}
|
||||
enable_cli_app_ftd=${enableval}
|
||||
;;
|
||||
mtd)
|
||||
enable_cli_app=yes
|
||||
enable_cli_app_mtd=yes
|
||||
enable_cli_app_ftd=no
|
||||
;;
|
||||
ftd)
|
||||
enable_cli_app=yes
|
||||
enable_cli_app_mtd=no
|
||||
enable_cli_app_ftd=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${enableval} for --enable-cli-app])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[
|
||||
enable_cli_app=no
|
||||
enable_cli_app_mtd=no
|
||||
enable_cli_app_ftd=no])
|
||||
|
||||
|
||||
AC_MSG_CHECKING([cli-app modes])
|
||||
AC_MSG_RESULT(${enable_cli_app})
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI], [test "${enable_cli_app}" == "yes"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI_MTD], [test "${enable_cli_app_mtd}" == "yes"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI_FTD], [test "${enable_cli_app_ftd}" == "yes"])
|
||||
AC_SUBST(OPENTHREAD_ENABLE_CLI)
|
||||
AC_SUBST(OPENTHREAD_ENABLE_CLI_FTD)
|
||||
AC_SUBST(OPENTHREAD_ENABLE_CLI_MTD)
|
||||
|
||||
|
||||
#
|
||||
# NCP app
|
||||
#
|
||||
AC_ARG_ENABLE(ncp-app,
|
||||
[AS_HELP_STRING([--enable-ncp-app],[Enable NCP support (no|mtd|ftd|all) @<:@default=no@:>@.])],
|
||||
[
|
||||
# Map all & both to yes
|
||||
case "${enableval}" in
|
||||
all|both)
|
||||
enableval=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
case "${enableval}" in
|
||||
|
||||
no|yes)
|
||||
enable_cli=${enableval}
|
||||
enable_ncp_app=${enableval}
|
||||
enable_ncp_app_mtd=${enableval}
|
||||
enable_ncp_app_ftd=${enableval}
|
||||
;;
|
||||
|
||||
mtd)
|
||||
enable_ncp_app=yes
|
||||
enable_ncp_app_mtd=yes
|
||||
enable_ncp_app_ftd=no
|
||||
;;
|
||||
|
||||
ftd)
|
||||
enable_ncp_app=yes
|
||||
enable_ncp_app_mtd=no
|
||||
enable_ncp_app_ftd=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${with_cli} for --enable-cli])
|
||||
AC_MSG_ERROR([Invalid value ${enableval} for --enable-ncp-app])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_cli=no])
|
||||
AC_MSG_RESULT(${enable_cli})
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI], [test "${enable_cli}" != "no"])
|
||||
|
||||
#
|
||||
# NCP Library
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the NCP app, and the bus it uses])
|
||||
AC_ARG_ENABLE(ncp,
|
||||
[AS_HELP_STRING([--enable-ncp[[=spi|uart]]],[Enable NCP support @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
enable_ncp_app=no
|
||||
enable_ncp_app_ftd=no
|
||||
enable_ncp_app_mtd=no
|
||||
]
|
||||
)
|
||||
|
||||
no|spi|uart)
|
||||
enable_ncp=${enableval}
|
||||
|
||||
AC_MSG_CHECKING([ncp-app modes])
|
||||
AC_MSG_RESULT(${enable_ncp_app})
|
||||
AC_MSG_CHECKING([should NCP support ftd])
|
||||
AC_MSG_RESULT(${enable_ncp_app_ftd})
|
||||
AC_MSG_CHECKING([should NCP support mtd])
|
||||
AC_MSG_RESULT(${enable_ncp_app_mtd})
|
||||
|
||||
AC_SUBST(OPENTHREAD_ENABLE_NCP)
|
||||
AC_SUBST(OPENTHREAD_ENABLE_NCP_MTD)
|
||||
AC_SUBST(OPENTHREAD_ENABLE_NCP_FTD)
|
||||
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP], [test "${enable_ncp_app}" == "yes"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_MTD], [test "${enable_ncp_app_mtd}" == "yes"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_FTD], [test "${enable_ncp_app_ftd}" == "yes"])
|
||||
|
||||
#
|
||||
# NCP BUS - how does the NCP talk to the host?
|
||||
#
|
||||
|
||||
AC_ARG_WITH(
|
||||
[ncp-bus],
|
||||
[AS_HELP_STRING([--with-ncp-bus],[Specify the NCP bus (none|spi|uart) @<:@default=none@:>@.])],
|
||||
[
|
||||
case "${with_ncp_bus}" in
|
||||
"none")
|
||||
OPENTHREAD_ENABLE_NCP_SPI=0
|
||||
OPENTHREAD_ENABLE_NCP_UART=0
|
||||
;;
|
||||
|
||||
yes)
|
||||
enable_ncp=uart
|
||||
"spi")
|
||||
OPENTHREAD_ENABLE_NCP_SPI=1
|
||||
OPENTHREAD_ENABLE_NCP_UART=0
|
||||
;;
|
||||
"uart")
|
||||
OPENTHREAD_ENABLE_NCP_SPI=0
|
||||
OPENTHREAD_ENABLE_NCP_UART=1
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${with_ncp} for --enable-ncp])
|
||||
AC_MSG_ERROR([unexpected --with-ncp-bus=${with_ncp_bus}])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_ncp=no])
|
||||
AC_MSG_RESULT(${enable_ncp})
|
||||
AC_MSG_CHECKING([determine ncp bus])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP], [test "${enable_ncp}" != "no"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPI], [test "${enable_ncp}" = "spi"])
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_UART], [test "${enable_ncp}" = "uart"])
|
||||
[
|
||||
OPENTHREAD_ENABLE_NCP_SPI=0
|
||||
OPENTHREAD_ENABLE_NCP_UART=0
|
||||
])
|
||||
|
||||
AC_SUBST(OPENTHREAD_ENABLE_NCP_SPI)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPI], [test "${with_ncp_bus}" = "spi"])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_SPI],[${OPENTHREAD_ENABLE_NCP_SPI}],[Define to 1 to enable the NCP SPI interface.])
|
||||
AC_MSG_CHECKING([should NCP support SPI])
|
||||
AC_MSG_RESULT([${OPENTHREAD_ENABLE_SPI}])
|
||||
|
||||
AC_SUBST(OPENTHREAD_ENABLE_NCP_UART)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_UART], [test "${with_ncp_bus}" = "uart"])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_UART],[${OPENTHREAD_ENABLE_NCP_UART}],[Define to 1 to enable the NCP UART interface.])
|
||||
AC_MSG_CHECKING([sould NCP support UART])
|
||||
AC_MSG_RESULT([${OPENTHREAD_ENABLE_UART}])
|
||||
|
||||
#
|
||||
# Builtin mbedtls
|
||||
@@ -1172,9 +1252,13 @@ AC_MSG_NOTICE([
|
||||
Pretty args : ${PRETTY_ARGS:--}
|
||||
Pretty check : ${PRETTY_CHECK:--}
|
||||
Pretty check args : ${PRETTY_CHECK_ARGS:--}
|
||||
OpenThread Full Thread Device support : ${enable_ftd}
|
||||
OpenThread CLI support : ${enable_cli}
|
||||
OpenThread NCP support : ${enable_ncp}
|
||||
OpenThread CLI support : ${enable_cli_app}
|
||||
OpenThread CLI-MTD support : ${enable_cli_app_mtd}
|
||||
OpenThread CLI-FTD support : ${enable_cli_app_ftd}
|
||||
OpenThread NCP support : ${enable_ncp_app}
|
||||
OpenThread NCP-MTD support : ${enable_ncp_app_mtd}
|
||||
OpenThread NCP-FTD support : ${enable_ncp_app_ftd}
|
||||
OpenThread NCP-BUS Configuration : ${with_ncp_bus}
|
||||
OpenThread builtin mbedtls support : ${enable_builtin_mbedtls}
|
||||
OpenThread Commissioner support : ${enable_commissioner}
|
||||
OpenThread Joiner support : ${enable_joiner}
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
MBEDTLS_CONFIG_FILE="mbedtls-config.h";
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
</PreprocessorDefinitions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OTDLL;
|
||||
OTBUILD;
|
||||
OPENTHREAD_FTD=1;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
%(AdditionalIncludeDirectories);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
MBEDTLS_CONFIG_FILE="mbedtls-config.h";
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
MBEDTLS_CONFIG_FILE="mbedtls-config.h";
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_ENABLE_NCP_SPI=1;
|
||||
OPENTHREAD_ENABLE_NCP_UART=0;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
MBEDTLS_CONFIG_FILE="mbedtls-config.h";
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_ENABLE_NCP_SPI=0;
|
||||
OPENTHREAD_ENABLE_NCP_UART=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
@@ -73,4 +76,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -41,6 +41,7 @@
|
||||
%(PreprocessorDefinitions);
|
||||
_CRT_SECURE_NO_WARNINGS;
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_FTD=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
MBEDTLS_CONFIG_FILE="mbedtls-config.h";
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
OPENTHREAD_PROJECT_CORE_CONFIG_FILE="openthread-core-windows-config.h";
|
||||
WINDOWS_LOGGING;
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_FTD=1;
|
||||
OTBUILD;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_ENABLE_NCP_SPI=1;
|
||||
OPENTHREAD_ENABLE_NCP_UART=0;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
%(AdditionalIncludeDirectories);
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
OPENTHREAD_ENABLE_NCP_SPI=0;
|
||||
OOPENTHREAD_ENABLE_NCP_UART=1;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
%(AdditionalIncludeDirectories);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_FTD=1;
|
||||
OTAPI_EXPORTS;
|
||||
</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_FTD=1;
|
||||
OTDLL;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
%(PreProcessorDefinitions);
|
||||
NDIS_WDM=1;
|
||||
NDIS630=1;
|
||||
OPENTHREAD_FTD=1;
|
||||
OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";
|
||||
OPENTHREAD_PROJECT_CORE_CONFIG_FILE="openthread-core-windows-config.h";
|
||||
OPENTHREAD_MULTIPLE_INSTANCE;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
OPENTHREAD_FTD=1;
|
||||
OTAPI_EXPORTS;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<PreprocessorDefinitions>
|
||||
%(PreprocessorDefinitions);
|
||||
HAVE_STRNLEN=1;
|
||||
OPENTHREAD_FTD=1;
|
||||
SPINEL_PLATFORM_DOESNT_IMPLEMENT_ERRNO_VAR=1;
|
||||
</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
|
||||
@@ -42,9 +42,9 @@ OBJCOPY = arm-none-eabi-objcopy
|
||||
BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-ftd \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=all \
|
||||
--enable-ncp-app=all \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-diag \
|
||||
--enable-default-logging \
|
||||
--with-examples=cc2538 \
|
||||
|
||||
@@ -42,8 +42,9 @@ OBJCOPY = arm-none-eabi-objcopy
|
||||
BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=mtd \
|
||||
--enable-ncp-app=mtd \
|
||||
--with-ncp-bus=uart \
|
||||
--with-examples=cc2650 \
|
||||
--with-platform-info=cc2650 \
|
||||
MBEDTLS_CPPFLAGS="$(CC2650_MBEDTLS_CPPFLAGS)" \
|
||||
|
||||
@@ -42,9 +42,9 @@ OBJCOPY = arm-none-eabi-objcopy
|
||||
BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-ftd \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=all \
|
||||
--enable-ncp-app=all \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-default-logging \
|
||||
--with-examples=da15000 \
|
||||
--with-platform-info=DA15000 \
|
||||
|
||||
@@ -42,9 +42,9 @@ OBJCOPY = arm-none-eabi-objcopy
|
||||
BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-ftd \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=all \
|
||||
--enable-ncp-app=all \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-diag \
|
||||
--with-examples=nrf52840 \
|
||||
--with-platform-info=NRF52840 \
|
||||
|
||||
@@ -82,9 +82,9 @@ TargetTuple = $(shell ${AbsTopSourceDir}/third_party/nlbuild
|
||||
# accordingly.
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-ftd \
|
||||
--enable-cli \
|
||||
--enable-ncp \
|
||||
--enable-cli-app=all \
|
||||
--enable-ncp-app=all \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-diag \
|
||||
--enable-default-logging \
|
||||
--enable-raw-link-api=no \
|
||||
|
||||
@@ -112,17 +112,19 @@ LDFLAGS_COMMON += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
|
||||
if OPENTHREAD_ENABLE_CLI_FTD
|
||||
bin_PROGRAMS += \
|
||||
ot-cli-ftd \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ot_cli_ftd_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
ot_cli_ftd_LDADD = \
|
||||
$(top_builddir)/src/cli/libopenthread-cli.a \
|
||||
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||
$(LDADD_COMMON) \
|
||||
$(NULL)
|
||||
@@ -134,18 +136,19 @@ ot_cli_ftd_LDFLAGS = \
|
||||
ot_cli_ftd_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
|
||||
if OPENTHREAD_ENABLE_CLI_MTD
|
||||
bin_PROGRAMS += \
|
||||
ot-cli-mtd \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ot_cli_mtd_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
ot_cli_mtd_LDADD = \
|
||||
$(top_builddir)/src/cli/libopenthread-cli.a \
|
||||
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||
$(LDADD_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
@@ -112,17 +112,20 @@ LDFLAGS_COMMON += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
|
||||
|
||||
if OPENTHREAD_ENABLE_NCP_FTD
|
||||
bin_PROGRAMS += \
|
||||
ot-ncp-ftd \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ot_ncp_ftd_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
ot_ncp_ftd_LDADD = \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp.a \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp-ftd.a \
|
||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||
$(LDADD_COMMON) \
|
||||
$(NULL)
|
||||
@@ -134,18 +137,19 @@ ot_ncp_ftd_LDFLAGS = \
|
||||
ot_ncp_ftd_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
|
||||
if OPENTHREAD_ENABLE_NCP_MTD
|
||||
bin_PROGRAMS += \
|
||||
ot-ncp-mtd \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ot_ncp_mtd_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
ot_ncp_mtd_LDADD = \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp.a \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp-mtd.a \
|
||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||
$(LDADD_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Define to 1 to enable the NCP UART interface. */
|
||||
// On the command line: #define OPENTHREAD_ENABLE_NCP_UART 0
|
||||
|
||||
/* Define to 1 to enable the NCP SPI interface. */
|
||||
// On the command line: #define OPENTHREAD_ENABLE_NCP_SPI 1
|
||||
|
||||
/* Define to 1 if you want to enable default logging */
|
||||
#define OPENTHREAD_ENABLE_DEFAULT_LOGGING 1
|
||||
|
||||
|
||||
+107
-11
@@ -28,9 +28,92 @@
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
lib_LIBRARIES = libopenthread-cli.a
|
||||
#----------------------------------------
|
||||
#
|
||||
# This library on the face of it, appears to be identical
|
||||
# for both the MTD and FTD varients, however ...
|
||||
#
|
||||
# The source code here includes numerous OpenThread internal headers.
|
||||
# Due to the "domino-effect" other internal headers are included.
|
||||
#
|
||||
# For example:
|
||||
# cli.cpp includes:
|
||||
# src/core/openthread-instance.h
|
||||
# Which Includes:
|
||||
# src/core/therad/thread_netif.hpp
|
||||
# Which Includes:
|
||||
# src/core/meshcop/dataset_manager.hpp
|
||||
# Which Includes:
|
||||
# src/core/threadnetwork_data_leader.hpp
|
||||
#
|
||||
# That header (and others) is either an MTD or FTD class flavor.
|
||||
#
|
||||
# The FTD flavor has many private components (class variables).
|
||||
# The MTD flavor has no private components.
|
||||
#
|
||||
# Bottom line: The Class(structs) are thus different in the downstream
|
||||
# libs. At this level (in the CLI, and likewise in the NCP) they are
|
||||
# functionally identical.
|
||||
#
|
||||
# ORIGINALLY (historical note about how things are/where built):
|
||||
#
|
||||
# The difference between MTD and FTD was a define.. -DOPENTHREAD_MTD
|
||||
# There was no "FTD" define, it is/was assumed that FTD is the default.
|
||||
#
|
||||
# Historically this library -DOPENTHREAD_MTD was not defined/set.
|
||||
# (it is set via a commandline define in 'lib-openthread')
|
||||
#
|
||||
# Thus, the existing(previous) way *THIS* library was compiled is
|
||||
# exactly the FTD path. Meaning the "cli" library always sees
|
||||
# the FTD varients of various headers/classes.
|
||||
#
|
||||
# The same is true of the "ncp" library.
|
||||
#
|
||||
# HOWEVER there are two varients of the CLI application, CLI-MTD
|
||||
# and CLI-FTD (and likewise, two varients of the ncp application)
|
||||
# These applications link against two different OpenThread libraries.
|
||||
#
|
||||
# Which flavor, you get depends upon which library: "mtd" or "ftd" is linked.
|
||||
#
|
||||
# Which on the surface appear to link fine against the MTD/FTD library.
|
||||
#
|
||||
# In this description/example we focus on the "nework_data_leader"
|
||||
# header file. The FTD varient has many private variables, functions
|
||||
# and other things of "FTD" (ie: full) implementation items.
|
||||
#
|
||||
# In contrast the MTD is generaly stubbed out with stub-functions
|
||||
# inlined in the header that return "error not implemented" or similar.
|
||||
#
|
||||
# Thus it works... here ... With this file and this example.
|
||||
#
|
||||
# The unknown:
|
||||
# What about the other files?
|
||||
# What about the other c++ classes?
|
||||
# Is this true always? Is this robust?
|
||||
# Or is there a hidden "got-ya" that will snag the next person?
|
||||
#
|
||||
# This also fails static analisys, checks.
|
||||
# Application - with MTD vrs FTD class.
|
||||
# Library #1 (cli-lib) with FTD selected.
|
||||
# Library #2 (openthread) with two different class flavors.
|
||||
#
|
||||
# The static analisys tools will say: "NOPE" different classes!
|
||||
# Perhaps this will change if/when nothing is implemented in the 'mtd-header'
|
||||
#
|
||||
# Additionally, tools that perform "whole program optimization" will
|
||||
# throw errors becuase the data structures differ greatly.
|
||||
#
|
||||
# Hence, CLI library (and NCP) must exist in two flavors.
|
||||
#
|
||||
# Unless and until these libraries do not "accidently" suck in
|
||||
# a "flavored" header file somewhere.
|
||||
|
||||
libopenthread_cli_a_CPPFLAGS = \
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-cli-mtd.a \
|
||||
libopenthread-cli-ftd.a \
|
||||
$(NULL)
|
||||
|
||||
CPPFLAGS_COMMON = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/core \
|
||||
@@ -38,17 +121,33 @@ libopenthread_cli_a_CPPFLAGS = \
|
||||
$(MISSING_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cli_a_SOURCES = \
|
||||
|
||||
libopenthread_cli_mtd_a_CPPFLAGS = \
|
||||
-DOPENTHREAD_MTD=1 \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cli_ftd_a_CPPFLAGS = \
|
||||
-DOPENTHREAD_FTD=1 \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
SOURCES_COMMON = \
|
||||
cli.cpp \
|
||||
cli_console.cpp \
|
||||
cli_dataset.cpp \
|
||||
cli_uart.cpp \
|
||||
cli_coap.cpp \
|
||||
cli_udp.cpp \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
libopenthread_cli_a_SOURCES += cli_coap.cpp
|
||||
endif
|
||||
|
||||
libopenthread_cli_ftd_a_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cli_mtd_a_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(NULL)
|
||||
|
||||
noinst_HEADERS = \
|
||||
cli.hpp \
|
||||
@@ -56,12 +155,9 @@ noinst_HEADERS = \
|
||||
cli_dataset.hpp \
|
||||
cli_uart.hpp \
|
||||
cli_server.hpp \
|
||||
cli_coap.hpp \
|
||||
cli_udp.hpp \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
noinst_HEADERS += cli_coap.hpp
|
||||
endif
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ const struct Command Interpreter::sCommands[] =
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
{ "coap", &Interpreter::ProcessCoap },
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ "commissioner", &Interpreter::ProcessCommissioner },
|
||||
#endif
|
||||
{ "contextreusedelay", &Interpreter::ProcessContextIdReuseDelay },
|
||||
@@ -2420,7 +2420,7 @@ void Interpreter::ProcessVersion(int argc, char *argv[])
|
||||
(void)argv;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessCommissioner(int argc, char *argv[])
|
||||
{
|
||||
@@ -2704,7 +2704,7 @@ void Interpreter::HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask)
|
||||
sServer->OutputFormat("Conflict: %04x, %08x\r\n", aPanId, aChannelMask);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
|
||||
+2
-2
@@ -169,9 +169,9 @@ private:
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
void ProcessCoap(int argc, char *argv[]);
|
||||
#endif //OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
void ProcessCommissioner(int argc, char *argv[]);
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
void ProcessContextIdReuseDelay(int argc, char *argv[]);
|
||||
void ProcessCounters(int argc, char *argv[]);
|
||||
void ProcessDataset(int argc, char *argv[]);
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <cli/cli.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
#include <cli/cli_coap.hpp>
|
||||
#include <coap/coap_header.hpp>
|
||||
|
||||
@@ -390,3 +393,5 @@ void Coap::HandleClientResponse(otCoapHeader *aHeader, otMessage *aMessage, otMe
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
+85
-104
@@ -29,6 +29,8 @@
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-ftd.a \
|
||||
libopenthread-mtd.a \
|
||||
$(NULL)
|
||||
|
||||
CPPFLAGS_COMMON = \
|
||||
@@ -39,13 +41,70 @@ CPPFLAGS_COMMON = \
|
||||
$(OPENTHREAD_TARGET_DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
libopenthread_ftd_a_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
-DOPENTHREAD_FTD=1 \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_mtd_a_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
-DOPENTHREAD_MTD=1 \
|
||||
$(NULL)
|
||||
|
||||
#----------------------------------------
|
||||
# Note to maintainer/developers about "SOURCES_COMMON"
|
||||
#
|
||||
# The traditional method for GNU style Makefile.am files
|
||||
# is to have IF statements within the Makefile
|
||||
#
|
||||
# These IF statements would add (or not add) certain
|
||||
# source files from the build/library being built.
|
||||
#
|
||||
# In general, IDEs do not easily support this.
|
||||
# Some do, some do not, those that do support it
|
||||
# often do so in a very different or complex way.
|
||||
# Bottom line: It is a very mixed bag of results.
|
||||
#
|
||||
# Thus we bend to the IDEs, and impose these rules:
|
||||
#
|
||||
# Rule #1
|
||||
# All code(files) should be compiled
|
||||
# Even if it is not used or required
|
||||
#
|
||||
# For example: In the MTD build, some features
|
||||
# are disabled and thus in the traditional scheme
|
||||
# source files could be excluded SOURCES_COMMON
|
||||
# via makefile IF/ELSE/ENDIF constructs.
|
||||
#
|
||||
# This makes it impossibly hard for IDEs.
|
||||
# Thus we compile everything.
|
||||
#
|
||||
# And then rely upon Rule #2.
|
||||
#
|
||||
# Rule #2
|
||||
# Files that are not required, in certain
|
||||
# configurations require appropriate wrappers
|
||||
# Such as #if/#else/#endif
|
||||
#
|
||||
# The net result is sort of an "empty translation unit"
|
||||
#
|
||||
|
||||
SOURCES_COMMON = \
|
||||
api/coap_api.cpp \
|
||||
api/commissioner_api.cpp \
|
||||
api/crypto_api.cpp \
|
||||
api/dataset_api.cpp \
|
||||
api/dhcp6_api.cpp \
|
||||
api/dhcp6_api.cpp \
|
||||
api/dns_api.cpp \
|
||||
api/icmp6_api.cpp \
|
||||
api/instance_api.cpp \
|
||||
api/ip6_api.cpp \
|
||||
api/jam_detection_api.cpp \
|
||||
api/joiner_api.cpp \
|
||||
api/link_api.cpp \
|
||||
api/link_raw_api.cpp \
|
||||
api/message_api.cpp \
|
||||
api/netdata_api.cpp \
|
||||
api/tasklet_api.cpp \
|
||||
@@ -55,6 +114,8 @@ SOURCES_COMMON = \
|
||||
coap/coap_client.cpp \
|
||||
coap/coap_header.cpp \
|
||||
coap/coap_server.cpp \
|
||||
coap/secure_coap_client.cpp \
|
||||
coap/secure_coap_server.cpp \
|
||||
common/crc16.cpp \
|
||||
common/logging.cpp \
|
||||
common/message.cpp \
|
||||
@@ -66,12 +127,27 @@ SOURCES_COMMON = \
|
||||
crypto/aes_ecb.cpp \
|
||||
crypto/hmac_sha256.cpp \
|
||||
crypto/mbedtls.cpp \
|
||||
crypto/pbkdf2_cmac.cpp \
|
||||
crypto/sha256.cpp \
|
||||
mac/mac.cpp \
|
||||
mac/mac_blacklist.cpp \
|
||||
mac/mac_frame.cpp \
|
||||
mac/mac_whitelist.cpp \
|
||||
meshcop/announce_begin_client.cpp \
|
||||
meshcop/commissioner.cpp \
|
||||
meshcop/dataset.cpp \
|
||||
meshcop/dataset_manager.cpp \
|
||||
meshcop/dataset_manager_ftd.cpp \
|
||||
meshcop/dtls.cpp \
|
||||
meshcop/energy_scan_client.cpp \
|
||||
meshcop/joiner.cpp \
|
||||
meshcop/joiner_router.cpp \
|
||||
meshcop/leader.cpp \
|
||||
meshcop/panid_query_client.cpp \
|
||||
meshcop/timestamp.cpp \
|
||||
net/dhcp6_client.cpp \
|
||||
net/dhcp6_server.cpp \
|
||||
net/dns_client.cpp \
|
||||
net/icmp6.cpp \
|
||||
net/ip6.cpp \
|
||||
net/ip6_address.cpp \
|
||||
@@ -80,6 +156,7 @@ SOURCES_COMMON = \
|
||||
net/ip6_routes.cpp \
|
||||
net/netif.cpp \
|
||||
net/udp6.cpp \
|
||||
thread/address_resolver.cpp \
|
||||
thread/announce_begin_server.cpp \
|
||||
thread/data_poll_manager.cpp \
|
||||
thread/energy_scan_server.cpp \
|
||||
@@ -88,24 +165,19 @@ SOURCES_COMMON = \
|
||||
thread/lowpan.cpp \
|
||||
thread/mesh_forwarder.cpp \
|
||||
thread/mle.cpp \
|
||||
thread/mle_router.cpp \
|
||||
thread/network_data.cpp \
|
||||
thread/network_data_leader.cpp \
|
||||
thread/panid_query_server.cpp \
|
||||
thread/network_data_leader_ftd.cpp \
|
||||
thread/network_data_local.cpp \
|
||||
thread/network_diagnostic.cpp \
|
||||
thread/panid_query_server.cpp \
|
||||
thread/src_match_controller.cpp \
|
||||
thread/thread_netif.cpp \
|
||||
utils/jam_detector.cpp \
|
||||
utils/slaac_address.cpp \
|
||||
$(NULL)
|
||||
|
||||
SOURCES_FTD = \
|
||||
meshcop/dataset_manager_ftd.cpp \
|
||||
meshcop/joiner_router.cpp \
|
||||
meshcop/leader.cpp \
|
||||
thread/address_resolver.cpp \
|
||||
thread/mle_router.cpp \
|
||||
thread/network_data_leader_ftd.cpp \
|
||||
thread/network_data_local.cpp \
|
||||
$(NULL)
|
||||
|
||||
SOURCES_MISSING = \
|
||||
$(NULL)
|
||||
@@ -144,105 +216,14 @@ CPPFLAGS_COMMON += -I$(top_srcdir)/src/missing/strlcat
|
||||
SOURCES_MISSING += strlcat.c
|
||||
endif
|
||||
|
||||
if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
SOURCES_COMMON += \
|
||||
api/coap_api.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
if OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
SOURCES_COMMON += \
|
||||
mac/mac_blacklist.cpp \
|
||||
mac/mac_whitelist.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
|
||||
if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
SOURCES_COMMON += \
|
||||
api/commissioner_api.cpp \
|
||||
coap/secure_coap_server.cpp \
|
||||
crypto/pbkdf2_cmac.cpp \
|
||||
meshcop/announce_begin_client.cpp \
|
||||
meshcop/commissioner.cpp \
|
||||
meshcop/energy_scan_client.cpp \
|
||||
meshcop/panid_query_client.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
if OPENTHREAD_ENABLE_JOINER
|
||||
SOURCES_COMMON += \
|
||||
api/joiner_api.cpp \
|
||||
coap/secure_coap_client.cpp \
|
||||
meshcop/joiner.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
if OPENTHREAD_ENABLE_DTLS
|
||||
SOURCES_COMMON += \
|
||||
meshcop/dtls.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_DTLS
|
||||
|
||||
if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
SOURCES_COMMON += \
|
||||
api/dhcp6_api.cpp \
|
||||
net/dhcp6_client.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
|
||||
if OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
SOURCES_COMMON += \
|
||||
api/dhcp6_api.cpp \
|
||||
net/dhcp6_server.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
if OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
SOURCES_COMMON += \
|
||||
api/dns_api.cpp \
|
||||
net/dns_client.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
|
||||
if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
SOURCES_COMMON += \
|
||||
api/jam_detection_api.cpp \
|
||||
utils/jam_detector.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
SOURCES_COMMON += \
|
||||
api/link_raw_api.cpp \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
lib_LIBRARIES += \
|
||||
libopenthread-ftd.a \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ftd_a_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
libopenthread_mtd_a_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(SOURCES_MISSING) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ftd_a_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(SOURCES_FTD) \
|
||||
$(SOURCES_MISSING) \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
|
||||
lib_LIBRARIES += \
|
||||
libopenthread-mtd.a \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_mtd_a_CPPFLAGS = \
|
||||
$(CPPFLAGS_COMMON) \
|
||||
-DOPENTHREAD_MTD \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_mtd_a_SOURCES = \
|
||||
$(SOURCES_COMMON) \
|
||||
$(SOURCES_MISSING) \
|
||||
$(NULL)
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "openthread-instance.h"
|
||||
#include "coap/coap_header.hpp"
|
||||
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
void otCoapHeaderInit(otCoapHeader *aHeader, otCoapType aType, otCoapCode aCode)
|
||||
@@ -172,3 +174,5 @@ ThreadError otCoapSendResponse(otInstance *aInstance, otMessage *aMessage, const
|
||||
return aInstance->mApplicationCoapServer.SendMessage(
|
||||
*static_cast<Message *>(aMessage), *static_cast<const Ip6::MessageInfo *>(aMessageInfo));
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
ThreadError otCommissionerStart(otInstance *aInstance)
|
||||
{
|
||||
@@ -117,4 +117,4 @@ ThreadError otCommissionerGeneratePSKc(otInstance *aInstance, const char *aPassP
|
||||
return aInstance->mThreadNetif.GetCommissioner().GeneratePSKc(aPassPhrase, aNetworkName, aExtPanId, aPSKc);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "openthread/platform/usec-alarm.h"
|
||||
#include "openthread-instance.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
|
||||
ThreadError otLinkRawSetEnable(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -604,3 +606,5 @@ void LinkRaw::HandleEnergyScanTask(void)
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ENERGY_SCAN
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <meshcop/dtls.hpp>
|
||||
#include <thread/thread_netif.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the secure CoAP client.
|
||||
@@ -243,3 +245,5 @@ exit:
|
||||
|
||||
} // namespace Coap
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <meshcop/dtls.hpp>
|
||||
#include <thread/thread_netif.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the secure CoAP server.
|
||||
@@ -264,3 +266,5 @@ exit:
|
||||
|
||||
} // namespace Coap
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
@@ -31,10 +31,18 @@
|
||||
* This file implements PBKDF2 using AES-CMAC-PRF-128
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <crypto/pbkdf2_cmac.h>
|
||||
#include <mbedtls/cmac.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
void otPbkdf2Cmac(
|
||||
const uint8_t *aPassword, uint16_t aPasswordLen,
|
||||
const uint8_t *aSalt, uint16_t aSaltLen,
|
||||
@@ -84,3 +92,5 @@ void otPbkdf2Cmac(
|
||||
keyLen -= useLen;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <common/code_utils.hpp>
|
||||
#include <mac/mac_blacklist.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
|
||||
namespace Thread {
|
||||
namespace Mac {
|
||||
|
||||
@@ -126,3 +128,5 @@ exit:
|
||||
|
||||
} // namespace Mac
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <common/code_utils.hpp>
|
||||
#include <mac/mac_whitelist.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
|
||||
namespace Thread {
|
||||
namespace Mac {
|
||||
|
||||
@@ -151,3 +153,5 @@ void Whitelist::SetFixedRssi(Entry &aEntry, int8_t aRssi)
|
||||
|
||||
} // namespace Mac
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_MAC_WHITELIST
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
#include <thread/thread_netif.hpp>
|
||||
#include <thread/thread_uris.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
namespace Thread {
|
||||
|
||||
AnnounceBeginClient::AnnounceBeginClient(ThreadNetif &aThreadNetif) :
|
||||
@@ -120,3 +122,6 @@ exit:
|
||||
}
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
#include <thread/thread_uris.hpp>
|
||||
#include <openthread/types.h>
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
using Thread::Encoding::BigEndian::HostSwap64;
|
||||
|
||||
namespace Thread {
|
||||
@@ -1084,3 +1086,5 @@ exit:
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
@@ -585,7 +585,7 @@ ThreadError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset,
|
||||
VerifyOrExit((message = NewMeshCoPMessage(mNetif.GetCoapClient(), header)) != NULL,
|
||||
error = kThreadError_NoBufs);
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
bool isCommissioner;
|
||||
|
||||
isCommissioner = mNetif.GetCommissioner().GetState() != kCommissionerStateDisabled ? true : false;
|
||||
@@ -618,7 +618,7 @@ ThreadError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
if (aDataset.mIsActiveTimestampSet)
|
||||
{
|
||||
|
||||
@@ -183,10 +183,12 @@ private:
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "dataset_manager_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "dataset_manager_ftd.hpp"
|
||||
#else
|
||||
#error Must define OPENTHREAD_MTD or OPENTHREAD_FTD
|
||||
#endif
|
||||
|
||||
#endif // MESHCOP_DATASET_MANAGER_HPP_
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
|
||||
#define WPP_NAME "dataset_manager.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
@@ -54,6 +60,8 @@
|
||||
#include <thread/thread_uris.hpp>
|
||||
#include <meshcop/leader.hpp>
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
namespace Thread {
|
||||
namespace MeshCoP {
|
||||
|
||||
@@ -246,3 +254,5 @@ exit:
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
* This file implements the necessary hooks for mbedTLS.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#define WPP_NAME "dtls.tmh"
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
@@ -44,6 +50,8 @@
|
||||
|
||||
#include <mbedtls/debug.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DTLS
|
||||
|
||||
namespace Thread {
|
||||
namespace MeshCoP {
|
||||
|
||||
@@ -510,3 +518,5 @@ void Dtls::HandleMbedtlsDebug(void *ctx, int level, const char *, int, const cha
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DTLS
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
* This file implements the Energy Scan Client.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#define WPP_NAME "energy_scan_client.tmh"
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
@@ -46,6 +52,8 @@
|
||||
#include <thread/thread_netif.hpp>
|
||||
#include <thread/thread_uris.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
using Thread::Encoding::BigEndian::HostSwap16;
|
||||
using Thread::Encoding::BigEndian::HostSwap32;
|
||||
|
||||
@@ -174,3 +182,6 @@ exit:
|
||||
}
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
#include <thread/thread_netif.hpp>
|
||||
#include <thread/thread_uris.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
using Thread::Encoding::BigEndian::HostSwap16;
|
||||
using Thread::Encoding::BigEndian::HostSwap64;
|
||||
|
||||
@@ -519,3 +521,5 @@ void Joiner::HandleTimer(void)
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
@@ -533,3 +535,6 @@ exit:
|
||||
|
||||
} // namespace Dtls
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "joiner_router_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "joiner_router_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1, or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
|
||||
#define WPP_NAME "leader.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
@@ -309,3 +317,6 @@ void Leader::ResignCommissioner(void)
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "leader_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "leader_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
* This file implements the PAN ID Query Client.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#define WPP_NAME "panid_query_client.tmh"
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
@@ -45,6 +52,8 @@
|
||||
#include <thread/thread_netif.hpp>
|
||||
#include <thread/thread_uris.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
namespace Thread {
|
||||
|
||||
PanIdQueryClient::PanIdQueryClient(ThreadNetif &aThreadNetif) :
|
||||
@@ -153,3 +162,6 @@ exit:
|
||||
}
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
#define WPP_NAME "dhcp6_server.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include "openthread/types.h"
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
@@ -42,6 +48,8 @@
|
||||
#include <thread/mle.hpp>
|
||||
#include <thread/thread_netif.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
using Thread::Encoding::BigEndian::HostSwap16;
|
||||
using Thread::Encoding::BigEndian::HostSwap32;
|
||||
|
||||
@@ -569,3 +577,5 @@ ThreadError Dhcp6Server::AppendRapidCommit(Message &aMessage)
|
||||
|
||||
} // namespace Dhcp6
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <common/debug.hpp>
|
||||
@@ -33,6 +39,8 @@
|
||||
#include <net/dns_client.hpp>
|
||||
#include <net/udp6.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the DNS client.
|
||||
@@ -515,3 +523,5 @@ exit:
|
||||
|
||||
} // namespace Coap
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
#define WPP_NAME "icmp6.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
|
||||
@@ -31,8 +31,16 @@
|
||||
* This file implements Thread's EID-to-RLOC mapping and caching.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "address_resolver.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
|
||||
#include <coap/coap_header.hpp>
|
||||
@@ -684,3 +692,5 @@ exit:
|
||||
}
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
@@ -26,8 +26,12 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "address_resolver_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "address_resolver_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
* This file implements Thread security material generation.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
#include <common/timer.hpp>
|
||||
#include <crypto/hmac_sha256.hpp>
|
||||
|
||||
@@ -30,8 +30,16 @@
|
||||
* This file implements MLE functionality required for the Thread Router and Leader roles.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "mle_router.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
#include "openthread/platform/settings.h"
|
||||
|
||||
@@ -4502,3 +4510,6 @@ uint8_t MleRouter::GetMinDowngradeNeighborRouters(void)
|
||||
|
||||
} // namespace Mle
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "mle_router_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "mle_router_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
#define WPP_NAME "network_data_leader.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
|
||||
#include <coap/coap_header.hpp>
|
||||
|
||||
@@ -232,10 +232,12 @@ private:
|
||||
} // namespace NetworkData
|
||||
} // namespace Thread
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "network_data_leader_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "network_data_leader_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
#endif // NETWORK_DATA_LEADER_HPP_
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
* This file implements the Thread Network Data managed by the Thread Leader.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#define WPP_NAME "network_data_leader_ftd.tmh"
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
@@ -1072,3 +1080,6 @@ void Leader::HandleTimer(void)
|
||||
|
||||
} // namespace NetworkData
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
* This file implements the local Thread Network Data.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <common/debug.hpp>
|
||||
#include <common/logging.hpp>
|
||||
#include <common/code_utils.hpp>
|
||||
@@ -38,6 +44,8 @@
|
||||
#include <thread/network_data_local.hpp>
|
||||
#include <thread/thread_netif.hpp>
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
namespace Thread {
|
||||
namespace NetworkData {
|
||||
|
||||
@@ -245,3 +253,4 @@ exit:
|
||||
} // namespace NetworkData
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_MTD
|
||||
#if OPENTHREAD_MTD
|
||||
#include "network_data_local_mtd.hpp"
|
||||
#else
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "network_data_local_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -78,10 +78,10 @@ ThreadNetif::ThreadNetif(Ip6::Ip6 &aIp6):
|
||||
mNetworkDataLocal(*this),
|
||||
mNetworkDataLeader(*this),
|
||||
mNetworkDiagnostic(*this),
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
mSecureCoapServer(*this, OPENTHREAD_CONFIG_JOINER_UDP_PORT),
|
||||
mCommissioner(*this),
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
#if OPENTHREAD_ENABLE_DTLS
|
||||
mDtls(*this),
|
||||
#endif
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
#include <utils/jam_detector.hpp>
|
||||
#endif // OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
#include <meshcop/commissioner.hpp>
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_DTLS
|
||||
#include <meshcop/dtls.hpp>
|
||||
@@ -293,11 +293,11 @@ public:
|
||||
|
||||
AnnounceBeginServer &GetAnnounceBeginServer(void) { return mAnnounceBegin; }
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
MeshCoP::Commissioner &GetCommissioner(void) { return mCommissioner; }
|
||||
|
||||
Coap::SecureServer &GetSecureCoapServer(void) { return mSecureCoapServer; }
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_DTLS
|
||||
MeshCoP::Dtls &GetDtls(void) { return mDtls; }
|
||||
@@ -353,7 +353,7 @@ private:
|
||||
NetworkDiagnostic::NetworkDiagnostic mNetworkDiagnostic;
|
||||
bool mIsUp;
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
Coap::SecureServer mSecureCoapServer;
|
||||
MeshCoP::Commissioner mCommissioner;
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include <common/code_utils.hpp>
|
||||
#include <utils/jam_detector.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
namespace Thread {
|
||||
namespace Utils {
|
||||
|
||||
@@ -241,3 +243,5 @@ void JamDetector::UpdateJamState(void)
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
+36
-21
@@ -34,50 +34,65 @@ EXTRA_DIST = \
|
||||
|
||||
# Pull in the sources that comprise the OpenThread NCP library.
|
||||
|
||||
lib_LIBRARIES = libopenthread-ncp.a
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-ncp-mtd.a \
|
||||
libopenthread-ncp-ftd.a \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ncp_a_CPPFLAGS = \
|
||||
|
||||
COMMON_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party \
|
||||
-D_GNU_SOURCE \
|
||||
$(OPENTHREAD_TARGET_DEFINES) \
|
||||
$(MISSING_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
COMMON_CXXFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party \
|
||||
-D_GNU_SOURCE \
|
||||
$(OPENTHREAD_TARGET_DEFINES) \
|
||||
$(MISSING_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ncp_a_CXXFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party \
|
||||
$(OPENTHREAD_TARGET_DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ncp_a_SOURCES = \
|
||||
libopenthread_ncp_mtd_a_CPPFLAGS = \
|
||||
-DOPENTHREAD_MTD=1 \
|
||||
$(COMMON_CXXFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ncp_ftd_a_CPPFLAGS = \
|
||||
-DOPENTHREAD_FTD=1 \
|
||||
$(COMMON_CXXFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
COMMON_SOURCES = \
|
||||
ncp_base.cpp \
|
||||
ncp_base.hpp \
|
||||
ncp_buffer.cpp \
|
||||
ncp_buffer.hpp \
|
||||
spinel.c \
|
||||
spinel.h \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_NCP_SPI
|
||||
libopenthread_ncp_a_SOURCES += \
|
||||
ncp_spi.cpp \
|
||||
ncp_spi.hpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
if OPENTHREAD_ENABLE_NCP_UART
|
||||
libopenthread_ncp_a_SOURCES += \
|
||||
hdlc.cpp \
|
||||
hdlc.hpp \
|
||||
ncp_uart.cpp \
|
||||
ncp_uart.hpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
libopenthread_ncp_mtd_a_SOURCES = \
|
||||
$(COMMON_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_ncp_ftd_a_SOURCES = \
|
||||
$(COMMON_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
include_HEADERS = \
|
||||
$(NULL)
|
||||
|
||||
@@ -30,10 +30,18 @@
|
||||
* This file implements an HDLC-lite encoder and decoder.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <common/code_utils.hpp>
|
||||
#include <ncp/hdlc.hpp>
|
||||
|
||||
#if OPENTHREAD_ENABLE_NCP_UART
|
||||
|
||||
namespace Thread {
|
||||
namespace Hdlc {
|
||||
|
||||
@@ -330,3 +338,5 @@ void Decoder::Decode(const uint8_t *aInBuf, uint16_t aInLength)
|
||||
|
||||
} // namespace Hdlc
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_NCP_UART
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "openthread/jam_detection.h"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
#include "meshcop/commissioner.hpp"
|
||||
#endif
|
||||
|
||||
@@ -156,7 +156,7 @@ const NcpBase::GetPropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE, &NcpBase::GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED, &NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED },
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_COMMISSIONER_ENABLED, &NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED },
|
||||
#endif
|
||||
|
||||
@@ -319,7 +319,7 @@ const NcpBase::SetPropertyHandlerEntry NcpBase::mSetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_NEST_LEGACY_ULA_PREFIX, &NcpBase::SetPropertyHandler_NEST_LEGACY_ULA_PREFIX },
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_COMMISSIONER_ENABLED, &NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED },
|
||||
#endif
|
||||
};
|
||||
@@ -335,7 +335,7 @@ const NcpBase::InsertPropertyHandlerEntry NcpBase::mInsertPropertyHandlerTable[]
|
||||
{ SPINEL_PROP_THREAD_ON_MESH_NETS, &NcpBase::InsertPropertyHandler_THREAD_ON_MESH_NETS },
|
||||
{ SPINEL_PROP_THREAD_ASSISTING_PORTS, &NcpBase::InsertPropertyHandler_THREAD_ASSISTING_PORTS },
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_JOINERS, &NcpBase::NcpBase::InsertPropertyHandler_THREAD_JOINERS },
|
||||
#endif
|
||||
|
||||
@@ -3381,7 +3381,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header
|
||||
);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
bool isEnabled = false;
|
||||
@@ -4836,7 +4836,7 @@ ThreadError NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_k
|
||||
return SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode));
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len)
|
||||
{
|
||||
@@ -4870,7 +4870,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t head
|
||||
|
||||
return SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode));
|
||||
}
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len)
|
||||
@@ -6118,7 +6118,7 @@ ThreadError NcpBase::InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
ThreadError NcpBase::InsertPropertyHandler_THREAD_JOINERS(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -6182,7 +6182,7 @@ ThreadError NcpBase::InsertPropertyHandler_THREAD_JOINERS(uint8_t header, spinel
|
||||
exit:
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MARK: Individual Property Removers
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
* This file implements NCP frame buffer class.
|
||||
*/
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <common/code_utils.hpp>
|
||||
#include <ncp/ncp_buffer.hpp>
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#define SPI_PATTERN_VALUE 0x02
|
||||
#define SPI_PATTERN_MASK 0x03
|
||||
|
||||
#if OPENTHREAD_ENABLE_NCP_SPI
|
||||
|
||||
namespace Thread {
|
||||
|
||||
static otDEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpSpi), uint64_t);
|
||||
@@ -348,3 +350,4 @@ void NcpSpi::HandleRxFrame(void)
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_NCP_SPI
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include <core/openthread-core-config.h>
|
||||
#include <openthread-instance.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_NCP_UART
|
||||
|
||||
namespace Thread {
|
||||
|
||||
static otDEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpUart), uint64_t);
|
||||
@@ -294,3 +296,5 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat
|
||||
#endif // OPENTHREAD_ENABLE_CLI_LOGGING
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_NCP_UART
|
||||
|
||||
@@ -50,6 +50,7 @@ if OPENTHREAD_BUILD_TESTS
|
||||
# makefile.
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DOPENTHREAD_FTD=1 \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/core \
|
||||
@@ -58,7 +59,7 @@ AM_CPPFLAGS = \
|
||||
if OPENTHREAD_ENABLE_NCP
|
||||
|
||||
COMMON_LDADD = \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp.a \
|
||||
$(top_builddir)/src/ncp/libopenthread-ncp-ftd.a \
|
||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
Reference in New Issue
Block a user