Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linux] add ThreadStackManager for Linux Device layer #1320Thread linux #1438

Merged
merged 9 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: "connectedhomeip/chip-build-openssl:0.2.14"
image: "connectedhomeip/chip-build-openssl:0.2.18"
volumes:
- "/tmp/log_output:/tmp/test_logs"

Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@
branch = master
ignore = dirty
commit = 5f0e36eeb236a507631e9c822e43f742b7b6738a
[submodule "third_party/ot-br-posix/repo"]
path = third_party/ot-br-posix/repo
url = https://github.com/openthread/ot-br-posix.git
branch = master
ignore = dirty
commit = 38e91052d1fb12a55c4e34073f9e399471650b4b
50 changes: 50 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,55 @@ if test "${nl_cv_build_tests}" = "yes"; then
fi
fi

#
# otbr-client
#

NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
[ot_br_posix],
[OT_BR_POSIX],
[ot_br_posix],
[-lot_br_client],
[
OT_BR_POSIX_CPPFLAGS="-I\${abs_top_srcdir}/third_party/ot-br-posix/repo/include/ -I\${abs_top_srcdir}/third_party/ot-br-posix/repo/src/"
OT_BR_POSIX_LDFLAGS="-L${ac_pwd}/third_party/ot-br-posix/"
OT_BR_POSIX_LIBS="-lot_br_client"
],
[
# Check for required nlfaultinjection headers.
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([dbus/client/thread_api_dbus.hpp],
[],
[
AC_MSG_ERROR(The OpenThread border router header "$ac_header" is required but cannot be found.)
])
AC_LANG_POP([C++])
]
)

AC_MSG_NOTICE("nl_with_ot_br_posix=${nl_with_ot_br_posix}")

if test "${nl_with_ot_br_posix}" = "internal" && test "${with_device_layer}" = "linux"; then
maybe_ot_br_posix_dirstem="ot-br-posix"
ot_br_posix_dirstem="third_party/${maybe_ot_br_posix_dirstem}/repo"

AC_MSG_NOTICE([attempting to create internal ${ot_br_posix_dirstem}])

${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${ot_br_posix_dirstem}

if test $? -ne 0; then
AC_MSG_ERROR([failed to create ${ot_br_posix_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
fi

PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4)
AC_SUBST([DBUS_CFLAGS])
AC_SUBST([DBUS_LIBS])
else
maybe_ot_br_posix_dirstem=
fi

AC_SUBST(OT_BR_POSIX_SUBDIRS, [${maybe_ot_br_posix_dirstem}])
AM_CONDITIONAL([CHIP_WITH_OT_BR_POSIX], [test "${nl_with_ot_br_posix}" != "no"])

#
# Nlunit-test
Expand Down Expand Up @@ -2147,6 +2196,7 @@ examples/Makefile
third_party/Makefile
third_party/lwip/Makefile
third_party/mbedtls/Makefile
third_party/ot-br-posix/Makefile
src/Makefile
src/include/Makefile
src/app/Makefile
Expand Down
1 change: 0 additions & 1 deletion repos.conf

This file was deleted.

45 changes: 45 additions & 0 deletions repos.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[submodule "nlassert"]
path = third_party/nlassert/repo
url = https://github.com/nestlabs/nlassert.git
branch = master
update = none
[submodule "nlfaultinjection"]
path = third_party/nlfaultinjection/repo
url = https://github.com/nestlabs/nlfaultinjection.git
branch = master
update = none
[submodule "nlio"]
path = third_party/nlio/repo
url = https://github.com/nestlabs/nlio.git
branch = master
update = none
[submodule "nlunit-test"]
path = third_party/nlunit-test/repo
url = https://github.com/nestlabs/nlunit-test.git
branch = master
update = none
[submodule "mbedtls"]
path = third_party/mbedtls/repo
url = https://github.com/ARMmbed/mbedtls.git
branch = mbedtls-2.18
update = none
[submodule "qrcode"]
path = examples/common/QRCode/repo
url = https://github.com/nayuki/QR-Code-generator.git
branch = master
update = none
[submodule "m5stack-tft"]
path = examples/common/m5stack-tft/repo
url = https://github.com/jeremyjh/ESP32_TFT_library.git
branch = master
update = none
[submodule "openthread"]
path = third_party/openthread/repo
url = https://github.com/openthread/openthread.git
branch = master
update = none
[submodule "ot-br-posix"]
path = third_party/ot-br-posix/repo
url = https://github.com/openthread/ot-br-posix.git
branch = master
update = none
1 change: 1 addition & 0 deletions scripts/setup/linux/install_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ apt-get install -fy \
libssl-dev \
unzip \
wget \
libdbus-1-dev \
libmbedtls-dev

if [[ ! -f 'ci-cache-persistent/openssl/open_ssl_1.1.1f_installed' ]]; then
Expand Down
2 changes: 2 additions & 0 deletions src/include/platform/PlatformManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class PlatformManagerImpl;
class ConnectivityManagerImpl;
class ConfigurationManagerImpl;
class TraitManager;
class ThreadStackManagerImpl;
class TimeSyncManager;
namespace Internal {
class FabricProvisioningServer;
Expand Down Expand Up @@ -97,6 +98,7 @@ class PlatformManager
friend class ConnectivityManagerImpl;
friend class ConfigurationManagerImpl;
friend class TraitManager;
friend class ThreadStackManagerImpl;
friend class TimeSyncManager;
friend class Internal::FabricProvisioningServer;
friend class Internal::ServiceProvisioningServer;
Expand Down
2 changes: 1 addition & 1 deletion src/include/platform/ThreadStackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ThreadStackManager
void LockThreadStack(void);
bool TryLockThreadStack(void);
void UnlockThreadStack(void);
bool HaveRouteToAddress(const IPAddress & destAddr);
bool HaveRouteToAddress(const Inet::IPAddress & destAddr);
CHIP_ERROR GetAndLogThreadStatsCounters(void);
CHIP_ERROR GetAndLogThreadTopologyMinimal(void);
CHIP_ERROR GetAndLogThreadTopologyFull(void);
Expand Down
70 changes: 70 additions & 0 deletions src/include/platform/internal/DeviceNetworkInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef DEVICE_NETWORK_INFO_H
#define DEVICE_NETWORK_INFO_H

#include <stddef.h>
#include <stdint.h>

namespace chip {
namespace DeviceLayer {
namespace Internal {

/**
* Constants for common network metadata entries
*/
constexpr size_t kMaxThreadNetworkNameLength = 16;
constexpr size_t kThreadExtendedPANIdLength = 8;
constexpr size_t kThreadMeshPrefixLength = 8;
constexpr size_t kThreadNetworkKeyLength = 16;
constexpr size_t kThreadPSKcLength = 16;
constexpr size_t kThreadChannel_NotSpecified = UINT8_MAX;
constexpr size_t kThreadPANId_NotSpecified = UINT16_MAX;

class DeviceNetworkInfo
{
public:
// ---- Thread-specific Fields ----
char ThreadNetworkName[kMaxThreadNetworkNameLength + 1];
/**< The Thread network name as a NULL-terminated string. */
uint8_t ThreadExtendedPANId[kThreadExtendedPANIdLength];
/**< The Thread extended PAN ID. */
uint8_t ThreadMeshPrefix[kThreadMeshPrefixLength];
/**< The Thread mesh prefix. */
uint8_t ThreadNetworkKey[kThreadNetworkKeyLength];
/**< The Thread master network key (NOT NULL-terminated). */
uint8_t ThreadPSKc[kThreadPSKcLength];
/**< The Thread pre-shared commissioner key (NOT NULL-terminated). */
uint16_t ThreadPANId; /**< The 16-bit Thread PAN ID, or kThreadPANId_NotSpecified */
uint8_t ThreadChannel; /**< The Thread channel (currently [11..26]), or kThreadChannel_NotSpecified */

struct
{
bool ThreadExtendedPANId : 1;
bool ThreadMeshPrefix : 1;
bool ThreadPSKc : 1;
} FieldPresent;
};

} // namespace Internal
} // namespace DeviceLayer
} // namespace chip

#endif // DEVICE_NETWORK_INFO_H
Loading