From 6392398acda78cb87f68e25e172449a3c8f626d9 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 10:16:00 -0700 Subject: [PATCH 1/7] Sync submodules before making a build --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3dec36ee2fae36..8d3f35ee2cf0ab 100644 --- a/Makefile +++ b/Makefile @@ -3,4 +3,5 @@ SUB_DIRS=src .PHONY: all clean test all test clean: + git submodule update --init $(foreach dir,$(SUB_DIRS), $(MAKE) $@ -C $(dir)) From 5b50df1834b0a66496d9787d9dd1c82528ff28f1 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 10:17:09 -0700 Subject: [PATCH 2/7] Import CodeUtils, Core, Config, Error and Logging --- src/lib/core/WeaveConfig.h | 2333 ++++++++++++++++++++++ src/lib/core/WeaveCore.h | 64 + src/lib/core/WeaveError.cpp | 240 +++ src/lib/core/WeaveError.h | 1750 ++++++++++++++++ src/lib/support/CodeUtils.h | 412 ++++ src/lib/support/logging/WeaveLogging.cpp | 252 +++ src/lib/support/logging/WeaveLogging.h | 461 +++++ 7 files changed, 5512 insertions(+) create mode 100644 src/lib/core/WeaveConfig.h create mode 100644 src/lib/core/WeaveCore.h create mode 100644 src/lib/core/WeaveError.cpp create mode 100644 src/lib/core/WeaveError.h create mode 100644 src/lib/support/CodeUtils.h create mode 100644 src/lib/support/logging/WeaveLogging.cpp create mode 100644 src/lib/support/logging/WeaveLogging.h diff --git a/src/lib/core/WeaveConfig.h b/src/lib/core/WeaveConfig.h new file mode 100644 index 00000000000000..be5eb5309970ca --- /dev/null +++ b/src/lib/core/WeaveConfig.h @@ -0,0 +1,2333 @@ +/* + * + * Copyright (c) 2019 Google LLC. + * Copyright (c) 2013-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. + */ + +/** + * @file + * This file defines default compile-time configuration constants + * for Nest Weave. + * + * Package integrators that wish to override these values should + * either use preprocessor definitions or create a project- + * specific WeaveProjectConfig.h header and then assert + * HAVE_WEAVEPROJECTCONFIG_H via the package configuration tool + * via --with-weave-project-includes=DIR where DIR is the + * directory that contains the header. + * + * NOTE WELL: On some platforms, this header is included by C-language programs. + * + */ + +#ifndef WEAVE_CONFIG_H_ +#define WEAVE_CONFIG_H_ + +#include + +/* COMING SOON: making the INET Layer optional entails making this inclusion optional. */ +#include + +#if INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 +#error "Weave SDK requires INET_TCP_IDLE_CHECK_INTERVAL > 0" +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 + +/* Include a project-specific configuration file, if defined. + * + * An application or module that incorporates Weave can define a project configuration + * file to override standard Weave configuration with application-specific values. + * The WeaveProjectConfig.h file is typically located outside the OpenWeave source tree, + * alongside the source code for the application. + */ +#ifdef WEAVE_PROJECT_CONFIG_INCLUDE +#include WEAVE_PROJECT_CONFIG_INCLUDE +#endif + +/* Include a platform-specific configuration file, if defined. + * + * A platform configuration file contains overrides to standard Weave configuration + * that are specific to the platform or OS on which Weave is running. It is typically + * provided as apart of an adaptation layer that adapts OpenWeave to the target + * environment. This adaptation layer may be included in the OpenWeave source tree + * itself or implemented externally. + */ +#ifdef WEAVE_PLATFORM_CONFIG_INCLUDE +#include WEAVE_PLATFORM_CONFIG_INCLUDE +#endif + +// clang-format off + +/** + * @def WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES + * + * @brief + * This boolean configuration option is (1) if the obsolescent interfaces + * of the Nest Weave layer are still available for transitional purposes. + * + */ +#ifndef WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES +#define WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES 0 +#endif // WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES + +// Profile-specific Configuration Headers + +#include "WeaveBDXConfig.h" + +#include "WeaveDMConfig.h" + +#include "WeaveTimeConfig.h" + +#include "WeaveTunnelConfig.h" + +#include "WeaveEventLoggingConfig.h" + +#include "WeaveWRMPConfig.h" + +/** + * @def WEAVE_CONFIG_ERROR_TYPE + * + * @brief + * This defines the data type used to represent errors for Weave. + * + */ +#ifndef WEAVE_CONFIG_ERROR_TYPE +#include + +#define WEAVE_CONFIG_ERROR_TYPE int32_t +#endif // WEAVE_CONFIG_ERROR_TYPE + +/** + * @def WEAVE_CONFIG_NO_ERROR + * + * @brief + * This defines the Weave error code for no error or success. + * + */ +#ifndef WEAVE_CONFIG_NO_ERROR +#define WEAVE_CONFIG_NO_ERROR 0 +#endif // WEAVE_CONFIG_NO_ERROR + +/** + * @def WEAVE_CONFIG_ERROR_MIN + * + * @brief + * This defines the base or minimum Weave error number range. + * + */ +#ifndef WEAVE_CONFIG_ERROR_MIN +#define WEAVE_CONFIG_ERROR_MIN 4000 +#endif // WEAVE_CONFIG_ERROR_MIN + +/** + * @def WEAVE_CONFIG_ERROR_MAX + * + * @brief + * This defines the top or maximum Weave error number range. + * + */ +#ifndef WEAVE_CONFIG_ERROR_MAX +#define WEAVE_CONFIG_ERROR_MAX 4999 +#endif // WEAVE_CONFIG_ERROR_MAX + +/** + * @def _WEAVE_CONFIG_ERROR + * + * @brief + * This defines a mapping function for Weave errors that allows + * mapping such errors into a platform- or system-specific manner. + * + */ +#ifndef _WEAVE_CONFIG_ERROR +#define _WEAVE_CONFIG_ERROR(e) (WEAVE_ERROR_MIN + (e)) +#endif // _WEAVE_CONFIG_ERROR + +/** + * @def WEAVE_CONFIG_USE_OPENSSL_ECC + * + * @brief + * Use the OpenSSL implementation of the elliptic curve primitives + * for Weave communication. + * + * Note that this option is mutually exclusive with + * #WEAVE_CONFIG_USE_MICRO_ECC. + */ +#ifndef WEAVE_CONFIG_USE_OPENSSL_ECC +#define WEAVE_CONFIG_USE_OPENSSL_ECC 1 +#endif // WEAVE_CONFIG_USE_OPENSSL_ECC + +/** + * @def WEAVE_CONFIG_USE_MICRO_ECC + * + * @brief + * Use the Micro ECC implementation of the elliptic curve primitives + * for Weave communication. + * + * Note that this option is mutually exclusive with + * #WEAVE_CONFIG_USE_OPENSSL_ECC. + * + */ +#ifndef WEAVE_CONFIG_USE_MICRO_ECC +#define WEAVE_CONFIG_USE_MICRO_ECC 0 +#endif // WEAVE_CONFIG_USE_MICRO_ECC + +#if WEAVE_CONFIG_USE_MICRO_ECC && WEAVE_CONFIG_USE_OPENSSL_ECC +#error "Please assert one of either WEAVE_CONFIG_USE_MICRO_ECC or WEAVE_CONFIG_USE_OPENSSL_ECC, but not both." +#endif // WEAVE_CONFIG_USE_MICRO_ECC && WEAVE_CONFIG_USE_OPENSSL_ECC + +/** + * @name Weave Elliptic Curve Security Configuration + * + * @brief + * The following definitions enable one or more of four potential + * elliptic curves: + * + * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + * + * @brief + * Enable (1) or disable (0) support for the Standards for + * Efficient Cryptography Group (SECG) secp160r1 elliptic curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 0 +#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + +/** + * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + * + * @brief + * Enable (1) or disable (0) support for the Standards for + * Efficient Cryptography Group (SECG) secp192r1 elliptic curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 1 +#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + +/** + * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + * + * @brief + * Enable (1) or disable (0) support for the Standards for + * Efficient Cryptography Group (SECG) secp224r1 / National + * Institute of Standards (NIST) P-224 elliptic curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 1 +#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + +/** + * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + * + * @brief + * Enable (1) or disable (0) support for the Standards for + * Efficient Cryptography Group (SECG) secp256r1 / American + * National Standards Institute (ANSI) prime256v1 / National + * Institute of Standards (NIST) P-256 elliptic curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 1 +#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + +/** + * @} + */ + +/** + * @name Weave Password Authenticated Session Establishment (PASE) Configuration + * + * @brief + * The following definitions define the configurations supported + * for Weave's Password Authenticated Session Establishment (PASE) + * protocol. + * + * This protocol is used primarily for establishing a secure + * session for provisioning. Weave supports the following PASE + * configurations: + * + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 + * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 + * + * which are summarized in the table below: + * + * | Configuration | J-PAKE Style | Curve | Test Only | Notes | + * | :------------: | :-------------- | :-------: | :---------: | :----------------------------------- | + * | 0 | - | - | Y | Test-only | + * | 1 | Finite Field | - | N | Original Weave default configuration | + * | 2 | Elliptic Curve | secp160r1 | N | | + * | 3 | Elliptic Curve | secp192r1 | N | | + * | 4 | Elliptic Curve | secp224r1 | N | Future Weave default configuration | + * | 5 | Elliptic Curve | secp256r1 | N | | + * + * @{ + * + */ + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY + * + * @brief + * This Weave PASE configuration does not use the J-PAKE algorithm + * and sends deterministic messages over the communications + * channel. The size and structure of the messages are similar to + * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG5. + * + * @note The results of this configuration are insecure because the + * computational overhead of the cryptography has largely been + * disabled since the focus of this configuration is testing + * the overall PASE protocol exchange, independently of the + * cryptography. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY 0 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 + * + * @brief + * This Weave PASE configuration uses Finite Field J-PAKE and is + * the original, default Weave PASE configuration. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 1 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 + * + * @brief + * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * SECG secp160r1 curve. + * + * @note When this PASE configuration is enabled, the corresponding + * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1) + * should also be enabled. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 0 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 + * + * @brief + * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * SECG secp192r1 curve. + * + * @note When this PASE configuration is enabled, the corresponding + * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1) + * should also be enabled. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 0 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 + * + * @brief + * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * SECG secp224r1 curve and will be the new, default Weave PASE + * configuration. + * + * @note When this PASE configuration is enabled, the corresponding + * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1) + * should also be enabled. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 1 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 + +/** + * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 + * + * @brief + * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * SECG secp256r1 curve. + * + * @note When this PASE configuration is enabled, the corresponding + * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1) + * should also be enabled. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 +#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 0 +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 + +/** + * @} + */ + +#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 is asserted" +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + +#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 is asserted" +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + +#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 is asserted" +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + +#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 is asserted" +#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + +/** + * @def WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT + * + * @brief + * Align payload on 4-byte boundary for PASE messages. + * Currently, payload alignment is required only when micro-ecc + * library is used and it is compiled with ARM assembly. + * If implementation guarantees that payload is always 4-byte + * aligned this option should stay deasserted to save code size. + * + */ +#ifndef WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT +#if WEAVE_CONFIG_USE_MICRO_ECC +#define WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 1 +#else +#define WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 0 +#endif // WEAVE_CONFIG_USE_MICRO_ECC +#endif // WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT + +/** + * @def WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT + * + * @brief + * The amount of time (in milliseconds) in which the Security Manager + * is allowed to have maximum #WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS + * counted PASE attempts. + * + */ +#ifndef WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT +#define WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT 15000 +#endif // WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT + +/** + * @def WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS + * + * @brief + * The maximum number of PASE attempts after which the + * next PASE session establishment attempt will be allowed + * only after #WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT expires. + * * For PASE negotiations with key confirmation option enabled: + * only attempts that failed with key confirmation error are counted. + * Successful PASE negotiations do not reset the rate limiter. + * * For PASE negotiations with key confirmation option disabled: + * every PASE negotiation, successful or otherwise, is added + * to the rate limiter. + * + */ +#ifndef WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS +#define WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS 3 +#endif // WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS + +/** + * @name Weave Security Manager Memory Management Configuration + * + * @brief + * The following definitions enable one of three potential Weave + * Security Manager memory-management options: + * + * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC + * + * Note that these options are mutually exclusive and only one + * of these options should be set. + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + * + * @brief + * Enable (1) or disable (0) support for platform-specific + * implementation of Weave Security Manager memory-management + * functions. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE and + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. + * + */ +#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM +#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM 0 +#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + +/** + * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + * + * @brief + * Enable (1) or disable (0) support for a Weave-provided + * implementation of Weave Security Manager memory-management + * functions based on temporary network buffer allocation / + * release. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. + * + */ +#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE +#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE 0 +#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + +/** + * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC + * + * @brief + * Enable (1) or disable (0) support for a Weave-provided + * implementation of Weave Security Manager memory-management + * functions based on the C Standard Library malloc / free + * functions. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE. + * + */ +#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC +#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC 1 +#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC + +/** + * @} + */ + +#if ((WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) +#error "Please assert exactly one of WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM, WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE, or WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC." +#endif // ((WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) + +/** + * @def WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS + * + * @brief + * Enable (1) or disable (0) simple memory allocator support + * for small size network buffers. When enabled, this configuration + * requires 4 network buffers with minimum available payload size of + * 600 bytes. + * + * @note This configuration is only relevant when + * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE is set and + * ignored otherwise. + * + */ +#ifndef WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS +#define WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS 0 +#endif // WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS + +/** + * @name Weave Security Manager Time-Consuming Crypto Alerts. + * + * @brief + * The following definitions enable one of two potential Weave + * Security Manager time-consuming crypto alerts implementations: + * + * * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + * * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM + * + * Note that these options are mutually exclusive and only one + * of these options should be set. + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + * + * @brief + * Enable (1) or disable (0) support for Weave-provided dummy + * implementation of Weave security manager time-consuming + * crypto alerts functions. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM. + * + */ +#ifndef WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY +#define WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY 1 +#endif // WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + +/** + * @def WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM + * + * @brief + * Enable (1) or disable (0) support for a platform-specific + * implementation of Weave security manager time-consuming + * crypto alerts functions. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY. + * + */ +#ifndef WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM +#define WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM 0 +#endif // WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM + +/** + * @} + */ + +#if ((WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) +#error "Please assert exactly one of WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY or WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM." +#endif // ((WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) + +/** + * @name Weave Random Number Generator (RNG) Implementation Configuration + * + * @brief + * The following definitions enable one of three potential Weave + * RNG implementation options: + * + * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL + * + * Note that these options are mutually exclusive and only one of + * these options should be set. + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + * + * @brief + * Enable (1) or disable (0) support for platform-specific + * implementation of the Weave Random Number Generator. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG and + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL. + * + */ +#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM +#define WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM 0 +#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + +/** + * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * + * @brief + * Enable (1) or disable (0) support for a Weave-provided + * implementation of the Weave Random Number Generator. + * This implementation is based on AES-CTR DRBG as + * specified in the NIST SP800-90A document. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM and + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL. + * + */ +#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG +#define WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG 0 +#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + +/** + * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL + * + * @brief + * Enable (1) or disable (0) support for a standard OpenSSL + * implementation of the Weave Random Number Generator. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM and + * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG. + * + */ +#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL +#define WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL 1 +#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL + +/** + * @} + */ + +#if ((WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) +#error "Please assert exactly one of WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM, WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG, or WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL." +#endif // ((WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) + + +/** + * @def WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED + * + * @brief + * Enable (1) or disable (0) a function for seeding the DRBG with + * entropy from the /dev/(u)random device. + * + * @note When enabled along with #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * this function becomes the default seeding function for the DRBG if + * another isn't specified at initialization time. + * + */ +#ifndef WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED +#define WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED 0 +#endif // WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED + +/** + * @def WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME + * + * @brief + * The device name used by the dev random entropy function. + * + * @note Only meaningful when #WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED is enabled. + * + */ +#ifndef WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME +#define WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME "/dev/urandom" +#endif // WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME + + + +/** + * @name Weave AES Block Cipher Algorithm Implementation Configuration. + * + * @brief + * The following definitions enable one of the potential Weave + * AES implementation options: + * + * * #WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + * * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + * + * Note that these options are mutually exclusive and only one of + * these options should be set. + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + * + * @brief + * Enable (1) or disable (0) support for platform-specific + * implementation of the Weave AES functions. + * + * @note This configuration is mutual exclusive with + * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL and + * #WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + * + */ +#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM +#define WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM 0 +#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + +/** + * @def WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + * + * @brief + * Enable (1) or disable (0) support for the OpenSSL + * implementation of the Weave AES functions. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL +#define WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL 1 +#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + +/** + * @def WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + * + * @brief + * Enable (1) or disable (0) support for an implementation + * of the Weave AES functions using Intel AES-NI intrinsics. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI +#define WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI 0 +#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + +/** + * @def WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS + * + * @brief + * Enable (1) or disable (0) support the mbed TLS + * implementation of the Weave AES functions. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS +#define WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS 0 +#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS + +/** + * @} + */ + +#if ((WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + \ + WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + \ + WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + \ + WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS) != 1) +#error "Please assert exactly one WEAVE_CONFIG_AES_IMPLEMENTATION_... option." +#endif + +/** + * @def WEAVE_CONFIG_AES_USE_EXPANDED_KEY + * + * @brief + * Defines whether AES key is used in its expanded (1) or native (0) form. + * + * @note OpenSSL AES implementation uses its own AES key declaration + * and this configuration option is ignored when + * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL is set. + * + */ +#ifndef WEAVE_CONFIG_AES_USE_EXPANDED_KEY +#define WEAVE_CONFIG_AES_USE_EXPANDED_KEY 0 +#endif // WEAVE_CONFIG_AES_USE_EXPANDED_KEY + + +/** + * @name Weave SHA1 and SHA256 Hash Algorithms Implementation Configuration. + * + * @brief + * The following definitions enable one of three potential Weave + * hash implementation options: + * + * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS + * + * Note that these options are mutually exclusive and only one of + * these options should be set. + * + * @{ + */ + +/** + * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + * + * @brief + * Enable (1) or disable (0) support for platform-specific + * implementation of the Weave SHA1 and SHA256 hashes. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM +#define WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM 0 +#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + +/** + * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + * + * @brief + * Enable (1) or disable (0) support for a Weave-provided + * implementation of the Weave SHA1 and SHA256 hash functions. + * This implementation is using sha1 and sha256 engines from + * mincrypt library of Android core. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT +#define WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT 0 +#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + +/** + * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + * + * @brief + * Enable (1) or disable (0) support for the OpenSSL + * implementation of the Weave SHA1 and SHA256 hash functions. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL +#define WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL 1 +#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + +/** + * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS + * + * @brief + * Enable (1) or disable (0) support for the mbedTLS + * implementation of the Weave SHA1 and SHA256 hash functions. + * + * @note This configuration is mutual exclusive with other + * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * + */ +#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS +#define WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS 0 +#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS + +/** + * @} + */ + +#if ((WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + \ + WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + \ + WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + \ + WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS) != 1) +#error "Please assert exactly one WEAVE_CONFIG_HASH_IMPLEMENTATION_... option." +#endif + + +/** + * @name Weave key export protocol configuration. + * + * @brief + * The following definitions define the configurations supported + * for Weave's key export protocol. + * + * This protocol is used to export secret key material from Weave device. + * Weave supports the following protocol configurations: + * + * * #WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 + * * #WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 + * + * which are summarized in the table below: + * + * | Configuration | Curve | Notes | + * | :------------: | :-------: | :---------------------- | + * | 1 | secp224r1 | Default configuration | + * | 2 | secp256r1 | | + * + * @{ + * + */ + +/** + * @def WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 + * + * @brief + * This Weave key export protocol configuration uses secp224r1 + * Elliptic Curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 +#define WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 1 +#endif // WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 + +/** + * @def WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 + * + * @brief + * This Weave key export protocol configuration uses secp256r1 + * Elliptic Curve. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 +#define WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 1 +#endif // WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 + +/** + * @} + */ + + +/** + * @def WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES + * + * @brief + * Allow the use of elliptic curves beyond the standard ones + * supported by Weave. + * + */ +#ifndef WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES +#define WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES 0 +#endif // WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES + +/** + * @def WEAVE_CONFIG_MAX_EC_BITS + * + * @brief + * The maximum size elliptic curve supported, in bits. + * + */ +#ifndef WEAVE_CONFIG_MAX_EC_BITS +#define WEAVE_CONFIG_MAX_EC_BITS 256 +#endif // WEAVE_CONFIG_MAX_EC_BITS + +/** + * @def WEAVE_CONFIG_MAX_RSA_BITS + * + * @brief + * The maximum size RSA modulus supported, in bits. + * + */ +#ifndef WEAVE_CONFIG_MAX_RSA_BITS +#define WEAVE_CONFIG_MAX_RSA_BITS 4096 +#endif // WEAVE_CONFIG_MAX_RSA_BITS + +/** + * @def WEAVE_CONFIG_MAX_PEER_NODES + * + * @brief + * Maximum number of peer nodes that the local node can communicate + * with. + * + */ +#ifndef WEAVE_CONFIG_MAX_PEER_NODES +#define WEAVE_CONFIG_MAX_PEER_NODES 128 +#endif // WEAVE_CONFIG_MAX_PEER_NODES + +/** + * @def WEAVE_CONFIG_MAX_CONNECTIONS + * + * @brief + * Maximum number of simultaneously active connections. + * + */ +#ifndef WEAVE_CONFIG_MAX_CONNECTIONS +#define WEAVE_CONFIG_MAX_CONNECTIONS INET_CONFIG_NUM_TCP_ENDPOINTS +#endif // WEAVE_CONFIG_MAX_CONNECTIONS + +/** + * @def WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS + * + * @brief + * Maximum number of simultaneously active inbound TCP connections. + * + * Regardless of what #WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS + * is set to, the total number of inbound connections cannot exceed + * #WEAVE_CONFIG_MAX_CONNECTIONS, which is the overall limit for + * inbound and outbound connections. + */ +#ifndef WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS +#define WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS (WEAVE_CONFIG_MAX_CONNECTIONS * 4 / 5) +#endif // WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS + +/** + * @def WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP + * + * @brief + * Maximum number of simultaneously active inbound TCP connections + * from the single IP address. + * + * Regardless of what #WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP + * is set to, the total number of inbound connections from a single IP + * address cannot exceed #WEAVE_CONFIG_MAX_CONNECTIONS or + * #WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS. + */ +#ifndef WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP +#define WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP 2 +#endif // WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP + +/** + * @def WEAVE_CONFIG_MAX_TUNNELS + * + * @brief + * Maximum number of simultaneously active connection tunnels. + * + */ +#ifndef WEAVE_CONFIG_MAX_TUNNELS +#define WEAVE_CONFIG_MAX_TUNNELS 1 +#endif // WEAVE_CONFIG_MAX_TUNNELS + +/** + * @def WEAVE_CONFIG_MAX_SESSION_KEYS + * + * @brief + * Maximum number of simultaneously active session keys. + * + */ +#ifndef WEAVE_CONFIG_MAX_SESSION_KEYS +#define WEAVE_CONFIG_MAX_SESSION_KEYS WEAVE_CONFIG_MAX_CONNECTIONS +#endif // WEAVE_CONFIG_MAX_SESSION_KEYS + +/** + * @def WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS + * + * @brief + * Maximum number of simultaneously supported application epoch keys. + * This define should be set to the maximum number of epoch keys + * that can be simultaneously provisioned on Weave node by Weave + * service. The maximum supported value is 8, however, in most cases + * only two such keys will exist on device at any given point in time. + * + */ +#ifndef WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS +#define WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS 4 +#endif // WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS + +/** + * @def WEAVE_CONFIG_MAX_APPLICATION_GROUPS + * + * @brief + * Maximum number of simultaneously supported application groups. + * This define should be set to the number of Weave application + * groups, in which associated Weave node has membership. + * + */ +#ifndef WEAVE_CONFIG_MAX_APPLICATION_GROUPS +#define WEAVE_CONFIG_MAX_APPLICATION_GROUPS 8 +#endif // WEAVE_CONFIG_MAX_APPLICATION_GROUPS + +/** + * @def WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC + * + * @brief + * Enable (1) or disable (0) support for the application group keys + * used for Weave message encryption. + * + */ +#ifndef WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC +#define WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC 1 +#endif // WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC + +/** + * @def WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS + * + * @brief + * Maximum number of simultaneously cached Weave message encryption + * application keys. + * Caching these keys speeds up message encoding/decoding processes + * and eliminates the need to retrieve constituent key material from + * the platform memory every time we derive these keys. + * This define can be set equal to the number of application groups + * (#WEAVE_CONFIG_MAX_APPLICATION_GROUPS) supported by the Weave node + * such that exactly one key can be cached for each application group. + * It might be a good idea to allocate few more entries in the key + * cache for the corner cases, where application group is having + * simultaneous conversations using an 'old' and a 'new' epoch key. + * + * @note This configuration is only relevant when + * #WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC is set and + * ignored otherwise. + * + */ +#ifndef WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS +#define WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS (WEAVE_CONFIG_MAX_APPLICATION_GROUPS + 1) +#endif // WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS + +#if !(WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) +#error "Please set WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS to a value greater than zero and smaller than 256." +#endif // !(WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) + +/** + * @name Weave Encrypted Passcode Configuration + * + * @brief + * The following definitions enable (1) or disable (0) supported for + * Weave encrypted passcode configurations. Each configuration + * uniquely specifies how Weave passcode was encrypted, authenticated, + * and structured. Weave supports the following passcode + * configurations: + * + * * #WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY + * * #WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 + * + * which are summarized in the table below: + * + * | Configuration | Encryption | Authentication | Fingerprint | Notes | + * | :-----------: | :--------: | :------------: | :---------: | :-------------------- | + * | 1 | - | SHA1 Hash | SHA1 Hash | Test-only | + * | 2 | AES128-ECB | SHA1 HMAC | SHA1 HMAC | Default configuration | + * + * @{ + * + */ + +/** + * @def WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY + * + * @brief + * This Weave passcode configuration does not encrypt the passcode + * and doesn't use secret keys to authenticate and uniquely identify + * (fingerprint) the passcode. + * + * @note For this configuration the computational overhead of the + * cryptography has largely been disabled since the focus + * of this configuration is testing the overall passcode + * encryption/decryption protocol, independently of the + * cryptography. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY +#define WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY 0 +#endif // WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY + +/** + * @def WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 + * + * @brief + * This Weave passcode configuration uses AES128 algorithm in ECB + * mode to encrypt passcodes. It also uses SHA1 Hash-based Message + * Authentication Code (HMAC) to authenticate and uniquely identify + * (fingerprint) the passcode. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 +#define WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 1 +#endif // WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 + +/** + * @} + */ + +/** + * @def WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT + * + * @brief + * The default amount of time, in milliseconds, after which an in-progess + * session establishment will fail due to a timeout. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT +#define WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT 30000 +#endif // WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT + +/** + * @def WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT + * + * @brief + * The default minimum amount of time, in milliseconds, that an unreserved and idle + * security session will be allowed to exist before being destroyed. In practice, + * unreserved idle sessions can exist for up to twice this value. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT +#define WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT 15000 +#endif // WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT + +/** + * @def WEAVE_CONFIG_NUM_MESSAGE_BUFS + * + * @brief + * Total number of message buffers. Only used for the BSD sockets + * configuration. + * + */ +#ifndef WEAVE_CONFIG_NUM_MESSAGE_BUFS +#define WEAVE_CONFIG_NUM_MESSAGE_BUFS 16 +#endif // WEAVE_CONFIG_NUM_MESSAGE_BUFS + +/** + * @def WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS + * + * @brief + * Maximum number of simultaneously active unsolicited message + * handlers. + * + */ +#ifndef WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS +#define WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS 32 +#endif // WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS + +/** + * @def WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS + * + * @brief + * Maximum number of simultaneously active exchange contexts. + * + */ +#ifndef WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS +#define WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS 16 +#endif // WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS + +/** + * @def WEAVE_CONFIG_MAX_BINDINGS + * + * @brief + * Maximum number of simultaneously active bindings per WeaveExchangeManager + * The new single source TimeSync client takes one binding. + * Every WDM one-way subscription takes one binding. Mutual subscription counts as two one-way subscriptions. + * A reserved slot is needed to take an incoming subscription request. + * For a device with 2 mutual subscriptions, and one single source time sync client, it needs 2 x 2 + 1 = 5 bindings at least. + * At least six is needed if it still wants to take new WDM subscriptions under this load. + */ +#ifndef WEAVE_CONFIG_MAX_BINDINGS +#define WEAVE_CONFIG_MAX_BINDINGS 6 +#endif // WEAVE_CONFIG_MAX_BINDINGS + +/** + * @def WEAVE_CONFIG_CONNECT_IP_ADDRS + * + * @brief + * Maximum number of IP addresses tried when connecting to a + * hostname. + * + */ +#ifndef WEAVE_CONFIG_CONNECT_IP_ADDRS +#define WEAVE_CONFIG_CONNECT_IP_ADDRS 4 +#endif // WEAVE_CONFIG_CONNECT_IP_ADDRS + +/** + * @def WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE + * + * @brief + * The default MTU size for an IPv6 datagram carrying UDP. This is useful + * for senders who want to send UDP Weave messages that fit within a single + * IPv6 datagram. + * + * 1280 is the guaranteed minimum IPv6 MTU. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE +#define WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE 1280 +#endif // WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE + +/** + * @def WEAVE_HEADER_RESERVE_SIZE + * + * @brief + * The number of bytes to reserve in a network packet buffer to contain the + * Weave message and exchange headers. + * + * This number was calculated as follows: + * + * Weave Message Header: + * + * 2 -- Frame Length + * 2 -- Message Header + * 4 -- Message Id + * 8 -- Source Node Id + * 8 -- Destination Node Id + * 2 -- Key Id + * + * Weave Exchange Header: + * + * 1 -- Application Version + * 1 -- Message Type + * 2 -- Exchange Id + * 4 -- Profile Id + * 4 -- Acknowleged Message Id + * + * @note A number of these fields are optional or not presently used. + * So most headers will be considerably smaller than this. + * + */ +#ifndef WEAVE_HEADER_RESERVE_SIZE +#define WEAVE_HEADER_RESERVE_SIZE 38 +#endif // WEAVE_HEADER_RESERVE_SIZE + +/** + * @def WEAVE_TRAILER_RESERVE_SIZE + * + * @brief + * TODO + * + */ +#ifndef WEAVE_TRAILER_RESERVE_SIZE +#define WEAVE_TRAILER_RESERVE_SIZE 20 +#endif // WEAVE_TRAILER_RESERVE_SIZE + +/** + * @def WEAVE_PORT + * + * @brief + * Weave TCP/UDP port for secured Weave traffic. + * + */ +#ifndef WEAVE_PORT +#define WEAVE_PORT 11095 +#endif // WEAVE_PORT + +/** + * @def WEAVE_UNSECURED_PORT + * + * @brief + * Weave TCP/UDP port for unsecured Weave traffic. + * + */ +#ifndef WEAVE_UNSECURED_PORT +#define WEAVE_UNSECURED_PORT 11096 +#endif // WEAVE_UNSECURED_PORT + +/** + * @def WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT + * + * @brief + * Enable use of an ephemeral UDP source port for locally initiated Weave exchanges. + */ +#ifndef WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT +#define WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 0 +#endif // WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT + +/** + * @def WEAVE_CONFIG_SECURITY_TEST_MODE + * + * @brief + * Enable various features that make it easier to debug secure Weave communication. + * + * @note + * WARNING: This option makes it possible to circumvent basic Weave security functionality, + * including message encryption. Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS. + */ +#ifndef WEAVE_CONFIG_SECURITY_TEST_MODE +#define WEAVE_CONFIG_SECURITY_TEST_MODE 0 +#endif // WEAVE_CONFIG_SECURITY_TEST_MODE + +/** + * @def WEAVE_CONFIG_ENABLE_DNS_RESOLVER + * + * @brief + * Enable support for resolving hostnames with a DNS resolver. + */ +#ifndef WEAVE_CONFIG_ENABLE_DNS_RESOLVER +#define WEAVE_CONFIG_ENABLE_DNS_RESOLVER (INET_CONFIG_ENABLE_DNS_RESOLVER) +#endif // WEAVE_CONFIG_ENABLE_DNS_RESOLVER + +/** + * @def WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL + * + * @brief + * Enable support for resolving hostnames as literal IP addresses without a DNS resolver. + * + * For historical reasons, the default is \c TRUE where \c WEAVE_SYSTEM_CONFIG_USE_SOCKETS=1, + * and \c FALSE otherwise. The exception in the LwIP-only case was originally made to facilitate + * integration and change management with existing development lines. The default may + * change in the future to \c TRUE in all cases. + */ +#ifndef WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL +#define WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL (WEAVE_SYSTEM_CONFIG_USE_SOCKETS) +#endif // WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL + +/** + * @def WEAVE_CONFIG_ENABLE_TARGETED_LISTEN + * + * @brief + * Enable support for listening on particular addresses/interfaces. + * + * This allows testing multiple instances of the Weave stack + * running on a single host. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_TARGETED_LISTEN +#define WEAVE_CONFIG_ENABLE_TARGETED_LISTEN (!WEAVE_SYSTEM_CONFIG_USE_LWIP) +#endif // WEAVE_CONFIG_ENABLE_TARGETED_LISTEN + +/** + * @def WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN + * + * @brief + * Enable support for receiving TCP connections over an unsecured + * network layer (for example, from a device that is provisionally joined + * to a 6LowPAN network but does not possess the 802.15.4 network + * keys). + * + */ +#ifndef WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN +#define WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN 0 +#endif // WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN + +/** + * @def WEAVE_CONFIG_DEBUG_CERT_VALIDATION + * + * @brief + * Enable support for debugging output from certificate validation. + * + */ +#ifndef WEAVE_CONFIG_DEBUG_CERT_VALIDATION +#define WEAVE_CONFIG_DEBUG_CERT_VALIDATION 1 +#endif // WEAVE_CONFIG_DEBUG_CERT_VALIDATION + +/** + * @def WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID + * + * @brief + * EC curve to be used to generate Weave operational device certificate. + * + */ +#ifndef WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID +#define WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime256v1) +#endif // WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID + +/** + * @def WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE + * + * @brief + * This is a packed valid date to be encoded in the Weave + * operational device certificate. Any date before + * that date the certificate is considered invalid. + * The following functions can be used to calculate packed + * date/time: PackCertTime() and PackedCertTimeToDate(). + * Weave packed certificate dates are limited to representing + * dates that are on or after 2000/01/01. + * Mathematical expression to calculate packed date is: + * (((year - 2000) * 12 + (mon - 1)) * 31 + (day - 1)) + * Currently encoded value corresponds to 2019/01/01. + * + */ +#ifndef WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE +#define WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE 0x1B9C +#endif // WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE + +/** + * @def WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER + * + * @brief + * This is the valid date to be encoded in the Weave + * operational device certificate. Any date after + * that date the certificate is considered invalid. + * The following functions can be used to calculate packed + * date/time: PackCertTime() and PackedCertTimeToDate(). + * Weave packed certificate dates are limited to representing + * dates that are on or after 2000/01/01. + * Mathematical expression to calculate packed date is: + * (((year - 2000) * 12 + (mon - 1)) * 31 + (day - 1)) + * Currently encoded value corresponds to 2069/01/01. + * + */ +#ifndef WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER +#define WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER 0x6444 +#endif // WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER + +/** + * @def WEAVE_CONFIG_ENABLE_PASE_INITIATOR + * + * @brief + * Enable support for initiating PASE sessions. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_PASE_INITIATOR +#define WEAVE_CONFIG_ENABLE_PASE_INITIATOR 1 +#endif // WEAVE_CONFIG_ENABLE_PASE_INITIATOR + +/** + * @def WEAVE_CONFIG_ENABLE_PASE_RESPONDER + * + * @brief + * Enable support for responding to PASE sessions initiated by + * other nodes. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_PASE_RESPONDER +#define WEAVE_CONFIG_ENABLE_PASE_RESPONDER 1 +#endif // WEAVE_CONFIG_ENABLE_PASE_RESPONDER + +/** + * @def WEAVE_CONFIG_ENABLE_CASE_INITIATOR + * + * @brief + * Enable support for initiating CASE sessions. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_CASE_INITIATOR +#define WEAVE_CONFIG_ENABLE_CASE_INITIATOR 1 +#endif // WEAVE_CONFIG_ENABLE_CASE_INITIATOR + +/** + * @def WEAVE_CONFIG_ENABLE_CASE_RESPONDER + * + * @brief + * Enable support for responding to CASE sessions initiated by other nodes. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_CASE_RESPONDER +#define WEAVE_CONFIG_ENABLE_CASE_RESPONDER 1 +#endif // WEAVE_CONFIG_ENABLE_CASE_RESPONDER + +/** + * @def WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 + * + * @brief + * Enable use of CASE protocol configuration 1. + * + * @note CASE config 1 uses SHA-1 for message signatures, which is deprecated. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 +#define WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 1 +#endif // WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 + +/** + * @def WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID + * + * @brief + * Default ECDH curve to be used when initiating a CASE session, if not overridden by the application. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID +#if WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_secp224r1) +#elif WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime256v1) +#elif WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime192v1) +#else +#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_secp160r1) +#endif +#endif // WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID + +/** + * @def WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES + * + * @brief + * Default set of ECDH curves allowed to be used in a CASE session (initiating or responding), if not overridden by the application. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES +#if WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 || WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (nl::Weave::Profiles::Security::kWeaveCurveSet_secp224r1|nl::Weave::Profiles::Security::kWeaveCurveSet_prime256v1) +#else +#define WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (nl::Weave::Profiles::Security::kWeaveCurveSet_All) +#endif +#endif // WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES + +/** + * @def WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE + * + * @brief + * Enable use of the legacy WeaveCASEAuthDelegate interface. + */ +#ifndef WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE +#define WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE 1 +#endif + +/** + * @def WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES + * + * @brief + * The maximum number of end nodes simultaneously supported + * for all active shared sessions. + * + */ +#ifndef WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES +#define WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES 10 +#endif // WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES + +/** + * @def WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION + * + * @brief + * The maximum number of end nodes simultaneously supported + * per active shared session. + * + */ +#ifndef WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION +#define WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION 10 +#endif // WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION + +/** + * @def WEAVE_CONFIG_ENABLE_TAKE_INITIATOR + * + * @brief + * Enable support for initiating TAKE sessions. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_TAKE_INITIATOR +#define WEAVE_CONFIG_ENABLE_TAKE_INITIATOR 0 +#endif // WEAVE_CONFIG_ENABLE_TAKE_INITIATOR + +/** + * @def WEAVE_CONFIG_ENABLE_TAKE_RESPONDER + * + * @brief + * Enable support for responding to TAKE sessions initiated by other nodes. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_TAKE_RESPONDER +#define WEAVE_CONFIG_ENABLE_TAKE_RESPONDER 0 +#endif // WEAVE_CONFIG_ENABLE_TAKE_RESPONDER + +/** + * @def WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR + * + * @brief + * Enable support for initiating key export request. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR +#define WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR 1 +#endif // WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR + +/** + * @def WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER + * + * @brief + * Enable support for responding to key export request initiated by other nodes. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER +#define WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER 1 +#endif // WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER + +/** + * @def WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE + * + * @brief + * Enable use of the legacy WeaveKeyExportDelegate interface. + */ +#ifndef WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE +#define WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE 1 +#endif + +/** + * @def WEAVE_CONFIG_REQUIRE_AUTH + * + * @brief + * Enable (1) or disable (0) support for client requests via an + * authenticated session. + * + * This broadly controls whether or not a number of Weave servers + * require client requests to be sent via an authenticated session + * and provides a default configuration value to these related + * definitions: + * + * * #WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL + * * #WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV + * * #WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV + * * #WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV + * + * @note These configurations shall be deasserted for development + * and testing purposes only. No Weave-enabled device shall + * be certified without these asserted. + * + */ +#ifndef WEAVE_CONFIG_REQUIRE_AUTH +#define WEAVE_CONFIG_REQUIRE_AUTH 1 +#endif // WEAVE_CONFIG_REQUIRE_AUTH + +/** + * @def WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL + * + * @brief + * Enable (1) or disable (0) support for client requests to the + * Weave Device Control server via an authenticated session. See + * also #WEAVE_CONFIG_REQUIRE_AUTH. + * + * @note This configuration shall be deasserted for development + * and testing purposes only. No Weave-enabled device shall + * be certified without this asserted. + * + */ +#ifndef WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL +#define WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL WEAVE_CONFIG_REQUIRE_AUTH +#endif // WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL + +/** + * @def WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV + * + * @brief + * Enable (1) or disable (0) support for client requests to the + * Weave Fabric Provisioning server via an authenticated + * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * + * @note This configuration shall be deasserted for development + * and testing purposes only. No Weave-enabled device shall + * be certified without this asserted. + * + */ +#ifndef WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV +#define WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV WEAVE_CONFIG_REQUIRE_AUTH +#endif // WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV + +/** + * @def WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV + * + * @brief + * Enable (1) or disable (0) support for client requests to the + * Weave Network Provisioning server via an authenticated + * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * + * @note This configuration shall be deasserted for development + * and testing purposes only. No Weave-enabled device shall + * be certified without this asserted. + * + */ +#ifndef WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV +#define WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV WEAVE_CONFIG_REQUIRE_AUTH +#endif // WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV + +/** + * @def WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV + * + * @brief + * Enable (1) or disable (0) support for client requests to the + * Weave Service Provisioning server via an authenticated + * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * + * @note This configuration shall be deasserted for development + * and testing purposes only. No Weave-enabled device shall + * be certified without this asserted. + * + */ +#ifndef WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV +#define WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV WEAVE_CONFIG_REQUIRE_AUTH +#endif // WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV + +/** + * @def WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT + * + * @brief + * Enable (1) or disable (0) support for the handling of Weave + * Provisioning Bundles. + * + * Weave Provisioning Bundles are a Weave TLV payload containing + * the Weave certificate, corresponding private key, and pairing + * code / entry key that a Weave device would have otherwise + * received at its time of manufacture. + * + * Enable this if your family of device needs to support in-field + * provisioning (IFP). IFP for Weave devices is neither generally + * supported nor recommended. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT +#define WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT 1 +#endif // WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT + +/** + * @def WEAVE_ERROR_LOGGING + * + * @brief + * If asserted (1), enable logging of all messages in the + * nl::Weave::Logging::LogCategory::kLogCategory_Error category. + * + */ +#ifndef WEAVE_ERROR_LOGGING +#define WEAVE_ERROR_LOGGING 1 +#endif // WEAVE_ERROR_LOGGING + +/** + * @def WEAVE_PROGRESS_LOGGING + * + * @brief + * If asserted (1), enable logging of all messages in the + * nl::Weave::Logging::LogCategory::kLogCategory_Progress category. + * + */ +#ifndef WEAVE_PROGRESS_LOGGING +#define WEAVE_PROGRESS_LOGGING 1 +#endif // WEAVE_PROGRESS_LOGGING + +/** + * @def WEAVE_DETAIL_LOGGING + * + * @brief + * If asserted (1), enable logging of all messages in the + * nl::Weave::Logging::kLogCategory_Detail category. + * + */ +#ifndef WEAVE_DETAIL_LOGGING +#define WEAVE_DETAIL_LOGGING 1 +#endif // WEAVE_DETAIL_LOGGING + +/** + * @def WEAVE_RETAIN_LOGGING + * + * @brief + * If asserted (1), enable logging of all messages in the + * nl::Weave::Logging::LogCategory::kLogCategory_Retain category. + * If not defined by the application, by default WEAVE_RETAIN_LOGGING is + * remapped to WEAVE_PROGRESS_LOGGING + * + */ + + +/** + * @def WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + * + * @brief + * If asserted (1), enable logging of errors at function exit via the + * WeaveLogFunctError() macro. + */ +#ifndef WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING +#define WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 0 +#endif // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + + +/** + * @def WEAVE_CONFIG_ENABLE_CONDITION_LOGGING + * + * @brief + * If asserted (1), enable logging of failed conditions via the + * WeaveLogIfFalse() macro. + */ +#ifndef WEAVE_CONFIG_ENABLE_CONDITION_LOGGING +#define WEAVE_CONFIG_ENABLE_CONDITION_LOGGING 0 +#endif // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING + + +/** + * @def WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY + * + * @brief + * If set to (1), use of the ServiceDirectory implementation + * is enabled. Default value is (1) or enabled. + * + * @note + * Enabling this profile allows applications using Weave to + * request a connection to a particular Weave service using + * a predefined service endpoint. It is relevant for + * applications that run on devices that interact with the + * Service over a direct TCP/IPv4 connection rather than those + * that use the Weave Tunnel through a gateway device. For + * devices of the latter category, the Service Directory + * profile can be disabled via this compilation switch. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY +#define WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY 1 +#endif // WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY + +/** + * @def WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS + * + * @brief + * This is the default timeout for the connect call to the + * directory server to wait for success or being notified + * of an error. + * + */ +#ifndef WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS +#define WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS (10000) +#endif // WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS + +/** + * @def WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT + * + * @brief + * The maximum amount of time, in milliseconds, that an idle inbound + * Weave connection will be allowed to exist before being closed. + * + * This is a default value that can be overridden at runtime by the + * application. + * + * A value of 0 disables automatic closing of idle connections. + * + */ +#ifndef WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT +#define WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT 15000 +#endif // WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT + +/** + * @def WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT + * + * @brief + * The amount of time (in milliseconds) which a peer is given + * to respond to a message counter synchronization request. + * Depending on when the request is sent, peers may + * actually have up to twice this time. + * + */ +#ifndef WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT +#define WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT 2000 +#endif // WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT + +/** + * @def WEAVE_CONFIG_TEST + * + * @brief + * If asserted (1), enable APIs that help implement + * unit and integration tests. + * + */ +#ifndef WEAVE_CONFIG_TEST +#define WEAVE_CONFIG_TEST 0 +#endif // WEAVE_CONFIG_TEST + +/** + * @def WEAVE_CONFIG_SHORT_ERROR_STR + * + * @brief + * If asserted (1), produce shorter error strings that only carry a + * minimum of information. + * + */ +#ifndef WEAVE_CONFIG_SHORT_ERROR_STR +#define WEAVE_CONFIG_SHORT_ERROR_STR 0 +#endif // WEAVE_CONFIG_SHORT_ERROR_STR + +/** + * @def WEAVE_CONFIG_ERROR_STR_SIZE + * + * @brief + * This defines the size of the buffer to store a formatted error string. + * If the formatting of an error string exceeds this size it will be truncated. + * + * The default size varies based on the WEAVE_CONFIG_SHORT_ERROR_STR option. + * + * When WEAVE_CONFIG_SHORT_ERROR_STR is 0, a large default buffer size is used + * to accommodate descriptive text summarizing the cause of the error. E.g.: + * + * "Weave Error 4047 (0x00000FCF): Invalid Argument" + * + * When WEAVE_CONFIG_SHORT_ERROR_STR is 1, the buffer size is set to accommodate + * a minimal error string consisting of a 10 character subsystem name followed + * by an 8 character error number, plus boilerplate. E.g.: + * + * "Error Weave:0x00000FCF" + * + */ +#ifndef WEAVE_CONFIG_ERROR_STR_SIZE +#if WEAVE_CONFIG_SHORT_ERROR_STR +#define WEAVE_CONFIG_ERROR_STR_SIZE (5 + 1 + 10 + 3 + 8 + 1) +#else // WEAVE_CONFIG_SHORT_ERROR_STR +#define WEAVE_CONFIG_ERROR_STR_SIZE 256 +#endif // WEAVE_CONFIG_SHORT_ERROR_STR +#endif // WEAVE_CONFIG_ERROR_STR_SIZE + +/** + * @def WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER + * + * @brief + * If asserted (1), suppress definition of the standard error formatting function + * (#nl::FormatError()) allowing an application-specific implementation to be used. + * + */ +#ifndef WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER +#define WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER 0 +#endif // WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER + +/** + * @def WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT + * + * @brief + * The printf-style format string used to format error values. + * + * On some platforms, the structure of error values makes them more convenient to + * read in either hex or decimal format. This option can be used to override + * the default hex format. + * + * Note that this option only affects short-form error strings (i.e. when + * WEAVE_CONFIG_SHORT_ERROR_STR == 1). Long form error strings always show both hex + * and decimal values + */ +#ifndef WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT +#define WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT "0x%08" PRIX32 +#endif // WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT + +/** + * @def WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE + * + * @brief + * The number of bytes that Weave should reserve at the front of + * every outgoing BLE packet for the sake of the underlying BLE + * stack. + * + */ +#ifndef WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE +#define WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE 0 +#endif // WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE + +/** + * @def WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS + * + * @brief + * Enable (1) or disable (0) support for utility functions for + * decoding and outputing information related to Weave security. + * + */ +#ifndef WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS +#define WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS 1 +#endif // WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS + +/** + * @def WEAVE_CONFIG_IsPlatformErrorNonCritical(CODE) + * + * This macro checks if a platform generated error is critical and + * needs to be reported to the application/caller. The criticality + * of an error (in the context of that platform) is determined by how + * it impacts the logic flow, i.e., whether or not the current flow + * can continue despite the error or it needs to be reported back + * resulting in a potential stoppage. + * + * @note + * This is a default set of platform errors which are configured as + * non-critical from the context of that platform. Any new error that + * the platforms deem as non-critical could be added by overriding + * this default macro definition after careful thought towards its + * implication in the logic flow in that platform. + * + * @param[in] CODE The #WEAVE_ERROR being checked for criticality. + * + * @return true if the error is non-critical; false otherwise. + * + */ +#ifndef WEAVE_CONFIG_IsPlatformErrorNonCritical +#if WEAVE_SYSTEM_CONFIG_USE_LWIP +#define _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) \ + ((CODE) == nl::Weave::System::MapErrorLwIP(ERR_RTE) || \ + (CODE) == nl::Weave::System::MapErrorLwIP(ERR_MEM)) +#else // !WEAVE_SYSTEM_CONFIG_USE_LWIP +#define _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) 0 +#endif // !WEAVE_SYSTEM_CONFIG_USE_LWIP + +#if WEAVE_SYSTEM_CONFIG_USE_SOCKETS +#define _WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) \ + ((CODE) == nl::Weave::System::MapErrorPOSIX(EHOSTUNREACH) || \ + (CODE) == nl::Weave::System::MapErrorPOSIX(ENETUNREACH) || \ + (CODE) == nl::Weave::System::MapErrorPOSIX(EADDRNOTAVAIL) || \ + (CODE) == nl::Weave::System::MapErrorPOSIX(EPIPE)) +#else // !WEAVE_SYSTEM_CONFIG_USE_SOCKETS +#define _WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) 0 +#endif // !WEAVE_SYSTEM_CONFIG_USE_SOCKETS + +#define WEAVE_CONFIG_IsPlatformErrorNonCritical(CODE) \ + (_WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) || \ + _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE)) +#endif // WEAVE_CONFIG_IsPlatformErrorNonCritical + +/** + * @def WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS + * + * @brief + * Enable (1) or disable (0) replacing math functions + * which may not be available in the standard/intrinsic library, + * and hence require special support from the platform. + * + */ +#ifndef WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS +#define WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS 0 +#endif // WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS + +/** + * @def WEAVE_CONFIG_SERIALIZATION_USE_MALLOC + * + * @brief If turned on, then schema event serialization and + * deserialization will use the stdlib implementations of malloc, + * free, and realloc by default (if no other implementations have + * been provided). We will fail at compile time if the stdlib + * implementations are not present. + */ +#ifndef WEAVE_CONFIG_SERIALIZATION_USE_MALLOC +#define WEAVE_CONFIG_SERIALIZATION_USE_MALLOC 0 +#endif + +/** + * @def WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING + * + * @brief Enable debug logging for the serialization/deserialization APIs. + */ +#ifndef WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING +#define WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING 0 +#endif + +/** + * @def WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION + * + * @brief Enable deserialization as well as serialization APIs. We + * make deserialization configurable because it requires some extra + * memory that a highly resource-constrained platform could preserve + * if it doesn't consume WDM events or otherwise has no need to + * deserialize. + */ +#ifndef WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION +#define WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION 1 +#endif + +/** + * @def WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS + * + * @brief Enable debug logging of floats and doubles for the + * serialization/deserialization APIs. Not all platforms + * support these types, and may not compile if there are + * any references to them. Only matters if + * WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING is enabled. + */ +#ifndef WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS +#define WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS 1 +#endif + +/** + * @def WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE + * + * @brief + * The data type used to represent the key of a persistedly-stored + * key/value pair. + */ +#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE +#define WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE const char * +#endif + +/** + * @def WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID + * + * @brief + * The group key message counter persisted storage Id. + * + */ +#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID +#define WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID "EncMsgCntr" +#endif // WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID + +/** + * @def WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH + * + * @brief + * The group key message counter persisted storage epoch. + * + */ +#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH +#define WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH 0x1000 +#endif // WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH + +/** + * @def WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH + * + * @brief The maximum length of the key in a key/value pair + * stored in the platform's persistent storage. + */ +#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH +#define WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 16 +#endif + +/** + * @def WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH + * + * @brief The maximum length of the value in a key/value pair + * stored in the platform's persistent storage. + */ +#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH +#define WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH 256 +#endif + +/** + * @def WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING + * + * @brief Enable debug logging for the PersistedCounter API. + */ +#ifndef WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING +#define WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING 0 +#endif + +/** + * @def WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS + * + * @brief Enable verbose debug logging for the EventLogging API. + * This setting is incompatible with platforms that route console + * logs into event logging, as it would result in circular logic. + */ +#ifndef WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS +#define WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS 1 +#endif + +/** + * @def WEAVE_CONFIG_ENABLE_ARG_PARSER + * + * @brief Enable support functions for parsing command-line arguments + */ +#ifndef WEAVE_CONFIG_ENABLE_ARG_PARSER +#define WEAVE_CONFIG_ENABLE_ARG_PARSER 0 +#endif + +/** + * @def WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK + * + * @brief Enable santiy checking of command-line argument definitions. + */ +#ifndef WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK +#define WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK 1 +#endif + +/** + * @def WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT + * + * @brief + * The amount of time (in milliseconds) which the service is given + * to respond to a pair device to account request. + */ +#ifndef WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT +#define WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT 60000 +#endif + +/** + * @def WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE + * + * @brief + * Enable (1) or disable (0) support for the depricated + * version of AddNetwork() message in the Network Provisioning + * profile. + * This option should be enabled to support pairing with Nest + * legacy devices that don't have latest SW. + * + */ +#ifndef WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE +#define WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE 1 +#endif // WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE + +/** + * @def WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE + * + * @brief + * Enable (1) or disable (0) the exclusive use of the depricated + * version of AddNetwork() message in the Network Provisioning + * profile. + * This option should be enabled when exclusively pairing with Nest + * legacy devices that don't have latest SW. + * This option requires that + * WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE is enabled. + * + */ +#ifndef WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE +#define WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE 0 +#endif // WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE + +/** + * @def WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN + * + * @brief Enable the Service Provisioning profile message + * for notification of successful in-field joining of the + * Weave fabric. + */ +#ifndef WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN +#define WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN 0 +#endif // WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN + +/** + * @def WEAVE_NON_PRODUCTION_MARKER + * + * @brief Defines the name of a mark symbol whose presence signals that the Weave code + * includes development/testing features that should never be used in production contexts. + */ +#ifndef WEAVE_NON_PRODUCTION_MARKER +#if (WEAVE_CONFIG_SECURITY_TEST_MODE || \ + WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY || \ + WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY || \ + (!WEAVE_CONFIG_REQUIRE_AUTH) || \ + WEAVE_FUZZING_ENABLED) +#define WEAVE_NON_PRODUCTION_MARKER WARNING__DO_NOT_SHIP__CONTAINS_NON_PRODUCTION_WEAVE_CODE +#endif +#endif + +#ifdef WEAVE_NON_PRODUCTION_MARKER +extern const char WEAVE_NON_PRODUCTION_MARKER[]; +#endif + +// clang-format on + +#endif /* WEAVE_CONFIG_H_ */ diff --git a/src/lib/core/WeaveCore.h b/src/lib/core/WeaveCore.h new file mode 100644 index 00000000000000..2297a0cb343c4f --- /dev/null +++ b/src/lib/core/WeaveCore.h @@ -0,0 +1,64 @@ +/* + * + * Copyright (c) 2013-2017 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. + */ + +/** + * @file + * This file is the master "umbrella" include file for the core + * Weave library. + * + */ + +#ifndef WEAVECORE_H_ +#define WEAVECORE_H_ + +#include + +#include + +#if CONFIG_NETWORK_LAYER_BLE +#include +#endif // CONFIG_NETWORK_LAYER_BLE + +#include + +//Currently only used on Sapphire +#define NL_WEAVE_CORE_IDENTITY "weave-core" +#define NL_WEAVE_CORE_PREFIX NL_WEAVE_CORE_IDENTITY ": " + +namespace nl { +namespace Weave { + +#if CONFIG_NETWORK_LAYER_BLE +using namespace ::nl::Ble; +#endif // CONFIG_NETWORK_LAYER_BLE + +using namespace ::nl::Inet; + +} +} + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* WEAVECORE_H_ */ diff --git a/src/lib/core/WeaveError.cpp b/src/lib/core/WeaveError.cpp new file mode 100644 index 00000000000000..b5237d047fcc7c --- /dev/null +++ b/src/lib/core/WeaveError.cpp @@ -0,0 +1,240 @@ +/* + * + * Copyright (c) 2019 Google LLC. + * 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. + */ + +/** + * @file + * This file contains functions for working with Weave errors. + */ + +#include + +namespace nl { +namespace Weave { + +/** + * Given a Weave error, returns a human-readable NULL-terminated C string + * describing the error. + * + * @param[in] buf Buffer into which the error string will be placed. + * @param[in] bufSize Size of the supplied buffer in bytes. + * @param[in] err The error to be described. + * + * @return true If a description string was written into the supplied buffer. + * @return false If the supplied error was not a Weave error. + * + */ +bool FormatWeaveError(char * buf, uint16_t bufSize, int32_t err) +{ + const char * desc = NULL; + + if (err < WEAVE_ERROR_MIN || err > WEAVE_ERROR_MAX) + { + return false; + } + +#if !WEAVE_CONFIG_SHORT_ERROR_STR + switch (err) + { + case WEAVE_ERROR_TOO_MANY_CONNECTIONS : desc = "Too many connections"; break; + case WEAVE_ERROR_SENDING_BLOCKED : desc = "Sending blocked"; break; + case WEAVE_ERROR_CONNECTION_ABORTED : desc = "Connection aborted"; break; + case WEAVE_ERROR_INCORRECT_STATE : desc = "Incorrect state"; break; + case WEAVE_ERROR_MESSAGE_TOO_LONG : desc = "Message too long"; break; + case WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION : desc = "Unsupported exchange version"; break; + case WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS : desc = "Too many unsolicited message handlers"; break; + case WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER : desc = "No unsolicited message handler"; break; + case WEAVE_ERROR_NO_CONNECTION_HANDLER : desc = "No connection handler"; break; + case WEAVE_ERROR_TOO_MANY_PEER_NODES : desc = "Too many peer nodes"; break; + case WEAVE_ERROR_NO_MEMORY : desc = "No memory"; break; + case WEAVE_ERROR_NO_MESSAGE_HANDLER : desc = "No message handler"; break; + case WEAVE_ERROR_MESSAGE_INCOMPLETE : desc = "Message incomplete"; break; + case WEAVE_ERROR_DATA_NOT_ALIGNED : desc = "Data not aligned"; break; + case WEAVE_ERROR_UNKNOWN_KEY_TYPE : desc = "Unknown key type"; break; + case WEAVE_ERROR_KEY_NOT_FOUND : desc = "Key not found"; break; + case WEAVE_ERROR_WRONG_ENCRYPTION_TYPE : desc = "Wrong encryption type"; break; + case WEAVE_ERROR_TOO_MANY_KEYS : desc = "Too many keys"; break; + case WEAVE_ERROR_INTEGRITY_CHECK_FAILED : desc = "Integrity check failed"; break; + case WEAVE_ERROR_INVALID_SIGNATURE : desc = "Invalid signature"; break; + case WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION : desc = "Unsupported message version"; break; + case WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE : desc = "Unsupported encryption type"; break; + case WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE : desc = "Unsupported signature type"; break; + case WEAVE_ERROR_INVALID_MESSAGE_LENGTH : desc = "Invalid message length"; break; + case WEAVE_ERROR_BUFFER_TOO_SMALL : desc = "Buffer too small"; break; + case WEAVE_ERROR_DUPLICATE_KEY_ID : desc = "Duplicate key id"; break; + case WEAVE_ERROR_WRONG_KEY_TYPE : desc = "Wrong key type"; break; + case WEAVE_ERROR_WELL_UNINITIALIZED : desc = "Well uninitialized"; break; + case WEAVE_ERROR_WELL_EMPTY : desc = "Well empty"; break; + case WEAVE_ERROR_INVALID_STRING_LENGTH : desc = "Invalid string length"; break; + case WEAVE_ERROR_INVALID_LIST_LENGTH : desc = "invalid list length"; break; + case WEAVE_ERROR_INVALID_INTEGRITY_TYPE : desc = "Invalid integrity type"; break; + case WEAVE_END_OF_TLV : desc = "End of TLV"; break; + case WEAVE_ERROR_TLV_UNDERRUN : desc = "TLV underrun"; break; + case WEAVE_ERROR_INVALID_TLV_ELEMENT : desc = "Invalid TLV element"; break; + case WEAVE_ERROR_INVALID_TLV_TAG : desc = "Invalid TLV tag"; break; + case WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG : desc = "Unknown implicit TLV tag"; break; + case WEAVE_ERROR_WRONG_TLV_TYPE : desc = "Wrong TLV type"; break; + case WEAVE_ERROR_TLV_CONTAINER_OPEN : desc = "TLV container open"; break; + case WEAVE_ERROR_INVALID_TRANSFER_MODE : desc = "Invalid transfer mode"; break; + case WEAVE_ERROR_INVALID_PROFILE_ID : desc = "Invalid profile id"; break; + case WEAVE_ERROR_INVALID_MESSAGE_TYPE : desc = "Invalid message type"; break; + case WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT : desc = "Unexpected TLV element"; break; + case WEAVE_ERROR_STATUS_REPORT_RECEIVED : desc = "Status Report received from peer"; break; + case WEAVE_ERROR_NOT_IMPLEMENTED : desc = "Not Implemented"; break; + case WEAVE_ERROR_INVALID_ADDRESS : desc = "Invalid address"; break; + case WEAVE_ERROR_INVALID_ARGUMENT : desc = "Invalid argument"; break; + case WEAVE_ERROR_TLV_TAG_NOT_FOUND : desc = "TLV tag not found"; break; + + case WEAVE_ERROR_INVALID_PATH_LIST : desc = "Invalid TLV path list"; break; + case WEAVE_ERROR_INVALID_DATA_LIST : desc = "Invalid TLV data list"; break; + case WEAVE_ERROR_TRANSACTION_CANCELED : desc = "Transaction canceled"; break; + case WEAVE_ERROR_LISTENER_ALREADY_STARTED : desc = "Listener already started"; break; + case WEAVE_ERROR_LISTENER_ALREADY_STOPPED : desc = "Listener already stopped"; break; + case WEAVE_ERROR_UNKNOWN_TOPIC : desc = "Unknown Topic"; break; + + case WEAVE_ERROR_TIMEOUT : desc = "Timeout"; break; + case WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR : desc = "Invalid device descriptor"; break; + case WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION : desc = "Unsupported device descriptor version"; break; + case WEAVE_END_OF_INPUT : desc = "End of input"; break; + case WEAVE_ERROR_RATE_LIMIT_EXCEEDED : desc = "Rate limit exceeded"; break; + case WEAVE_ERROR_SECURITY_MANAGER_BUSY : desc = "Security manager busy"; break; + case WEAVE_ERROR_INVALID_PASE_PARAMETER : desc = "Invalid PASE parameter"; break; + case WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 : desc = "PASE supports only Config1"; break; + case WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS : desc = "No supported PASE configurations in common"; break; + case WEAVE_ERROR_INVALID_PASE_CONFIGURATION : desc = "Invalid PASE configuration"; break; + case WEAVE_ERROR_KEY_CONFIRMATION_FAILED : desc = "Key confirmation failed"; break; + case WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY : desc = "Invalid use of session key"; break; + case WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY : desc = "Connection closed unexpectedly"; break; + case WEAVE_ERROR_MISSING_TLV_ELEMENT : desc = "Missing TLV element"; break; + case WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE : desc = "Random data unavailable"; break; + case WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT : desc = "Unsupported type in host/port list"; break; + case WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX : desc = "Invalid suffix index in host/port list"; break; + case WEAVE_ERROR_HOST_PORT_LIST_EMPTY : desc = "Host/port empty"; break; + case WEAVE_ERROR_UNSUPPORTED_AUTH_MODE : desc = "Unsupported authentication mode"; break; + + case WEAVE_ERROR_INVALID_SERVICE_EP : desc = "Invalid service endpoint"; break; + case WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE : desc = "Invalid directory entry type"; break; + case WEAVE_ERROR_FORCED_RESET : desc = "Service manager forced reset"; break; + case WEAVE_ERROR_NO_ENDPOINT : desc = "No endpoint was available to send the message"; break; + case WEAVE_ERROR_INVALID_DESTINATION_NODE_ID : desc = "Invalid destination node id"; break; + case WEAVE_ERROR_NOT_CONNECTED : desc = "Not connected"; break; + case WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE : desc = "No SW update available"; break; + + case WEAVE_ERROR_CA_CERT_NOT_FOUND : desc = "CA certificate not found"; break; + case WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED : desc = "Certificate path length constraint exceeded"; break; + case WEAVE_ERROR_CERT_PATH_TOO_LONG : desc = "Certificate path too long"; break; + case WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED : desc = "Requested certificate usage is not allowed"; break; + case WEAVE_ERROR_CERT_EXPIRED : desc = "Certificate expired"; break; + case WEAVE_ERROR_CERT_NOT_VALID_YET : desc = "Certificate not yet valid"; break; + case WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT : desc = "Unsupported certificate format"; break; + case WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE : desc = "Unsupported elliptic curve"; break; + case WEAVE_CERT_NOT_USED : desc = "Certificate was not used in chain validation"; break; + case WEAVE_ERROR_CERT_NOT_FOUND : desc = "Certificate not found"; break; + case WEAVE_ERROR_INVALID_CASE_PARAMETER : desc = "Invalid CASE parameter"; break; + case WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION : desc = "Unsupported CASE configuration"; break; + case WEAVE_ERROR_CERT_LOAD_FAIL : desc = "Unable to load certificate"; break; + case WEAVE_ERROR_CERT_NOT_TRUSTED : desc = "Certificate not trusted"; break; + case WEAVE_ERROR_INVALID_ACCESS_TOKEN : desc = "Invalid access token"; break; + case WEAVE_ERROR_WRONG_CERT_SUBJECT : desc = "Wrong certificate subject"; break; + case WEAVE_ERROR_WRONG_NODE_ID : desc = "Wrong node ID"; break; + case WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT : desc = "Connection accepted on wrong port"; break; + case WEAVE_ERROR_CALLBACK_REPLACED : desc = "Application callback replaced"; break; + case WEAVE_ERROR_NO_CASE_AUTH_DELEGATE : desc = "No CASE auth delegate set"; break; + case WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT : desc = "Timeout attempting to locate device"; break; + case WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT : desc = "Timeout connecting to device"; break; + case WEAVE_ERROR_DEVICE_AUTH_TIMEOUT : desc = "Timeout authenticating device"; break; + case WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED : desc = "Message not acknowledged after max retries"; break; + case WEAVE_ERROR_RETRANS_TABLE_FULL : desc = "Retransmit Table is already full"; break; + case WEAVE_ERROR_INVALID_ACK_ID : desc = "Invalid Acknowledgment Id"; break; + case WEAVE_ERROR_SEND_THROTTLED : desc = "Sending to peer is throttled on this Exchange"; break; + case WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE : desc = "Message version not supported by current exchange context"; break; + case WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE : desc = "Required feature not supported by this configuration"; break; + case WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR : desc = "Unsolicited msg with originator bit clear"; break; + case WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION : desc = "Unsupported Tunnel version"; break; + case WEAVE_ERROR_INVALID_FABRIC_ID : desc = "Invalid Fabric Id"; break; + case WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL : desc = "Local tunnel nexthop table full"; break; + case WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL : desc = "Service queue full"; break; + case WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND : desc = "Shortcut Tunnel peer entry not found"; break; + case WEAVE_ERROR_TUNNEL_FORCE_ABORT : desc = "Forced Tunnel Abort."; break; + case WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED : desc = "DRBG entropy source failed to generate entropy data"; break; + case WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE : desc = "No TAKE auth delegate set"; break; + case WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED : desc = "TAKE requires a reconfigure"; break; + case WEAVE_ERROR_TAKE_REAUTH_POSSIBLE : desc = "TAKE can do a reauthentication"; break; + case WEAVE_ERROR_INVALID_TAKE_PARAMETER : desc = "TAKE received an invalid parameter"; break; + case WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION : desc = "TAKE Unsupported configuration"; break; + case WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED : desc = "TAKE token identification failed"; break; + case WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE : desc = "Invalid Token Pairing Bundle"; break; + case WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION : desc = "Unsupported Token Pairing Bundle version"; break; + case WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER : desc = "Key not found error code received from peer"; break; + case WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER : desc = "Wrong encryption type error code received from peer"; break; + case WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER : desc = "Unknown key type error code received from peer"; break; + case WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER : desc = "Invalid use of session key error code received from peer"; break; + case WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER : desc = "Unsupported encryption type error code received from peer"; break; + case WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER : desc = "Internal key error code received from peer"; break; + case WEAVE_ERROR_INVALID_KEY_ID : desc = "Invalid key identifier"; break; + case WEAVE_ERROR_INVALID_TIME : desc = "Valid time value is not available"; break; + case WEAVE_ERROR_LOCKING_FAILURE : desc = "Failure to lock/unlock OS-provided lock"; break; + case WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG : desc = "Unsupported passcode encryption configuration."; break; + case WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED : desc = "Passcode authentication failed."; break; + case WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED : desc = "Passcode fingerprint failed."; break; + case WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL : desc = "Element requested is null."; break; + case WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM : desc = "Certificate not signed with required signature algorithm"; break; + case WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM : desc = "Weave signature not signed with required signature algorithm"; break; + case WEAVE_ERROR_WDM_SCHEMA_MISMATCH : desc = "Schema mismatch in WDM."; break; + case WEAVE_ERROR_INVALID_INTEGER_VALUE : desc = "Invalid integer value."; break; + case WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS : desc = "Too many CASE reconfigurations were received."; break; + case WEAVE_ERROR_INVALID_MESSAGE_FLAG : desc = "Invalid message flag."; break; + case WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED : desc = "Key export protocol required to reconfigure."; break; + case WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS : desc = "No supported key export protocol configurations in common"; break; + case WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION : desc = "Invalid key export protocol configuration"; break; + case WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE : desc = "No key export protocol delegate set"; break; + case WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST : desc = "Unauthorized key export request"; break; + case WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE : desc = "Unauthorized key export response"; break; + case WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED : desc = "Exported key authentication failed"; break; + case WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES : desc = "Too many shared session end nodes"; break; + case WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT : desc = "Malformed WDM DataElement"; break; + case WEAVE_ERROR_WRONG_CERT_TYPE : desc = "Wrong certificate type"; break; + case WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED : desc = "Default event handler not called"; break; + case WEAVE_ERROR_PERSISTED_STORAGE_FAIL : desc = "Persisted storage failed"; break; + case WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND : desc = "Value not found in the persisted storage"; break; + case WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED : desc = "String context already registered"; break; + case WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED : desc = "String context not registered"; break; + case WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION : desc = "Incompatible data schema version"; break; + case WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED : desc = "Restricted Routing: Border Routing disabled"; break; + case WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED : desc = "The Reset reconnect timer is already armed"; break; + case WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION : desc = "Update Required Version mismatch"; break; + case WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT : desc = "Status Element in WDM update is malformed"; break; + case WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL : desc = "The WDM Subscriptionless Notify is partial"; break; + case WEAVE_ERROR_ACCESS_DENIED : desc = "The Weave message is not granted access"; break; + case WEAVE_ERROR_UNKNOWN_RESOURCE_ID : desc = "Unknown resource ID"; break; + case WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE : desc = "Malformed WDM Update response"; break; + case WEAVE_ERROR_WDM_VERSION_MISMATCH : desc = "The conditional update of a WDM path failed for a version mismatch"; break; + case WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS : desc = "A potential data loss was detected in a WDM Trait Instance"; break; + case WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE : desc = "Nest Legacy device doesn't support standalone Thread network creation"; break; + case WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY : desc = "The Trait Instance is already being updated with a different conditionality"; break; + case WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT : desc = "The local data does not match any known version of the Trait Instance"; break; + case WEAVE_ERROR_WDM_PATH_STORE_FULL : desc = "A WDM TraitPath store is full"; break; + } +#endif // !WEAVE_CONFIG_SHORT_ERROR_STR + + FormatError(buf, bufSize, "Weave", err, desc); + + return true; +} + +} // namespace Weave +} // namespace nl diff --git a/src/lib/core/WeaveError.h b/src/lib/core/WeaveError.h new file mode 100644 index 00000000000000..35f99827f59a1c --- /dev/null +++ b/src/lib/core/WeaveError.h @@ -0,0 +1,1750 @@ +/* + * + * Copyright (c) 2013-2017 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. + */ + +/** + * @file + * This file defines error constants for the Nest Weave core + * subsystem. + * + * Error types, ranges, and mappings overrides may be made by + * defining the appropriate WEAVE_CONFIG_* or _WEAVE_CONFIG_* + * macros. + * + * NOTE WELL: On some platforms, this header is included by C-language programs. + * + */ + +#ifndef WEAVE_ERROR_H +#define WEAVE_ERROR_H + +#include "WeaveConfig.h" +// clang-format off + +/** + * @def WEAVE_NO_ERROR + * + * @brief + * This defines the Weave error code for success or no error. + * This value may be configured via #WEAVE_CONFIG_NO_ERROR." + * + */ +#define WEAVE_NO_ERROR WEAVE_CONFIG_NO_ERROR + +/** + * @def WEAVE_ERROR_MIN + * + * @brief + * This defines the bottom or minimum Weave error number range. + * This value may be configured via #WEAVE_CONFIG_ERROR_MIN. + * + */ +#define WEAVE_ERROR_MIN WEAVE_CONFIG_ERROR_MIN + +/** + * @def WEAVE_ERROR_MAX + * + * @brief + * This defines the top or maximum Weave error number range. + * This value may be configured via #WEAVE_CONFIG_ERROR_MAX. + * + */ +#define WEAVE_ERROR_MAX WEAVE_CONFIG_ERROR_MAX + +/** + * @def _WEAVE_ERROR(e) + * + * @brief + * This defines a mapping function for Weave errors that allows + * mapping such errors into a platform- or system-specific range. + * This function may be configured via #_WEAVE_CONFIG_ERROR(e). + * + * @param[in] e The Weave error to map. + * + * @return The mapped Weave error. + * + * + */ +#define _WEAVE_ERROR(e) _WEAVE_CONFIG_ERROR(e) + +/** + * The basic type for all Weave errors. + * + * @brief + * This is defined to a platform- or system-specific type. + * + */ +typedef WEAVE_CONFIG_ERROR_TYPE WEAVE_ERROR; + +/** + * @name Error Definitions + * + * @{ + */ + +/** + * @def WEAVE_ERROR_TOO_MANY_CONNECTIONS + * + * @brief + * The attempt to allocate a connection object failed because too many + * connections exist. + * + */ +#define WEAVE_ERROR_TOO_MANY_CONNECTIONS _WEAVE_ERROR(0) + +/** + * @def WEAVE_ERROR_SENDING_BLOCKED + * + * @brief + * A message exceeds the sent limit. + * + */ +#define WEAVE_ERROR_SENDING_BLOCKED _WEAVE_ERROR(1) + +/** + * @def WEAVE_ERROR_CONNECTION_ABORTED + * + * @brief + * A connection has been aborted. + * + */ +#define WEAVE_ERROR_CONNECTION_ABORTED _WEAVE_ERROR(2) + +/** + * @def WEAVE_ERROR_INCORRECT_STATE + * + * @brief + * An unexpected state was encountered. + * + */ +#define WEAVE_ERROR_INCORRECT_STATE _WEAVE_ERROR(3) + +/** + * @def WEAVE_ERROR_MESSAGE_TOO_LONG + * + * @brief + * A message is too long. + * + */ +#define WEAVE_ERROR_MESSAGE_TOO_LONG _WEAVE_ERROR(4) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION + * + * @brief + * An exchange version is not supported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION _WEAVE_ERROR(5) + +/** + * @def WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS + * + * @brief + * The attempt to register an unsolicited message handler failed because the + * unsolicited message handler pool is full. + * + */ +#define WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS _WEAVE_ERROR(6) + +/** + * @def WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER + * + * @brief + * The attempt to unregister an unsolicited message handler failed because + * the target handler was not found in the unsolicited message handler pool. + * + */ +#define WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER _WEAVE_ERROR(7) + +/** + * @def WEAVE_ERROR_NO_CONNECTION_HANDLER + * + * @brief + * No callback has been registered for handling a connection. + * + */ +#define WEAVE_ERROR_NO_CONNECTION_HANDLER _WEAVE_ERROR(8) + +/** + * @def WEAVE_ERROR_TOO_MANY_PEER_NODES + * + * @brief + * The number of peer nodes exceeds the maximum limit of a local node. + * + */ +#define WEAVE_ERROR_TOO_MANY_PEER_NODES _WEAVE_ERROR(9) + +/** + * @def WEAVE_ERROR_NO_MEMORY + * + * @brief + * The attempt to allocate a buffer or object failed due to a lack of memory. + * + */ +#define WEAVE_ERROR_NO_MEMORY _WEAVE_ERROR(11) + +/** + * @def WEAVE_ERROR_NO_MESSAGE_HANDLER + * + * @brief + * No callback has been registered for handling a message. + * + */ +#define WEAVE_ERROR_NO_MESSAGE_HANDLER _WEAVE_ERROR(12) + +/** + * @def WEAVE_ERROR_MESSAGE_INCOMPLETE + * + * @brief + * A message is incomplete. + * + */ +#define WEAVE_ERROR_MESSAGE_INCOMPLETE _WEAVE_ERROR(13) + +/** + * @def WEAVE_ERROR_DATA_NOT_ALIGNED + * + * @brief + * The data is not aligned. + * + */ +#define WEAVE_ERROR_DATA_NOT_ALIGNED _WEAVE_ERROR(14) + +/** + * @def WEAVE_ERROR_UNKNOWN_KEY_TYPE + * + * @brief + * The encryption key type is unknown. + * + */ +#define WEAVE_ERROR_UNKNOWN_KEY_TYPE _WEAVE_ERROR(15) + +/** + * @def WEAVE_ERROR_KEY_NOT_FOUND + * + * @brief + * The encryption key is not found. + * + */ +#define WEAVE_ERROR_KEY_NOT_FOUND _WEAVE_ERROR(16) + +/** + * @def WEAVE_ERROR_WRONG_ENCRYPTION_TYPE + * + * @brief + * The encryption type is incorrect for the specified key. + * + */ +#define WEAVE_ERROR_WRONG_ENCRYPTION_TYPE _WEAVE_ERROR(17) + +/** + * @def WEAVE_ERROR_TOO_MANY_KEYS + * + * @brief + * The attempt to allocate a key failed because the number of active keys + * exceeds the maximum limit. + * + */ +#define WEAVE_ERROR_TOO_MANY_KEYS _WEAVE_ERROR(18) + +/** + * @def WEAVE_ERROR_INTEGRITY_CHECK_FAILED + * + * @brief + * The integrity check in the message does not match the expected integrity + * check. + * + */ +#define WEAVE_ERROR_INTEGRITY_CHECK_FAILED _WEAVE_ERROR(19) + +/** + * @def WEAVE_ERROR_INVALID_SIGNATURE + * + * @brief + * Invalid signature. + * + */ +#define WEAVE_ERROR_INVALID_SIGNATURE _WEAVE_ERROR(20) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION + * + * @brief + * A message version is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION _WEAVE_ERROR(21) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE + * + * @brief + * An encryption type is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE _WEAVE_ERROR(22) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE + * + * @brief + * A signature type is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE _WEAVE_ERROR(23) + +/** + * @def WEAVE_ERROR_INVALID_MESSAGE_LENGTH + * + * @brief + * A message length is invalid. + * + */ +#define WEAVE_ERROR_INVALID_MESSAGE_LENGTH _WEAVE_ERROR(24) + +/** + * @def WEAVE_ERROR_BUFFER_TOO_SMALL + * + * @brief + * A buffer is too small. + * + */ +#define WEAVE_ERROR_BUFFER_TOO_SMALL _WEAVE_ERROR(25) + +/** + * @def WEAVE_ERROR_DUPLICATE_KEY_ID + * + * @brief + * A key id is duplicate. + * + */ +#define WEAVE_ERROR_DUPLICATE_KEY_ID _WEAVE_ERROR(26) + +/** + * @def WEAVE_ERROR_WRONG_KEY_TYPE + * + * @brief + * A key type does not match the expected key type. + * + */ +#define WEAVE_ERROR_WRONG_KEY_TYPE _WEAVE_ERROR(27) + +/** + * @def WEAVE_ERROR_WELL_UNINITIALIZED + * + * @brief + * A requested object is uninitialized. + * + */ +#define WEAVE_ERROR_WELL_UNINITIALIZED _WEAVE_ERROR(28) + +/** + * @def WEAVE_ERROR_WELL_EMPTY + * + * @brief + * A requested object is empty. + * + */ +#define WEAVE_ERROR_WELL_EMPTY _WEAVE_ERROR(29) + +/** + * @def WEAVE_ERROR_INVALID_STRING_LENGTH + * + * @brief + * A string length is invalid. + * + */ +#define WEAVE_ERROR_INVALID_STRING_LENGTH _WEAVE_ERROR(30) + +/** + * @def WEAVE_ERROR_INVALID_LIST_LENGTH + * + * @brief + * A list length is invalid. + * + */ +#define WEAVE_ERROR_INVALID_LIST_LENGTH _WEAVE_ERROR(31) + +/** + * @def WEAVE_ERROR_INVALID_INTEGRITY_TYPE + * + * @brief + * An integrity type is invalid. + * + */ +#define WEAVE_ERROR_INVALID_INTEGRITY_TYPE _WEAVE_ERROR(32) + +/** + * @def WEAVE_END_OF_TLV + * + * @brief + * The end of a TLV encoding, + * or the end of a TLV container element has been reached. + * + */ +#define WEAVE_END_OF_TLV _WEAVE_ERROR(33) + +/** + * @def WEAVE_ERROR_TLV_UNDERRUN + * + * @brief + * The TLV encoding ended prematurely. + * + */ +#define WEAVE_ERROR_TLV_UNDERRUN _WEAVE_ERROR(34) + +/** + * @def WEAVE_ERROR_INVALID_TLV_ELEMENT + * + * @brief + * A TLV element is invalid. + * + */ +#define WEAVE_ERROR_INVALID_TLV_ELEMENT _WEAVE_ERROR(35) + +/** + * @def WEAVE_ERROR_INVALID_TLV_TAG + * + * @brief + * A TLV tag is invalid. + * + */ +#define WEAVE_ERROR_INVALID_TLV_TAG _WEAVE_ERROR(36) + +/** + * @def WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG + * + * @brief + * An implicitly encoded TLV tag was encountered, + * but an implicit profile id has not been defined. + * + */ +#define WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG _WEAVE_ERROR(37) + +/** + * @def WEAVE_ERROR_WRONG_TLV_TYPE + * + * @brief + * A TLV type is wrong. + * + */ +#define WEAVE_ERROR_WRONG_TLV_TYPE _WEAVE_ERROR(38) + +/** + * @def WEAVE_ERROR_TLV_CONTAINER_OPEN + * + * @brief + * A TLV container is unexpectedly open. + * + */ +#define WEAVE_ERROR_TLV_CONTAINER_OPEN _WEAVE_ERROR(39) + +/** + * @def WEAVE_ERROR_INVALID_TRANSFER_MODE + * + * @brief + * A transfer mode is invalid. + * + */ +#define WEAVE_ERROR_INVALID_TRANSFER_MODE _WEAVE_ERROR(40) + +/** + * @def WEAVE_ERROR_INVALID_PROFILE_ID + * + * @brief + * A profile id is invalid. + * + */ +#define WEAVE_ERROR_INVALID_PROFILE_ID _WEAVE_ERROR(41) + +/** + * @def WEAVE_ERROR_INVALID_MESSAGE_TYPE + * + * @brief + * A message type is invalid. + * + */ +#define WEAVE_ERROR_INVALID_MESSAGE_TYPE _WEAVE_ERROR(42) + +/** + * @def WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT + * + * @brief + * An unexpected TLV element was encountered. + * + */ +#define WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT _WEAVE_ERROR(43) + +/** + * @def WEAVE_ERROR_STATUS_REPORT_RECEIVED + * + * @brief + * A status report is received from a peer node. + * + */ +#define WEAVE_ERROR_STATUS_REPORT_RECEIVED _WEAVE_ERROR(44) + +/** + * @def WEAVE_ERROR_NOT_IMPLEMENTED + * + * @brief + * A requested function or feature is not implemented. + * + */ +#define WEAVE_ERROR_NOT_IMPLEMENTED _WEAVE_ERROR(45) + +/** + * @def WEAVE_ERROR_INVALID_ADDRESS + * + * @brief + * An address is invalid. + * + */ +#define WEAVE_ERROR_INVALID_ADDRESS _WEAVE_ERROR(46) + +/** + * @def WEAVE_ERROR_INVALID_ARGUMENT + * + * @brief + * An argument is invalid. + * + */ +#define WEAVE_ERROR_INVALID_ARGUMENT _WEAVE_ERROR(47) + +/** + * @def WEAVE_ERROR_INVALID_PATH_LIST + * + * @brief + * A TLV path list is invalid. + * + */ +#define WEAVE_ERROR_INVALID_PATH_LIST _WEAVE_ERROR(48) + +/** + * @def WEAVE_ERROR_INVALID_DATA_LIST + * + * @brief + * A TLV data list is invalid. + * + */ +#define WEAVE_ERROR_INVALID_DATA_LIST _WEAVE_ERROR(49) + +/** + * @def WEAVE_ERROR_TIMEOUT + * + * @brief + * A request timed out. + * + */ +#define WEAVE_ERROR_TIMEOUT _WEAVE_ERROR(50) + +/** + * @def WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR + * + * @brief + * A device descriptor is invalid. + * + */ +#define WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR _WEAVE_ERROR(51) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION + * + * @brief + * A device descriptor version is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION _WEAVE_ERROR(52) + +/** + * @def WEAVE_END_OF_INPUT + * + * @brief + * An input ended. + * + */ +#define WEAVE_END_OF_INPUT _WEAVE_ERROR(53) + +/** + * @def WEAVE_ERROR_RATE_LIMIT_EXCEEDED + * + * @brief + * A rate limit is exceeded. + * + */ +#define WEAVE_ERROR_RATE_LIMIT_EXCEEDED _WEAVE_ERROR(54) + +/** + * @def WEAVE_ERROR_SECURITY_MANAGER_BUSY + * + * @brief + * A security manager is busy. + * + */ +#define WEAVE_ERROR_SECURITY_MANAGER_BUSY _WEAVE_ERROR(55) + +/** + * @def WEAVE_ERROR_INVALID_PASE_PARAMETER + * + * @brief + * A PASE parameter is invalid. + * + */ +#define WEAVE_ERROR_INVALID_PASE_PARAMETER _WEAVE_ERROR(56) + +/** + * @def WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 + * + * @brief + * PASE supports only config1. + * + */ +#define WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 _WEAVE_ERROR(57) + +/** + * @def WEAVE_ERROR_KEY_CONFIRMATION_FAILED + * + * @brief + * A key confirmation failed. + * + */ +#define WEAVE_ERROR_KEY_CONFIRMATION_FAILED _WEAVE_ERROR(58) + +/** + * @def WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY + * + * @brief + * A use of session key is invalid. + * + */ +#define WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY _WEAVE_ERROR(59) + +/** + * @def WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY + * + * @brief + * A connection is closed unexpectedly. + * + */ +#define WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY _WEAVE_ERROR(60) + +/** + * @def WEAVE_ERROR_MISSING_TLV_ELEMENT + * + * @brief + * A TLV element is missing. + * + */ +#define WEAVE_ERROR_MISSING_TLV_ELEMENT _WEAVE_ERROR(61) + +/** + * @def WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE + * + * @brief + * Secure random data is not available. + * + */ +#define WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE _WEAVE_ERROR(62) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT + * + * @brief + * A type in host/port list is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT _WEAVE_ERROR(63) + +/** + * @def WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX + * + * @brief + * A suffix index in host/port list is invalid. + * + */ +#define WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX _WEAVE_ERROR(64) + +/** + * @def WEAVE_ERROR_HOST_PORT_LIST_EMPTY + * + * @brief + * A host/port list is empty. + * + */ +#define WEAVE_ERROR_HOST_PORT_LIST_EMPTY _WEAVE_ERROR(65) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_AUTH_MODE + * + * @brief + * An authentication mode is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_AUTH_MODE _WEAVE_ERROR(66) + +/** + * @def WEAVE_ERROR_INVALID_SERVICE_EP + * + * @brief + * A service endpoint is invalid. + * + */ +#define WEAVE_ERROR_INVALID_SERVICE_EP _WEAVE_ERROR(67) + +/** + * @def WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE + * + * @brief + * A directory entry type is unknown. + * + */ +#define WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE _WEAVE_ERROR(68) + +/** + * @def WEAVE_ERROR_FORCED_RESET + * + * @brief + * A service manager is forced to reset. + * + */ +#define WEAVE_ERROR_FORCED_RESET _WEAVE_ERROR(69) + +/** + * @def WEAVE_ERROR_NO_ENDPOINT + * + * @brief + * No endpoint is available. + * + */ +#define WEAVE_ERROR_NO_ENDPOINT _WEAVE_ERROR(70) + +/** + * @def WEAVE_ERROR_INVALID_DESTINATION_NODE_ID + * + * @brief + * A destination node id is invalid. + * + */ +#define WEAVE_ERROR_INVALID_DESTINATION_NODE_ID _WEAVE_ERROR(71) + +/** + * @def WEAVE_ERROR_NOT_CONNECTED + * + * @brief + * The operation cannot be performed because the underlying object is not + * connected. + * + */ +#define WEAVE_ERROR_NOT_CONNECTED _WEAVE_ERROR(72) + +/** + * @def WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE + * + * @brief + * No software update is available. + * + */ +#define WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE _WEAVE_ERROR(73) + +/** + * @def WEAVE_ERROR_CA_CERT_NOT_FOUND + * + * @brief + * CA certificate is not found. + * + */ +#define WEAVE_ERROR_CA_CERT_NOT_FOUND _WEAVE_ERROR(74) + +/** + * @def WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED + * + * @brief + * A certificate path length exceeds the constraint. + * + */ +#define WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED _WEAVE_ERROR(75) + +/** + * @def WEAVE_ERROR_CERT_PATH_TOO_LONG + * + * @brief + * A certificate path is too long. + * + */ +#define WEAVE_ERROR_CERT_PATH_TOO_LONG _WEAVE_ERROR(76) + +/** + * @def WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED + * + * @brief + * A requested certificate usage is not allowed. + * + */ +#define WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED _WEAVE_ERROR(77) + +/** + * @def WEAVE_ERROR_CERT_EXPIRED + * + * @brief + * A certificate expired. + * + */ +#define WEAVE_ERROR_CERT_EXPIRED _WEAVE_ERROR(78) + +/** + * @def WEAVE_ERROR_CERT_NOT_VALID_YET + * + * @brief + * A certificate is not valid yet. + * + */ +#define WEAVE_ERROR_CERT_NOT_VALID_YET _WEAVE_ERROR(79) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT + * + * @brief + * A certificate format is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT _WEAVE_ERROR(80) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE + * + * @brief + * An elliptic curve is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE _WEAVE_ERROR(81) + +/** + * @def WEAVE_CERT_NOT_USED + * + * @brief + * A certificate was not used during the chain validation. + * + */ +#define WEAVE_CERT_NOT_USED _WEAVE_ERROR(82) + +/** + * @def WEAVE_ERROR_CERT_NOT_FOUND + * + * @brief + * A certificate is not found. + * + */ +#define WEAVE_ERROR_CERT_NOT_FOUND _WEAVE_ERROR(83) + +/** + * @def WEAVE_ERROR_INVALID_CASE_PARAMETER + * + * @brief + * A CASE parameter is invalid. + * + */ +#define WEAVE_ERROR_INVALID_CASE_PARAMETER _WEAVE_ERROR(84) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION + * + * @brief + * A CASE configuration is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION _WEAVE_ERROR(85) + +/** + * @def WEAVE_ERROR_CERT_LOAD_FAIL + * + * @brief + * A certificate load failed. + * + */ +#define WEAVE_ERROR_CERT_LOAD_FAIL _WEAVE_ERROR(86) + +/** + * @def WEAVE_ERROR_CERT_NOT_TRUSTED + * + * @brief + * A certificate is not trusted. + * + */ +#define WEAVE_ERROR_CERT_NOT_TRUSTED _WEAVE_ERROR(87) + +/** + * @def WEAVE_ERROR_INVALID_ACCESS_TOKEN + * + * @brief + * An access token is invalid. + * + */ +#define WEAVE_ERROR_INVALID_ACCESS_TOKEN _WEAVE_ERROR(88) + +/** + * @def WEAVE_ERROR_WRONG_CERT_SUBJECT + * + * @brief + * A certificate subject is wrong. + * + */ +#define WEAVE_ERROR_WRONG_CERT_SUBJECT _WEAVE_ERROR(89) + +// deprecated alias +#define WEAVE_ERROR_WRONG_CERTIFICATE_SUBJECT WEAVE_ERROR_WRONG_CERT_SUBJECT + +/** + * @def WEAVE_ERROR_INVALID_PROVISIONING_BUNDLE + * + * @brief + * A provisioning bundle is invalid. + * + */ +#define WEAVE_ERROR_INVALID_PROVISIONING_BUNDLE _WEAVE_ERROR(90) + +/** + * @def WEAVE_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR + * + * @brief + * A provision bundle encountered a decryption error. + * + */ +#define WEAVE_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR _WEAVE_ERROR(91) + +/** + * @def WEAVE_ERROR_WRONG_NODE_ID + * + * @brief + * A node id is wrong. + * + */ +#define WEAVE_ERROR_WRONG_NODE_ID _WEAVE_ERROR(92) + +/** + * @def WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT + * + * @brief + * A connection is accepted on a wrong port. + * + */ +#define WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT _WEAVE_ERROR(93) + +/** + * @def WEAVE_ERROR_CALLBACK_REPLACED + * + * @brief + * An application callback has been replaced. + * + */ +#define WEAVE_ERROR_CALLBACK_REPLACED _WEAVE_ERROR(94) + +/** + * @def WEAVE_ERROR_NO_CASE_AUTH_DELEGATE + * + * @brief + * No CASE authentication delegate is set. + * + */ +#define WEAVE_ERROR_NO_CASE_AUTH_DELEGATE _WEAVE_ERROR(95) + +/** + * @def WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT + * + * @brief + * The attempt to locate device timed out. + * + */ +#define WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT _WEAVE_ERROR(96) + +/** + * @def WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT + * + * @brief + * The attempt to connect device timed out. + * + */ +#define WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT _WEAVE_ERROR(97) + +/** + * @def WEAVE_ERROR_DEVICE_AUTH_TIMEOUT + * + * @brief + * The attempt to authenticate device timed out. + * + */ +#define WEAVE_ERROR_DEVICE_AUTH_TIMEOUT _WEAVE_ERROR(98) + +/** + * @def WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED + * + * @brief + * A message is not acknowledged after max retries. + * + */ +#define WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED _WEAVE_ERROR(99) + +/** + * @def WEAVE_ERROR_RETRANS_TABLE_FULL + * + * @brief + * A retransmission table is already full. + * + */ +#define WEAVE_ERROR_RETRANS_TABLE_FULL _WEAVE_ERROR(100) + +/** + * @def WEAVE_ERROR_INVALID_ACK_ID + * + * @brief + * An acknowledgment id is invalid. + * + */ +#define WEAVE_ERROR_INVALID_ACK_ID _WEAVE_ERROR(101) + +/** + * @def WEAVE_ERROR_SEND_THROTTLED + * + * @brief + * A send is throttled. + * + */ +#define WEAVE_ERROR_SEND_THROTTLED _WEAVE_ERROR(102) + +/** + * @def WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE + * + * @brief + * A message version is not supported by the current exchange context. + * + */ +#define WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE _WEAVE_ERROR(103) + +/** + * @def WEAVE_ERROR_TRANSACTION_CANCELED + * + * @brief + * A transaction is cancelled. + * + */ +#define WEAVE_ERROR_TRANSACTION_CANCELED _WEAVE_ERROR(104) + +/** + * @def WEAVE_ERROR_LISTENER_ALREADY_STARTED + * + * @brief + * A listener has already started. + * + */ +#define WEAVE_ERROR_LISTENER_ALREADY_STARTED _WEAVE_ERROR(105) + +/** + * @def WEAVE_ERROR_LISTENER_ALREADY_STOPPED + * + * @brief + * A listener has already stopped. + * + */ +#define WEAVE_ERROR_LISTENER_ALREADY_STOPPED _WEAVE_ERROR(106) + +/** + * @def WEAVE_ERROR_UNKNOWN_TOPIC + * + * @brief + * A topic ID was unknown to the recipient. + * + */ +#define WEAVE_ERROR_UNKNOWN_TOPIC _WEAVE_ERROR(107) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE + * + * @brief + * A Weave feature is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE _WEAVE_ERROR(108) + +/** + * @def WEAVE_ERROR_PASE_RECONFIGURE_REQUIRED + * + * @brief + * PASE is required to reconfigure. + * + */ +#define WEAVE_ERROR_PASE_RECONFIGURE_REQUIRED _WEAVE_ERROR(109) + +/** + * @def WEAVE_ERROR_INVALID_PASE_CONFIGURATION + * + * @brief + * A PASE configuration is invalid. + * + */ +#define WEAVE_ERROR_INVALID_PASE_CONFIGURATION _WEAVE_ERROR(110) + +/** + * @def WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS + * + * @brief + * No PASE configuration is in common. + * + */ +#define WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS _WEAVE_ERROR(111) + +/** + * @def WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR + * + * @brief + * An unsolicited message with the originator bit clear. + * + */ +#define WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR _WEAVE_ERROR(112) + +/** + * @def WEAVE_ERROR_INVALID_FABRIC_ID + * + * @brief + * A fabric id is invalid. + * + */ +#define WEAVE_ERROR_INVALID_FABRIC_ID _WEAVE_ERROR(113) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION + * + * @brief + * A tunnel version is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION _WEAVE_ERROR(114) + +/** + * @def WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL + * + * @brief + * A tunnel nexthop table is full. + * + */ +#define WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL _WEAVE_ERROR(115) + +/** + * @def WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL + * + * @brief + * A tunnel service queue is full. + * + */ +#define WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL _WEAVE_ERROR(116) + +/** + * @def WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED + * + * @brief + * DRBG entropy source failed to generate entropy data. + * + */ +#define WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED _WEAVE_ERROR(117) + +/** + * @def WEAVE_ERROR_TLV_TAG_NOT_FOUND + * + * @brief + * A specified TLV tag was not found. + * + */ +#define WEAVE_ERROR_TLV_TAG_NOT_FOUND _WEAVE_ERROR(118) + +/** + * @def WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE + * + * @brief + * A token pairing bundle is invalid. + * + */ +#define WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE _WEAVE_ERROR(119) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION + * + * @brief + * A token pairing bundle is invalid. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION _WEAVE_ERROR(120) + +/** + * @def WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE + * + * @brief + * No TAKE authentication delegate is set. + * + */ +#define WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE _WEAVE_ERROR(121) + +/** + * @def WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED + * + * @brief + * TAKE requires a reconfigure. + * + */ +#define WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED _WEAVE_ERROR(122) + +/** + * @def WEAVE_ERROR_TAKE_REAUTH_POSSIBLE + * + * @brief + * TAKE can do a reauthentication. + * + */ +#define WEAVE_ERROR_TAKE_REAUTH_POSSIBLE _WEAVE_ERROR(123) + +/** + * @def WEAVE_ERROR_INVALID_TAKE_PARAMETER + * + * @brief + * Received an invalid TAKE paramter. + * + */ +#define WEAVE_ERROR_INVALID_TAKE_PARAMETER _WEAVE_ERROR(124) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION + * + * @brief + * This configuration is not supported by TAKE. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION _WEAVE_ERROR(125) + +/** + * @def WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED + * + * @brief + * The TAKE Token Identification failed. + * + */ +#define WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED _WEAVE_ERROR(126) + +/** + * @def WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER + * + * @brief + * The encryption key is not found error received from a peer node. + * + */ +#define WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER _WEAVE_ERROR(127) + +/** + * @def WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER + * + * @brief + * The wrong encryption type error received from a peer node. + * + */ +#define WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER _WEAVE_ERROR(128) + +/** + * @def WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER + * + * @brief + * The unknown key type error received from a peer node. + * + */ +#define WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER _WEAVE_ERROR(129) + +/** + * @def WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER + * + * @brief + * The invalid use of session key error received from a peer node. + * + */ +#define WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER _WEAVE_ERROR(130) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER + * + * @brief + * An unsupported encryption type error received from a peer node. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER _WEAVE_ERROR(131) + +/** + * @def WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER + * + * @brief + * The internal key error received from a peer node. + * + */ +#define WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER _WEAVE_ERROR(132) + +/** + * @def WEAVE_ERROR_INVALID_KEY_ID + * + * @brief + * A key id is invalid. + * + */ +#define WEAVE_ERROR_INVALID_KEY_ID _WEAVE_ERROR(133) + +/** + * @def WEAVE_ERROR_INVALID_TIME + * + * @brief + * Time has invalid value. + * + */ +#define WEAVE_ERROR_INVALID_TIME _WEAVE_ERROR(134) + +/** + * @def WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND + * + * @brief + * A tunnel shortcut peer entry not found in the cache. + * + */ +#define WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND _WEAVE_ERROR(135) + +/** + * @def WEAVE_ERROR_LOCKING_FAILURE + * + * @brief + * Failure to acquire or release an OS provided mutex. + * + */ +#define WEAVE_ERROR_LOCKING_FAILURE _WEAVE_ERROR(136) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG + * + * @brief + * A passcode encryption configuration is unsupported. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG _WEAVE_ERROR(137) + +/** + * @def WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED + * + * @brief + * The Weave passcode authentication failed. + * + */ +#define WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED _WEAVE_ERROR(138) + +/** + * @def WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED + * + * @brief + * The Weave passcode fingerprint failed. + * + */ +#define WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED _WEAVE_ERROR(139) + +/** + * @def WEAVE_ERROR_TUNNEL_FORCE_ABORT + * + * @brief + * The Weave error code to be used with the API for stopping + * the tunnel to enforce it to abort its TCP connection and return + * synchronously to the caller. + * + */ +#define WEAVE_ERROR_TUNNEL_FORCE_ABORT _WEAVE_ERROR(140) + +/** + * @def WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL + * + * @brief + * The element of the struct is null. + * + */ +#define WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL _WEAVE_ERROR(141) + +/** + * @def WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM + * + * @brief + * The certificate was not signed using the required signature algorithm. + * + */ +#define WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM _WEAVE_ERROR(142) + +/** + * @def WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM + * + * @brief + * The Weave signature was not signed using the required signature algorithm. + * + */ +#define WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM _WEAVE_ERROR(143) + +/** + * @def WEAVE_ERROR_WDM_SCHEMA_MISMATCH + * + * @brief + * A mismatch in schema was encountered. + * + */ +#define WEAVE_ERROR_WDM_SCHEMA_MISMATCH _WEAVE_ERROR(144) + +/** + * @def WEAVE_ERROR_INVALID_INTEGER_VALUE + * + * @brief + * An integer does not have the kind of value we expect. + * + */ +#define WEAVE_ERROR_INVALID_INTEGER_VALUE _WEAVE_ERROR(145) + +/** + * @def WEAVE_ERROR_CASE_RECONFIG_REQUIRED + * + * @brief + * CASE is required to reconfigure. + * + */ +#define WEAVE_ERROR_CASE_RECONFIG_REQUIRED _WEAVE_ERROR(146) + +/** + * @def WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS + * + * @brief + * Too many CASE reconfigurations were received. + * + */ +#define WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS _WEAVE_ERROR(147) + +/** + * @def WEAVE_ERROR_BAD_REQUEST + * + * @brief + * The request cannot be processed or fulfilled + * + */ +#define WEAVE_ERROR_BAD_REQUEST _WEAVE_ERROR(148) + +/** + * @def WEAVE_ERROR_INVALID_MESSAGE_FLAG + * + * @brief + * One or more message flags have invalid value. + * + */ +#define WEAVE_ERROR_INVALID_MESSAGE_FLAG _WEAVE_ERROR(149) + +/** + * @def WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED + * + * @brief + * Key export protocol required to reconfigure. + * + */ +#define WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED _WEAVE_ERROR(150) + +/** + * @def WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION + * + * @brief + * A key export protocol configuration is invalid. + * + */ +#define WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION _WEAVE_ERROR(151) + +/** + * @def WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS + * + * @brief + * No key export protocol configuration is in common. + * + */ +#define WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS _WEAVE_ERROR(152) + +/** + * @def WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE + * + * @brief + * No key export delegate is set. + * + */ +#define WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE _WEAVE_ERROR(153) + +/** + * @def WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST + * + * @brief + * Unauthorized key export request. + * + */ +#define WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST _WEAVE_ERROR(154) + +/** + * @def WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE + * + * @brief + * Unauthorized key export response. + * + */ +#define WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE _WEAVE_ERROR(155) + +/** + * @def WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED + * + * @brief + * The Weave exported encrypted key authentication failed. + * + */ +#define WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED _WEAVE_ERROR(156) + +/** + * @def WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES + * + * @brief + * The number of shared secure sessions end nodes exceeds + * the maximum limit. + * + */ +#define WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES _WEAVE_ERROR(157) + +/** + * @def WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT + * + * @brief + * The WDM DataElement is malformed: it either does not contain + * the required elements, or it contais both the MergeData element + * and DeletedDictionaryKeyList. + */ +#define WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT _WEAVE_ERROR(158) + +/** + * @def WEAVE_ERROR_WRONG_CERT_TYPE + * + * @brief + * The presented certificate was of the wrong type. + */ +#define WEAVE_ERROR_WRONG_CERT_TYPE _WEAVE_ERROR(159) + +/** + * @def WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED + * + * @brief + * The application's event handler failed to call the default event handler function + * when presented with an unknown event. + */ +#define WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED _WEAVE_ERROR(162) + +/** + * @def WEAVE_ERROR_PERSISTED_STORAGE_FAIL + * + * @brief + * Persisted storage memory read/write failure. + * + */ +#define WEAVE_ERROR_PERSISTED_STORAGE_FAIL _WEAVE_ERROR(163) + +/** + * @def WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND + * + * @brief + * The specific value is not found in the persisted storage. + * + */ +#define WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND _WEAVE_ERROR(164) + +/** + * @def WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED + * + * @brief + * The specified profile string support context is already registered. + * + */ +#define WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED _WEAVE_ERROR(165) + +/** + * @def WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED + * + * @brief + * The specified profile string support context is not registered. + * + */ +#define WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED _WEAVE_ERROR(166) + +/** + * @def WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION + * + * @brief + * Encountered a mismatch in compatibility w.r.t to IDL schema version + */ +#define WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION _WEAVE_ERROR(167) + +/** + * @def WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED + * + * @brief + * Indicates that the Tunnel can only be used by the border gateway + * for itself and, it cannot forward packets for any other device. + * + */ +#define WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED _WEAVE_ERROR(168) + +/** + * @def WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED + * + * @brief + * The Tunnel reset reconnect timer is already armed + */ +#define WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED _WEAVE_ERROR(169) + +/** + * @def WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION + * + * @brief + * Encountered a mismatch between wdm update required version and current version + */ +#define WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION _WEAVE_ERROR(170) + +/** + * @def WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT + * + * @brief + * The WDM StatusElement is malformed: it does not contain + * either the profile id or the status code. + */ +#define WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT _WEAVE_ERROR(171) + +/** + * @def WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL + * + * @brief + * The WDM Subscriptionless Notify is partial. + */ +#define WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL _WEAVE_ERROR(172) + +/** + * @def WEAVE_ERROR_ACCESS_DENIED + * + * @brief + * The Weave message is not granted access for further processing. + */ +#define WEAVE_ERROR_ACCESS_DENIED _WEAVE_ERROR(173) + +/** + * @def WEAVE_ERROR_UNKNOWN_RESOURCE_ID + * + * @brief + * Unknown resource ID + * + */ +#define WEAVE_ERROR_UNKNOWN_RESOURCE_ID _WEAVE_ERROR(174) + +/** + * @def WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE + * + * @brief + * The WDM UpdateResponse payload is malformed: it does not contain + * either the StatusList or the VersionList. + */ +#define WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE _WEAVE_ERROR(175) + +/** + * @def WEAVE_ERROR_WDM_VERSION_MISMATCH + * + * @brief + * The conditional update of a trait instance path has failed + * because the local changes are based on an obsolete version of the + * data. + */ +#define WEAVE_ERROR_WDM_VERSION_MISMATCH _WEAVE_ERROR(176) + +/** + * @def WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS + * + * @brief + * A potential data loss was detected for a Trait Instance. + */ +#define WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS _WEAVE_ERROR(177) + +/** + * @def WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE + * + * @brief + * Device doesn't support standalone Thread network creation. + * On some legacy Nest devices new Thread network can only be created + * together with Weave Fabric using CrateFabric() message. + * + */ +#define WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE _WEAVE_ERROR(178) + +/** + * @def WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY + * + * @brief + * A TraitPath was declared updated with a conditionality that + * does not match that of other TraitPaths already updated in the + * same Trait Instance. + * + */ +#define WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY _WEAVE_ERROR(179) + +/** + * @def WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT + * + * @brief + * The local data does not match any known version of the + * Trait Instance and cannot support the operation requested. + * + */ +#define WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT _WEAVE_ERROR(180) + +/** + * @def WEAVE_ERROR_WDM_PATH_STORE_FULL + * + * @brief + * WDM cannot store a TraitPath for lack of memory. + * + */ +#define WEAVE_ERROR_WDM_PATH_STORE_FULL _WEAVE_ERROR(181) +/** + * @def WEAVE_EVENT_ID_FOUND + * + * @brief + * Event ID matching the criteria was found + */ +#define WEAVE_EVENT_ID_FOUND _WEAVE_ERROR(182) + +/** + * @} + */ + +// !!!!! IMPORTANT !!!!! If you add new Weave errors, please update the translation +// of error codes to strings in WeaveError.cpp, and add them to unittest +// in test-apps/TestErrorStr.cpp + +// clang-format on + +namespace nl { +namespace Weave { + +extern bool FormatWeaveError(char * buf, uint16_t bufSize, int32_t err); + +} // namespace Weave +} // namespace nl + +#endif // WEAVE_ERROR_H diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h new file mode 100644 index 00000000000000..b6c5d69ee36ec4 --- /dev/null +++ b/src/lib/support/CodeUtils.h @@ -0,0 +1,412 @@ +/* + * + * Copyright (c) 2013-2017 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. + */ + +/** + * @file + * This file defines and implements a number of miscellaneous + * templates for finding object minima and maxima and interface + * macros for assertion checking. + * + */ + +#ifndef CODEUTILS_H_ +#define CODEUTILS_H_ + +#include +#include +#include + +/** + * @name Weave-specific nlassert.h Overrides + * + * @{ + * + */ + +/** + * @def NL_ASSERT_ABORT() + * + * @brief + * This implements a Weave-specific override for #NL_ASSERT_ABORT * + * from nlassert.h. + * + */ +#if !defined(NL_ASSERT_ABORT) +#define NL_ASSERT_ABORT() \ + WeaveDie() +#endif + +/** + * @def NL_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) + * + * @brief + * This implements a Weave-specific override for \c NL_ASSERT_LOG + * from nlassert.h. + * + * @param[in] aPrefix A pointer to a NULL-terminated C string printed + * at the beginning of the logged assertion + * message. Typically this is and should be + * \c NL_ASSERT_PREFIX_STRING. + * @param[in] aName A pointer to a NULL-terminated C string printed + * following @a aPrefix that indicates what + * module, program, application or subsystem + * the assertion occurred in Typically this + * is and should be + * \c NL_ASSERT_COMPONENT_STRING. + * @param[in] aCondition A pointer to a NULL-terminated C string indicating + * the expression that evaluated to false in + * the assertion. Typically this is a + * stringified version of the actual + * assertion expression. + * @param[in] aLabel An optional pointer to a NULL-terminated C string + * indicating, for exception-style + * assertions, the label that will be + * branched to when the assertion expression + * evaluates to false. + * @param[in] aFile A pointer to a NULL-terminated C string indicating + * the file in which the exception + * occurred. Typically this is and should be + * \_\_FILE\_\_ from the C preprocessor. + * @param[in] aLine The line number in @a aFile on which the assertion + * expression evaluated to false. Typically + * this is and should be \_\_LINE\_\_ from the C + * preprocessor. + * @param[in] aMessage An optional pointer to a NULL-terminated C string + * containing a caller-specified message + * further describing the assertion failure. + * + */ +#if !defined(NL_ASSERT_LOG) +#define NL_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) \ + do \ + { \ + WeaveLogError(NotSpecified, \ + NL_ASSERT_LOG_FORMAT_DEFAULT, \ + aPrefix, \ + (((aName) == 0) || (*(aName) == '\0')) ? "" : aName, \ + (((aName) == 0) || (*(aName) == '\0')) ? "" : ": ", \ + aCondition, \ + (((aMessage) == 0) ? "" : aMessage), \ + (((aMessage) == 0) ? "" : ", "), \ + aFile, \ + aLine); \ + } while (0) +#endif + +/** + * @} Weave-specific nlassert.h Overrides + * + */ + +#include + +namespace nl { +namespace Weave { + +// Generic min() and max() functions +// +template +inline const _T & +min(const _T &a, const _T &b) +{ + if (b < a) + return b; + + return a; +} + +template +inline const _T & +max(const _T &a, const _T &b) +{ + if (a < b) + return b; + + return a; +} + +} // namespace Weave +} // namespace nl + +/** + * @def IgnoreUnusedVariable(aVariable) + * + * @brief + * This casts the specified @a aVariable to void to quell any + * compiler-issued unused variable warnings or errors. + * + * @code + * void foo (int err) + * { + * IgnoreUnusedVariable(err) + * } + * @endcode + * + */ +#define IgnoreUnusedVariable(aVariable) \ + ((void)(aVariable)) + +/** + * @def SuccessOrExit(aStatus) + * + * @brief + * This checks for the specified status, which is expected to + * commonly be successful (WEAVE_NO_ERROR), and branches to + * the local label 'exit' if the status is unsuccessful. + * + * Example Usage: + * + * @code + * WEAVE_ERROR TryHard() + * { + * WEAVE_ERROR err; + * + * err = TrySomething(); + * SuccessOrExit(err); + * + * err = TrySomethingElse(); + * SuccessOrExit(err); + * + * exit: + * return err; + * } + * @endcode + * + * @param[in] aStatus A scalar status to be evaluated against zero (0). + * + */ +#define SuccessOrExit(aStatus) \ + nlEXPECT((aStatus) == WEAVE_NO_ERROR, exit) + +/** + * @def VerifyOrExit(aCondition, anAction) + * + * @brief + * This checks for the specified condition, which is expected to + * commonly be true, and both executes @a anAction and branches to + * the local label 'exit' if the condition is false. + * + * Example Usage: + * + * @code + * WEAVE_ERROR MakeBuffer(const uint8_t *& buf) + * { + * WEAVE_ERROR err = WEAVE_NO_ERROR; + * + * buf = (uint8_t *)malloc(1024); + * VerifyOrExit(buf != NULL, err = WEAVE_ERROR_NO_MEMORY); + * + * memset(buf, 0, 1024); + * + * exit: + * return err; + * } + * @endcode + * + * @param[in] aCondition A Boolean expression to be evaluated. + * @param[in] anAction An expression or block to execute when the + * assertion fails. + * + */ +#define VerifyOrExit(aCondition, anAction) \ + nlEXPECT_ACTION(aCondition, exit, anAction) + +/** + * @def ExitNow(...) + * + * @brief + * This unconditionally executes @a ... and branches to the local + * label 'exit'. + * + * @note The use of this interface implies neither success nor + * failure for the overall exit status of the enclosing function + * body. + * + * Example Usage: + * + * @code + * WEAVE_ERROR ReadAll(Reader& reader) + * { + * WEAVE_ERROR err; + * + * while (true) + * { + * err = reader.ReadNext(); + * if (err == WEAVE_ERROR_AT_END) + * ExitNow(err = WEAVE_NO_ERROR); + * SuccessOrExit(err); + * DoSomething(); + * } + * + * exit: + * return err; + * } + * @endcode + * + * @param[in] ... An optional expression or block to execute + * when the assertion fails. + * + */ +#define ExitNow(...) \ + do { \ + __VA_ARGS__; \ + goto exit; \ + } while (0) + +/** + * @brief + * This is invoked when a #VerifyOrDie or #VerifyOrDieWithMsg + * assertion expression evaluates to false. + * + * Developers may override and customize this by defining #WeaveDie + * before CodeUtils.h is included by the preprocessor. + * + * Example Usage: + * + * @code + * WeaveDie(); + * @endcode + * + */ +#ifndef WeaveDie +extern "C" void WeaveDie(void) __attribute((noreturn)); + +inline void WeaveDie(void) +{ + WeaveLogError(NotSpecified, "WeaveDie WeaveDie WeaveDie"); + + while (true) + { + // NL_ASSERT_ABORT is redefined to be WeaveDie, so not useful here. + abort(); + } +} +#endif // WeaveDie + +/** + * @def VerifyOrDie(aCondition) + * + * @brief + * This checks for the specified condition, which is expected to + * commonly be true and forces an immediate abort if the condition + * is false. + * + * Example Usage: + * + * @code + * void FreeBuffer(const uint8_t *buf) + * { + * VerifyOrDie(buf != NULL); + * free(buf); + * } + * @endcode + * + * @param[in] aCondition A Boolean expression to be evaluated. + * + * @sa #VerifyOrDieWithMsg + * @sa #WeaveDie + * + */ +#define VerifyOrDie(aCondition) \ + nlABORT(aCondition) + +/** + * @def VerifyOrDieWithMsg(aCondition, aModule, aMessage, ...) + * + * @brief + * This checks for the specified condition, which is expected to + * commonly be true and both prints @a aMessage and forces an + * immediate abort if the condition is false. + * + * Example Usage: + * + * @code + * void FreeBuffer(const uint8_t *buf) + * { + * VerifyOrDieWithMsg(buf != NULL, MemoryManagement, "Invalid pointer passed to FreeBuffer"); + * free(buf); + * } + * @endcode + * + * @param[in] aCondition A Boolean expression to be evaluated. + * @param[in] aModule A Weave LogModule short-hand mnemonic identifing + * the logical section of code that is a + * source the logged message. + * @param[in] aMessage A pointer to a NULL-terminated C string with + * C Standard Library-style format specifiers + * containing the log message to be formatted + * and logged. + * @param[in] ... A variadic argument list whose elements should + * correspond to the format specifiers in @a + * aMessage. + * + * @sa #VerifyOrDie + * @sa #WeaveDie + * + */ +#define VerifyOrDieWithMsg(aCondition, aModule, aMessage, ...) \ + nlABORT_ACTION(aCondition, WeaveLogDetail(aModule, aMessage, ## __VA_ARGS__)) + +/** + * @def ArraySize(aArray) + * + * @brief + * Returns the size of an array in number of elements. + * + * Example Usage: + * + * @code + * int numbers[10]; + * SortNumbers(numbers, ArraySize(numbers)); + * @endcode + * + * @return The size of an array in number of elements. + */ +#define ArraySize(a) (sizeof(a)/sizeof((a)[0])) + +#if defined(__cplusplus) && (__cplusplus >= 201103L) + +#ifndef __FINAL +#define __FINAL final +#endif + +#ifndef __OVERRIDE +#define __OVERRIDE override +#endif + +#ifndef __CONSTEXPR +#define __CONSTEXPR constexpr +#endif + +#else + +#ifndef __FINAL +#define __FINAL +#endif + +#ifndef __OVERRIDE +#define __OVERRIDE +#endif + +#ifndef __CONSTEXPR +#define __CONSTEXPR constexpr +#endif + +#endif // defined(__cplusplus) && (__cplusplus >= 201103L) + +#endif /* CODEUTILS_H_ */ diff --git a/src/lib/support/logging/WeaveLogging.cpp b/src/lib/support/logging/WeaveLogging.cpp new file mode 100644 index 00000000000000..bfb4a8f47e8416 --- /dev/null +++ b/src/lib/support/logging/WeaveLogging.cpp @@ -0,0 +1,252 @@ +/* + * + * Copyright (c) 2013-2017 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. + */ + +/** + * @file + * This file implements macros, constants, and interfaces for a + * platform-independent logging interface for the Weave SDK. + * + */ + +#include +#include +#include + +#include +#include +#include +#include "WeaveLogging.h" + +#if WEAVE_LOGGING_STYLE_ANDROID && defined(__ANDROID__) +#include +#endif + +#if HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#include +#endif // HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS + +namespace nl { +namespace Weave { +namespace Logging { + +#if _WEAVE_USE_LOGGING + +/* + * Array of strings containing the names for each of the Weave log + * modules. + * + * NOTE: The names must be in the order defined in the LogModule + * enumeration. Each name must be a fixed number of characters + * long (nlWeaveLoggingModuleNameLen) padded with nulls as + * necessary. + * + */ +static const char ModuleNames[] = + "-\0\0" // None + "IN\0" // Inet + "BLE" // BLE + "ML\0" // MessageLayer + "SM\0" // SecurityManager + "EM\0" // ExchangeManager + "TLV" // TLV + "ASN" // ASN1 + "CR\0" // Crypto + "DM\0" // DeviceManager + "AL\0" // Alarm + "BDX" // BulkDataTransfer + "DMG" // DataManagement + "DC\0" // DeviceControl + "DD\0" // DeviceDescription + "ECH" // Echo + "FP\0" // FabricProvisioning + "NP\0" // NetworkProvisioning + "SD\0" // ServiceDirectory + "SP\0" // ServiceProvisioning + "SWU" // SoftwareUpdate + "TP\0" // TokenPairing + "HL\0" // HeatLink + "TS\0" // TimeServices + "WT\0" // WeaveTunnel + "HB\0" // Heartbeat + "WSL" // WeaveSystemLayer + "DLP" // DropcamLegacyPairing + "EVL" // Event Logging + "SPT" // Support + ; + +#define ModuleNamesCount ((sizeof(ModuleNames) - 1) / nlWeaveLoggingModuleNameLen) + +#define WeavePrefix "WEAVE:" +#define WeavePrefixSeparator ": " +#define WeaveMessageTrailer "\n" + +void GetModuleName(char *buf, uint8_t module) +{ + const char *moduleNamePtr = ModuleNames + ((module < ModuleNamesCount) ? module * nlWeaveLoggingModuleNameLen : 0); + memcpy(buf, moduleNamePtr, nlWeaveLoggingModuleNameLen); + buf[nlWeaveLoggingModuleNameLen] = 0; +} + +void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg) +{ + char moduleName[nlWeaveLoggingModuleNameLen + 1]; + + GetModuleName(moduleName, module); + snprintf(buf, bufSize, WeavePrefix "%s" WeavePrefixSeparator "%s" WeaveMessageTrailer, moduleName, msg); +} + +void PrintMessagePrefix(uint8_t module) +{ + char moduleName[nlWeaveLoggingModuleNameLen + 1]; + GetModuleName(moduleName, module); + +#if WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS + struct timeval tv; + struct tm* time_ptr; + char detailed_time[30]; + int64_t milliseconds; + int status; + + status = gettimeofday(&tv, NULL); + VerifyOrExit(status == 0, perror("gettimeofday")); + + time_ptr = localtime(&tv.tv_sec); + VerifyOrExit(time_ptr != NULL, status = -1; perror("localtime")); + + status = strftime(detailed_time, sizeof(detailed_time), "%F %T%z", time_ptr); + VerifyOrExit(status >= 0, perror("strftime")); + + milliseconds = tv.tv_usec / 1000; + printf("%s.%03ld " WeavePrefix "%s: ", detailed_time, milliseconds, moduleName); + +exit: + if (status < 0) + { + printf("\?\?\?\?-\?\?-\?\? \?\?:\?\?:\?\?.\?\?\?+\?\?\?\?" WeavePrefix "%s: ", moduleName); + } + +#else // !WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS + + printf(WeavePrefix "%s: ", moduleName); + +#endif // WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +} + +#if WEAVE_LOG_FILTERING + +uint8_t gLogFilter = kLogCategory_Max; + +#endif // WEAVE_LOG_FILTERING + +#if !WEAVE_LOGGING_STYLE_EXTERNAL +/* + * Only enable an in-package implementation of the logging interface + * if external logging was not requested. Within that, the package + * supports either Android-style or C Standard I/O-style logging. + * + * In the event a "weak" variant is specified, i.e + * WEAVE_LOGGING_STYLE_STDIO_WEAK, the in-package implementation will + * be provided but with "weak" linkage + */ + +/** + * Log, to the platform-specified mechanism, the specified log + * message, @a msg, for the specified module, @a module, in the + * provided category, @a category. + * + * @param[in] module A LogModule enumeration indicating the + * source of the Weave package module that + * generated the log message. This must be + * translated within the function to a module + * name for inclusion in the log message. + * @param[in] category A LogCategory enumeration indicating the + * category of the log message. The category + * may be filtered in or out if + * WEAVE_LOG_FILTERING was asserted. + * @param[in] msg A pointer to a NULL-terminated C string with + * C Standard Library-style format specifiers + * containing the log message to be formatted and + * logged. + * @param[in] ... A variadic argument list whose elements should + * correspond to the format specifiers in @a msg. + * + */ + +#if WEAVE_LOGGING_STYLE_STDIO_WEAK +#define __WEAVE_LOGGING_LINK_ATTRIBUTE __attribute__((weak)) +#else +#define __WEAVE_LOGGING_LINK_ATTRIBUTE +#endif + +NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...) +{ + va_list v; + + va_start(v, msg); + + if (IsCategoryEnabled(category)) + { + +#if WEAVE_LOGGING_STYLE_ANDROID + + char moduleName[nlWeaveLoggingModuleNameLen + 1]; + GetModuleName(moduleName, module); + + int priority = (category == kLogCategory_Error) ? ANDROID_LOG_ERROR : ANDROID_LOG_DEBUG; + + __android_log_vprint(priority, moduleName, msg, v); + +#elif WEAVE_LOGGING_STYLE_STDIO || WEAVE_LOGGING_STYLE_STDIO_WEAK + + PrintMessagePrefix(module); + vprintf(msg, v); + printf("\n"); + +#else + +#error "Undefined platform-specific implementation for non-externnal Weave logging style!" + +#endif /* WEAVE_LOGGING_STYLE_ANDROID */ + + } + + va_end(v); +} +#endif /* !WEAVE_LOGGING_STYLE_EXTERNAL */ + +NL_DLL_EXPORT uint8_t GetLogFilter() +{ +#if WEAVE_LOG_FILTERING + return gLogFilter; +#else + return kLogCategory_Max; +#endif +} + +NL_DLL_EXPORT void SetLogFilter(uint8_t category) +{ +#if WEAVE_LOG_FILTERING + gLogFilter = category; +#endif +} + +#endif /* _WEAVE_USE_LOGGING */ + +} // namespace Logging +} // namespace Weave +} // namespace nl diff --git a/src/lib/support/logging/WeaveLogging.h b/src/lib/support/logging/WeaveLogging.h new file mode 100644 index 00000000000000..8f8495543ed0b1 --- /dev/null +++ b/src/lib/support/logging/WeaveLogging.h @@ -0,0 +1,461 @@ +/* + * + * Copyright (c) 2013-2017 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. + */ + +/** + * @file + * This file defines macros, constants, and interfaces for a + * platform-independent logging interface for the Weave SDK. + * + * Weave SDK clients may choose, at compile time, among Android, + * C Standard I/O, or external (platform- and integrator-defined) + * logging style implementations that will be invoked when any of + * the following preprocessor symbols are asserted: + * + * - #WEAVE_ERROR_LOGGING + * - #WEAVE_PROGRESS_LOGGING + * - #WEAVE_DETAIL_LOGGING + * + */ + +#ifndef WEAVELOGGING_H_ +#define WEAVELOGGING_H_ + +#include + +#include + +/** + * @namespace nl::Weave::Logging + * + * @brief + * This namespace includes all interfaces within Weave for shared + * logging support. + * + * The interfaces include macros, constants, and functions for a + * platform-independent logging interface for the Weave SDK. + * + * Weave SDK clients may choose, at compile time, among Android, + * C Standard I/O, or external (platform- and integrator-defined) + * logging style implementations that will be invoked when any of + * the following preprocessor symbols are asserted: + * + * - #WEAVE_ERROR_LOGGING + * - #WEAVE_PROGRESS_LOGGING + * - #WEAVE_DETAIL_LOGGING + * + */ + +namespace nl { +namespace Weave { +namespace Logging { + +/** + * @enum LogModule + * + * @brief + * Identifies a logical section of code that is a source of log + * messages. + * + * @note If you add modules or rearrange this list you must update the + * ModuleNames tables in WeaveLogging.cpp. + * + */ +enum LogModule +{ + kLogModule_NotSpecified = 0, + + kLogModule_Inet, + kLogModule_Ble, + kLogModule_MessageLayer, + kLogModule_SecurityManager, + kLogModule_ExchangeManager, + kLogModule_TLV, + kLogModule_ASN1, + kLogModule_Crypto, + kLogModule_DeviceManager, + kLogModule_Alarm, + kLogModule_BDX, + kLogModule_DataManagement, + kLogModule_DeviceControl, + kLogModule_DeviceDescription, + kLogModule_Echo, + kLogModule_FabricProvisioning, + kLogModule_NetworkProvisioning, + kLogModule_ServiceDirectory, + kLogModule_ServiceProvisioning, + kLogModule_SoftwareUpdate, + kLogModule_TokenPairing, + kLogModule_HeatLink, + kLogModule_TimeService, + kLogModule_WeaveTunnel, + kLogModule_Heartbeat, + kLogModule_WeaveSystemLayer, + kLogModule_DropcamLegacyPairing, + kLogModule_EventLogging, + kLogModule_Support, + + kLogModule_Max +}; + +/** + * @enum LogCategory + * + * @brief + * Identifies a category to which an particular error message + * belongs. + * + */ +enum LogCategory +{ + /*!< + * This log category indicates, when passed to SetLogFilter(), + * that no messages should be logged. + * + */ + kLogCategory_None = 0, + + /*!< + * Indicates a category of log message that describes an unexpected + * or severe failure. + * + * This log category indicates that a logged message describes + * an unexpected or severe failure in the code. + * + * It should be used for things such as out-of-resource errors, + * internal inconsistencies, API misuse, etc. In general, errors + * that are expected to occur as part of normal operation, or + * that are largely determined by external factors (e.g. network + * errors, user/operator induced errors, etc.) should be logged + * as kLogCategory_Progress messages, not as kLogCategory_Error + * messages. + * + */ + kLogCategory_Error = 1, + + /*!< + * Indicates a category of log message that describes an event + * that marks the start or end of a major activity, or a major + * change in the state of the overall system. + * + * It should be reserved for high-level events. Such messages + * should provide the log reader with a good sense of the + * overall activity of the system at any point in time, while + * being minimally verbose. Where necessary such messages should + * include identifiers or other values that can be used to + * correlate messages involving a common actor or subject + * (e.g. connection ids, request ids, etc.) and/or to identify + * types of actions being taken or handled (e.g. message types, + * requested resource types, error numbers, etc.). + * + */ + kLogCategory_Progress = 2, + + /*!< + * Indicates a category of log message that describes detailed + * information about an event or the state of the system. + * + * Such messages can be used to provide ancillary information + * not suitable for the kLogCategory_Error and + * kLogCategory_Progress categories. + * + */ + kLogCategory_Detail = 3, + + /*!< + * Indicates a category of log message that describes information + * needed by IE and QA teams for automated testing. + * + */ + kLogCategory_Retain = 4, + + kLogCategory_Max = kLogCategory_Retain +}; + +extern void Log(uint8_t module, uint8_t category, const char *msg, ...); +extern uint8_t GetLogFilter(void); +extern void SetLogFilter(uint8_t category); + +#ifndef WEAVE_ERROR_LOGGING +#define WEAVE_ERROR_LOGGING 1 +#endif + +#ifndef WEAVE_LOG_FILTERING +#define WEAVE_LOG_FILTERING 1 +#endif + +#if WEAVE_ERROR_LOGGING +/** + * @def WeaveLogError(MOD, MSG, ...) + * + * @brief + * Log a Weave message for the specified module in the 'Error' + * category. + * + */ +#ifndef WeaveLogError +#define WeaveLogError(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Error, MSG, ## __VA_ARGS__) +#endif +#else +#define WeaveLogError(MOD, MSG, ...) +#endif + +#ifndef WEAVE_PROGRESS_LOGGING +#define WEAVE_PROGRESS_LOGGING 1 +#endif + +#if WEAVE_PROGRESS_LOGGING +/** + * @def WeaveLogProgress(MOD, MSG, ...) + * + * @brief + * Log a Weave message for the specified module in the 'Progress' + * category. + * + */ +#ifndef WeaveLogProgress +#define WeaveLogProgress(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Progress, MSG, ## __VA_ARGS__) +#endif +#else +#define WeaveLogProgress(MOD, MSG, ...) +#endif + + +#ifndef WEAVE_DETAIL_LOGGING +#define WEAVE_DETAIL_LOGGING 1 +#endif + +#if WEAVE_DETAIL_LOGGING +/** + * @def WeaveLogDetail(MOD, MSG, ...) + * + * @brief + * Log a Weave message for the specified module in the 'Detail' + * category. + * + */ +#ifndef WeaveLogDetail +#define WeaveLogDetail(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Detail, MSG, ## __VA_ARGS__) +#endif +#else +#define WeaveLogDetail(MOD, MSG, ...) +#endif + +#ifndef WEAVE_RETAIN_LOGGING +#define WEAVE_RETAIN_LOGGING WEAVE_PROGRESS_LOGGING +#define WeaveLogRetain(MOD, MSG, ...) WeaveLogProgress(MOD, MSG, ## __VA_ARGS__) +#endif + +#if WEAVE_RETAIN_LOGGING +/** + * @def WeaveLogRetain(MOD, MSG, ...) + * + * @brief + * Log a Weave message for the specified module in the 'Retain' + * category. This is used for IE testing. + * If the product has not defined WEAVE_RETAIN_LOGGING, it defaults to the same as WeaveLogProgress + * + */ +#ifndef WeaveLogRetain +#define WeaveLogRetain(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Retain, MSG, ## __VA_ARGS__) +#endif + +#else // #if WEAVE_RETAIN_LOGGING +#ifdef WeaveLogRetain +// This is to ensure that WeaveLogRetain is null if +// the product has defined WEAVE_RETAIN_LOGGING to 0 itself +#undef WeaveLogRetain +#endif +#define WeaveLogRetain(MOD, MSG, ...) +#endif // #if WEAVE_RETAIN_LOGGING + + +#if WEAVE_ERROR_LOGGING || WEAVE_PROGRESS_LOGGING || WEAVE_DETAIL_LOGGING || WEAVE_RETAIN_LOGGING +#define _WEAVE_USE_LOGGING 1 +#else +#define _WEAVE_USE_LOGGING 0 +#endif /* WEAVE_ERROR_LOGGING || WEAVE_PROGRESS_LOGGING || WEAVE_DETAIL_LOGGING || WEAVE_RETAIN_LOGGING */ + +#if _WEAVE_USE_LOGGING + +#define nlWeaveLoggingWeavePrefixLen 6 +#define nlWeaveLoggingModuleNameLen 3 +#define nlWeaveLoggingMessageSeparatorLen 2 +#define nlWeaveLoggingMessageTrailerLen 2 +#define nlWeaveLoggingTotalMessagePadding (nlWeaveLoggingWeavePrefixLen + \ + nlWeaveLoggingModuleNameLen + \ + nlWeaveLoggingMessageSeparatorLen + \ + nlWeaveLoggingMessageTrailerLen) + +extern void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg); +extern void GetModuleName(char *buf, uint8_t module); +void PrintMessagePrefix(uint8_t module); + +#else + +static inline void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg) +{ + return; +} + +static inline void GetModuleName(char *buf, uint8_t module) +{ + return; +} + +#endif // _WEAVE_USE_LOGGING + +#if WEAVE_LOG_FILTERING + +extern uint8_t gLogFilter; + +#define IsCategoryEnabled(CAT) ((CAT) <= gLogFilter) + +#else // WEAVE_LOG_FILTERING + +#define IsCategoryEnabled(CAT) (true) + +#endif // WEAVE_LOG_FILTERING + + + +/** + * @def WeaveLogIfFalse(aCondition) + * + * @brief + * This checks for the specified condition, which is expected to + * commonly be true and emits some log, based on configuration, if + * the condition is false. + * + * @note + * Evaluation of @a aCondition is always done, but logging is only enabled when + * #WEAVE_CONFIG_ENABLE_CONDITION_LOGGING is enabled. This can be turned on or + * off for each compilation unit by enabling or disabling, as desired, + * #WEAVE_CONFIG_ENABLE_CONDITION_LOGGING before WeaveLogging.h is included by + * the preprocessor. + * + * Example Usage: + * + * @code + * #define WEAVE_CONFIG_ENABLE_CONDITION_LOGGING 1 + * + * #include + * + * ... + * + * void foo(void) + * { + * WEAVE_ERROR err = WEAVE_NO_ERROR; + * + * ... + * + * exit: + * WeaveLogIfFalse(WEAVE_END_OF_TLV == err); + * } + * @endcode + * + * @param[in] aCondition A Boolean expression to be evaluated. + * + * @sa WEAVE_CONFIG_ENABLE_TRACE_ON_CHECK_FAILURE + * + */ + +#if WEAVE_CONFIG_ENABLE_CONDITION_LOGGING && !defined(WeaveLogIfFalse) + +#define WeaveLogIfFalse(aCondition) \ +do \ +{ \ + if (!(aCondition)) \ + { \ + WeaveLogError(NotSpecified, "Condition Failed (%s) at %s:%d", \ + #aCondition, __FILE__, __LINE__); \ + } \ +} while (0) + +#else // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING + +#define WeaveLogIfFalse(aCondition) \ + IgnoreUnusedVariable(aCondition) + +#endif // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING + + +/** + * @def WeaveLogFunctError(aErr) + * + * @brief + * If the given error value (@a aErr) is not successful (!= WEAVE_NO_ERROR), + * the method logs the file name, line number, and the error code. + * + * @note + * Evaluation of @a aErr is always done, but logging is only enabled when + * #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING is enabled. This can be turned + * on or off for each compilation unit by enabling or disabling, as desired, + * #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING before WeaveLogging.h is included + * by the preprocessor. + * + * Example Usage: + * + * @code + * #define WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 1 + * + * #include + * + * ... + * + * void foo(void) + * { + * WEAVE_ERROR err = WEAVE_NO_ERROR; + * + * ... + * + * exit: + * WeaveLogFunctError(err); + * } + * @endcode + * + * @param[in] aErr A scalar status to be evaluated against WEAVE_NO_ERROR. + * + * @sa #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + * + */ + +#if WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING && !defined(WeaveLogFunctError) + +#define WeaveLogFunctError(aErr) \ +do \ +{ \ + if ((aErr) != WEAVE_NO_ERROR) \ + { \ + WeaveLogError(NotSpecified, "%s at %s:%d", nl::ErrorStr(aErr), __FILE__, __LINE__);\ + } \ +} while (0) + +#else // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + +#define WeaveLogFunctError(aErr) \ + IgnoreUnusedVariable(aErr) + +#endif // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + + + +} // namespace Logging +} // namespace Weave +} // namespace nl + +#endif /* WEAVELOGGING_H_ */ From 8f8b2de09f2fad6a361bcf97ae6de0f5db18ed2b Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 11:27:02 -0700 Subject: [PATCH 3/7] Rename files to CHIP* --- src/lib/core/{WeaveConfig.h => CHIPConfig.h} | 0 src/lib/core/{WeaveCore.h => CHIPCore.h} | 0 src/lib/core/{WeaveError.cpp => CHIPError.cpp} | 0 src/lib/core/{WeaveError.h => CHIPError.h} | 0 src/lib/support/logging/{WeaveLogging.cpp => CHIPLogging.cpp} | 0 src/lib/support/logging/{WeaveLogging.h => CHIPLogging.h} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename src/lib/core/{WeaveConfig.h => CHIPConfig.h} (100%) rename src/lib/core/{WeaveCore.h => CHIPCore.h} (100%) rename src/lib/core/{WeaveError.cpp => CHIPError.cpp} (100%) rename src/lib/core/{WeaveError.h => CHIPError.h} (100%) rename src/lib/support/logging/{WeaveLogging.cpp => CHIPLogging.cpp} (100%) rename src/lib/support/logging/{WeaveLogging.h => CHIPLogging.h} (100%) diff --git a/src/lib/core/WeaveConfig.h b/src/lib/core/CHIPConfig.h similarity index 100% rename from src/lib/core/WeaveConfig.h rename to src/lib/core/CHIPConfig.h diff --git a/src/lib/core/WeaveCore.h b/src/lib/core/CHIPCore.h similarity index 100% rename from src/lib/core/WeaveCore.h rename to src/lib/core/CHIPCore.h diff --git a/src/lib/core/WeaveError.cpp b/src/lib/core/CHIPError.cpp similarity index 100% rename from src/lib/core/WeaveError.cpp rename to src/lib/core/CHIPError.cpp diff --git a/src/lib/core/WeaveError.h b/src/lib/core/CHIPError.h similarity index 100% rename from src/lib/core/WeaveError.h rename to src/lib/core/CHIPError.h diff --git a/src/lib/support/logging/WeaveLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp similarity index 100% rename from src/lib/support/logging/WeaveLogging.cpp rename to src/lib/support/logging/CHIPLogging.cpp diff --git a/src/lib/support/logging/WeaveLogging.h b/src/lib/support/logging/CHIPLogging.h similarity index 100% rename from src/lib/support/logging/WeaveLogging.h rename to src/lib/support/logging/CHIPLogging.h From d571bc025d266335c65139ce91286ded0501ce5c Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 11:51:35 -0700 Subject: [PATCH 4/7] Rename weave/nl to chip --- src/lib/core/CHIPConfig.h | 1700 +++++++++++------------ src/lib/core/CHIPCore.h | 41 +- src/lib/core/CHIPError.cpp | 375 +++-- src/lib/core/CHIPError.h | 807 ++++++----- src/lib/support/CodeUtils.h | 91 +- src/lib/support/logging/CHIPLogging.cpp | 109 +- src/lib/support/logging/CHIPLogging.h | 227 ++- 7 files changed, 1665 insertions(+), 1685 deletions(-) diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index be5eb5309970ca..c0b2cd715eb1af 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1,8 +1,6 @@ /* * - * Copyright (c) 2019 Google LLC. - * Copyright (c) 2013-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. @@ -20,214 +18,214 @@ /** * @file * This file defines default compile-time configuration constants - * for Nest Weave. + * for chip. * * Package integrators that wish to override these values should * either use preprocessor definitions or create a project- - * specific WeaveProjectConfig.h header and then assert - * HAVE_WEAVEPROJECTCONFIG_H via the package configuration tool - * via --with-weave-project-includes=DIR where DIR is the + * specific chipProjectConfig.h header and then assert + * HAVE_CHIPPROJECTCONFIG_H via the package configuration tool + * via --with-chip-project-includes=DIR where DIR is the * directory that contains the header. * * NOTE WELL: On some platforms, this header is included by C-language programs. * */ -#ifndef WEAVE_CONFIG_H_ -#define WEAVE_CONFIG_H_ +#ifndef CHIP_CONFIG_H_ +#define CHIP_CONFIG_H_ -#include +#include "SystemConfig.h" /* COMING SOON: making the INET Layer optional entails making this inclusion optional. */ -#include +#include "InetConfig.h" #if INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 -#error "Weave SDK requires INET_TCP_IDLE_CHECK_INTERVAL > 0" +#error "chip SDK requires INET_TCP_IDLE_CHECK_INTERVAL > 0" #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 /* Include a project-specific configuration file, if defined. * - * An application or module that incorporates Weave can define a project configuration - * file to override standard Weave configuration with application-specific values. - * The WeaveProjectConfig.h file is typically located outside the OpenWeave source tree, + * An application or module that incorporates chip can define a project configuration + * file to override standard chip configuration with application-specific values. + * The chipProjectConfig.h file is typically located outside the Openchip source tree, * alongside the source code for the application. */ -#ifdef WEAVE_PROJECT_CONFIG_INCLUDE -#include WEAVE_PROJECT_CONFIG_INCLUDE +#ifdef CHIP_PROJECT_CONFIG_INCLUDE +#include CHIP_PROJECT_CONFIG_INCLUDE #endif /* Include a platform-specific configuration file, if defined. * - * A platform configuration file contains overrides to standard Weave configuration - * that are specific to the platform or OS on which Weave is running. It is typically - * provided as apart of an adaptation layer that adapts OpenWeave to the target - * environment. This adaptation layer may be included in the OpenWeave source tree + * A platform configuration file contains overrides to standard chip configuration + * that are specific to the platform or OS on which chip is running. It is typically + * provided as apart of an adaptation layer that adapts Openchip to the target + * environment. This adaptation layer may be included in the Openchip source tree * itself or implemented externally. */ -#ifdef WEAVE_PLATFORM_CONFIG_INCLUDE -#include WEAVE_PLATFORM_CONFIG_INCLUDE +#ifdef CHIP_PLATFORM_CONFIG_INCLUDE +#include CHIP_PLATFORM_CONFIG_INCLUDE #endif // clang-format off /** - * @def WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES + * @def CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES * * @brief * This boolean configuration option is (1) if the obsolescent interfaces - * of the Nest Weave layer are still available for transitional purposes. + * of the chip layer are still available for transitional purposes. * */ -#ifndef WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES -#define WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES 0 -#endif // WEAVE_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES +#ifndef CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES +#define CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES 0 +#endif // CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES // Profile-specific Configuration Headers -#include "WeaveBDXConfig.h" +#include "CHIPBDXConfig.h" -#include "WeaveDMConfig.h" +#include "CHIPDMConfig.h" -#include "WeaveTimeConfig.h" +#include "CHIPTimeConfig.h" -#include "WeaveTunnelConfig.h" +#include "CHIPTunnelConfig.h" -#include "WeaveEventLoggingConfig.h" +#include "CHIPEventLoggingConfig.h" -#include "WeaveWRMPConfig.h" +#include "CHIPWRMPConfig.h" /** - * @def WEAVE_CONFIG_ERROR_TYPE + * @def CHIP_CONFIG_ERROR_TYPE * * @brief - * This defines the data type used to represent errors for Weave. + * This defines the data type used to represent errors for chip. * */ -#ifndef WEAVE_CONFIG_ERROR_TYPE +#ifndef CHIP_CONFIG_ERROR_TYPE #include -#define WEAVE_CONFIG_ERROR_TYPE int32_t -#endif // WEAVE_CONFIG_ERROR_TYPE +#define CHIP_CONFIG_ERROR_TYPE int32_t +#endif // CHIP_CONFIG_ERROR_TYPE /** - * @def WEAVE_CONFIG_NO_ERROR + * @def CHIP_CONFIG_NO_ERROR * * @brief - * This defines the Weave error code for no error or success. + * This defines the chip error code for no error or success. * */ -#ifndef WEAVE_CONFIG_NO_ERROR -#define WEAVE_CONFIG_NO_ERROR 0 -#endif // WEAVE_CONFIG_NO_ERROR +#ifndef CHIP_CONFIG_NO_ERROR +#define CHIP_CONFIG_NO_ERROR 0 +#endif // CHIP_CONFIG_NO_ERROR /** - * @def WEAVE_CONFIG_ERROR_MIN + * @def CHIP_CONFIG_ERROR_MIN * * @brief - * This defines the base or minimum Weave error number range. + * This defines the base or minimum chip error number range. * */ -#ifndef WEAVE_CONFIG_ERROR_MIN -#define WEAVE_CONFIG_ERROR_MIN 4000 -#endif // WEAVE_CONFIG_ERROR_MIN +#ifndef CHIP_CONFIG_ERROR_MIN +#define CHIP_CONFIG_ERROR_MIN 4000 +#endif // CHIP_CONFIG_ERROR_MIN /** - * @def WEAVE_CONFIG_ERROR_MAX + * @def CHIP_CONFIG_ERROR_MAX * * @brief - * This defines the top or maximum Weave error number range. + * This defines the top or maximum chip error number range. * */ -#ifndef WEAVE_CONFIG_ERROR_MAX -#define WEAVE_CONFIG_ERROR_MAX 4999 -#endif // WEAVE_CONFIG_ERROR_MAX +#ifndef CHIP_CONFIG_ERROR_MAX +#define CHIP_CONFIG_ERROR_MAX 4999 +#endif // CHIP_CONFIG_ERROR_MAX /** - * @def _WEAVE_CONFIG_ERROR + * @def _CHIP_CONFIG_ERROR * * @brief - * This defines a mapping function for Weave errors that allows + * This defines a mapping function for chip errors that allows * mapping such errors into a platform- or system-specific manner. * */ -#ifndef _WEAVE_CONFIG_ERROR -#define _WEAVE_CONFIG_ERROR(e) (WEAVE_ERROR_MIN + (e)) -#endif // _WEAVE_CONFIG_ERROR +#ifndef _CHIP_CONFIG_ERROR +#define _CHIP_CONFIG_ERROR(e) (CHIP_ERROR_MIN + (e)) +#endif // _CHIP_CONFIG_ERROR /** - * @def WEAVE_CONFIG_USE_OPENSSL_ECC + * @def CHIP_CONFIG_USE_OPENSSL_ECC * * @brief * Use the OpenSSL implementation of the elliptic curve primitives - * for Weave communication. + * for chip communication. * * Note that this option is mutually exclusive with - * #WEAVE_CONFIG_USE_MICRO_ECC. + * #CHIP_CONFIG_USE_MICRO_ECC. */ -#ifndef WEAVE_CONFIG_USE_OPENSSL_ECC -#define WEAVE_CONFIG_USE_OPENSSL_ECC 1 -#endif // WEAVE_CONFIG_USE_OPENSSL_ECC +#ifndef CHIP_CONFIG_USE_OPENSSL_ECC +#define CHIP_CONFIG_USE_OPENSSL_ECC 1 +#endif // CHIP_CONFIG_USE_OPENSSL_ECC /** - * @def WEAVE_CONFIG_USE_MICRO_ECC + * @def CHIP_CONFIG_USE_MICRO_ECC * * @brief * Use the Micro ECC implementation of the elliptic curve primitives - * for Weave communication. + * for chip communication. * * Note that this option is mutually exclusive with - * #WEAVE_CONFIG_USE_OPENSSL_ECC. + * #CHIP_CONFIG_USE_OPENSSL_ECC. * */ -#ifndef WEAVE_CONFIG_USE_MICRO_ECC -#define WEAVE_CONFIG_USE_MICRO_ECC 0 -#endif // WEAVE_CONFIG_USE_MICRO_ECC +#ifndef CHIP_CONFIG_USE_MICRO_ECC +#define CHIP_CONFIG_USE_MICRO_ECC 0 +#endif // CHIP_CONFIG_USE_MICRO_ECC -#if WEAVE_CONFIG_USE_MICRO_ECC && WEAVE_CONFIG_USE_OPENSSL_ECC -#error "Please assert one of either WEAVE_CONFIG_USE_MICRO_ECC or WEAVE_CONFIG_USE_OPENSSL_ECC, but not both." -#endif // WEAVE_CONFIG_USE_MICRO_ECC && WEAVE_CONFIG_USE_OPENSSL_ECC +#if CHIP_CONFIG_USE_MICRO_ECC && CHIP_CONFIG_USE_OPENSSL_ECC +#error "Please assert one of either CHIP_CONFIG_USE_MICRO_ECC or CHIP_CONFIG_USE_OPENSSL_ECC, but not both." +#endif // CHIP_CONFIG_USE_MICRO_ECC && CHIP_CONFIG_USE_OPENSSL_ECC /** - * @name Weave Elliptic Curve Security Configuration + * @name chip Elliptic Curve Security Configuration * * @brief * The following definitions enable one or more of four potential * elliptic curves: * - * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 - * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 - * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 - * * #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + * * #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + * * #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + * * #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + * * #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 * * @{ */ /** - * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 + * @def CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 * * @brief * Enable (1) or disable (0) support for the Standards for * Efficient Cryptography Group (SECG) secp160r1 elliptic curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 -#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 0 -#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#ifndef CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#define CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 0 +#endif // CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 /** - * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 + * @def CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 * * @brief * Enable (1) or disable (0) support for the Standards for * Efficient Cryptography Group (SECG) secp192r1 elliptic curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 -#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 1 -#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#ifndef CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#define CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 1 +#endif // CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 /** - * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 + * @def CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 * * @brief * Enable (1) or disable (0) support for the Standards for @@ -235,12 +233,12 @@ * Institute of Standards (NIST) P-224 elliptic curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 -#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 1 -#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#ifndef CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#define CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 1 +#endif // CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 /** - * @def WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 + * @def CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 * * @brief * Enable (1) or disable (0) support for the Standards for @@ -249,42 +247,42 @@ * Institute of Standards (NIST) P-256 elliptic curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 -#define WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 1 -#endif // WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#ifndef CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 1 +#endif // CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 /** * @} */ /** - * @name Weave Password Authenticated Session Establishment (PASE) Configuration + * @name chip Password Authenticated Session Establishment (PASE) Configuration * * @brief * The following definitions define the configurations supported - * for Weave's Password Authenticated Session Establishment (PASE) + * for chip's Password Authenticated Session Establishment (PASE) * protocol. * * This protocol is used primarily for establishing a secure - * session for provisioning. Weave supports the following PASE + * session for provisioning. chip supports the following PASE * configurations: * - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 - * * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG1 + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG2 + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG3 + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG4 + * * #CHIP_CONFIG_SUPPORT_PASE_CONFIG5 * * which are summarized in the table below: * * | Configuration | J-PAKE Style | Curve | Test Only | Notes | * | :------------: | :-------------- | :-------: | :---------: | :----------------------------------- | * | 0 | - | - | Y | Test-only | - * | 1 | Finite Field | - | N | Original Weave default configuration | + * | 1 | Finite Field | - | N | Original chip default configuration | * | 2 | Elliptic Curve | secp160r1 | N | | * | 3 | Elliptic Curve | secp192r1 | N | | - * | 4 | Elliptic Curve | secp224r1 | N | Future Weave default configuration | + * | 4 | Elliptic Curve | secp224r1 | N | Future chip default configuration | * | 5 | Elliptic Curve | secp256r1 | N | | * * @{ @@ -292,13 +290,13 @@ */ /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY * * @brief - * This Weave PASE configuration does not use the J-PAKE algorithm + * This chip PASE configuration does not use the J-PAKE algorithm * and sends deterministic messages over the communications * channel. The size and structure of the messages are similar to - * #WEAVE_CONFIG_SUPPORT_PASE_CONFIG5. + * #CHIP_CONFIG_SUPPORT_PASE_CONFIG5. * * @note The results of this configuration are insecure because the * computational overhead of the cryptography has largely been @@ -307,109 +305,109 @@ * cryptography. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY 0 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY 0 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG1 * * @brief - * This Weave PASE configuration uses Finite Field J-PAKE and is - * the original, default Weave PASE configuration. + * This chip PASE configuration uses Finite Field J-PAKE and is + * the original, default chip PASE configuration. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 1 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG1 +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG1 +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG1 1 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG1 /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG2 * * @brief - * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * This chip PASE configuration uses Elliptic Curve J-PAKE with a * SECG secp160r1 curve. * * @note When this PASE configuration is enabled, the corresponding - * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1) + * elliptic curve (i.e. #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1) * should also be enabled. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 0 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG2 +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG2 0 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG2 /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG3 * * @brief - * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * This chip PASE configuration uses Elliptic Curve J-PAKE with a * SECG secp192r1 curve. * * @note When this PASE configuration is enabled, the corresponding - * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1) + * elliptic curve (i.e. #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1) * should also be enabled. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 0 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG3 +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG3 0 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG3 /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG4 * * @brief - * This Weave PASE configuration uses Elliptic Curve J-PAKE with a - * SECG secp224r1 curve and will be the new, default Weave PASE + * This chip PASE configuration uses Elliptic Curve J-PAKE with a + * SECG secp224r1 curve and will be the new, default chip PASE * configuration. * * @note When this PASE configuration is enabled, the corresponding - * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1) + * elliptic curve (i.e. #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1) * should also be enabled. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 1 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG4 +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG4 1 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG4 /** - * @def WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 + * @def CHIP_CONFIG_SUPPORT_PASE_CONFIG5 * * @brief - * This Weave PASE configuration uses Elliptic Curve J-PAKE with a + * This chip PASE configuration uses Elliptic Curve J-PAKE with a * SECG secp256r1 curve. * * @note When this PASE configuration is enabled, the corresponding - * elliptic curve (i.e. #WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1) + * elliptic curve (i.e. #CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1) * should also be enabled. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 -#define WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 0 -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 +#ifndef CHIP_CONFIG_SUPPORT_PASE_CONFIG5 +#define CHIP_CONFIG_SUPPORT_PASE_CONFIG5 0 +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG5 /** * @} */ -#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 -#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 is asserted" -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG2 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#if CHIP_CONFIG_SUPPORT_PASE_CONFIG2 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 +#error "Please assert CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 when CHIP_CONFIG_SUPPORT_PASE_CONFIG2 is asserted" +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG2 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP160R1 -#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 -#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 is asserted" -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG3 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#if CHIP_CONFIG_SUPPORT_PASE_CONFIG3 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#error "Please assert CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 when CHIP_CONFIG_SUPPORT_PASE_CONFIG3 is asserted" +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG3 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 -#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 -#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 is asserted" -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG4 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#if CHIP_CONFIG_SUPPORT_PASE_CONFIG4 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#error "Please assert CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 when CHIP_CONFIG_SUPPORT_PASE_CONFIG4 is asserted" +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG4 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 -#if WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 -#error "Please assert WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 when WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 is asserted" -#endif // WEAVE_CONFIG_SUPPORT_PASE_CONFIG5 && !WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#if CHIP_CONFIG_SUPPORT_PASE_CONFIG5 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#error "Please assert CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 when CHIP_CONFIG_SUPPORT_PASE_CONFIG5 is asserted" +#endif // CHIP_CONFIG_SUPPORT_PASE_CONFIG5 && !CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 /** - * @def WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT + * @def CHIP_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT * * @brief * Align payload on 4-byte boundary for PASE messages. @@ -419,34 +417,34 @@ * aligned this option should stay deasserted to save code size. * */ -#ifndef WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT -#if WEAVE_CONFIG_USE_MICRO_ECC -#define WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 1 +#ifndef CHIP_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT +#if CHIP_CONFIG_USE_MICRO_ECC +#define CHIP_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 1 #else -#define WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 0 -#endif // WEAVE_CONFIG_USE_MICRO_ECC -#endif // WEAVE_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT +#define CHIP_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT 0 +#endif // CHIP_CONFIG_USE_MICRO_ECC +#endif // CHIP_CONFIG_PASE_MESSAGE_PAYLOAD_ALIGNMENT /** - * @def WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT + * @def CHIP_CONFIG_PASE_RATE_LIMITER_TIMEOUT * * @brief * The amount of time (in milliseconds) in which the Security Manager - * is allowed to have maximum #WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS + * is allowed to have maximum #CHIP_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS * counted PASE attempts. * */ -#ifndef WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT -#define WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT 15000 -#endif // WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT +#ifndef CHIP_CONFIG_PASE_RATE_LIMITER_TIMEOUT +#define CHIP_CONFIG_PASE_RATE_LIMITER_TIMEOUT 15000 +#endif // CHIP_CONFIG_PASE_RATE_LIMITER_TIMEOUT /** - * @def WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS + * @def CHIP_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS * * @brief * The maximum number of PASE attempts after which the * next PASE session establishment attempt will be allowed - * only after #WEAVE_CONFIG_PASE_RATE_LIMITER_TIMEOUT expires. + * only after #CHIP_CONFIG_PASE_RATE_LIMITER_TIMEOUT expires. * * For PASE negotiations with key confirmation option enabled: * only attempts that failed with key confirmation error are counted. * Successful PASE negotiations do not reset the rate limiter. @@ -455,20 +453,20 @@ * to the rate limiter. * */ -#ifndef WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS -#define WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS 3 -#endif // WEAVE_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS +#ifndef CHIP_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS +#define CHIP_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS 3 +#endif // CHIP_CONFIG_PASE_RATE_LIMITER_MAX_ATTEMPTS /** - * @name Weave Security Manager Memory Management Configuration + * @name chip Security Manager Memory Management Configuration * * @brief - * The following definitions enable one of three potential Weave + * The following definitions enable one of three potential chip * Security Manager memory-management options: * - * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM - * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE - * * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC + * * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + * * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + * * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC * * Note that these options are mutually exclusive and only one * of these options should be set. @@ -477,68 +475,68 @@ */ /** - * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + * @def CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM * * @brief * Enable (1) or disable (0) support for platform-specific - * implementation of Weave Security Manager memory-management + * implementation of chip Security Manager memory-management * functions. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE and - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE and + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. * */ -#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM -#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM 0 -#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM +#ifndef CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM +#define CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM 0 +#endif // CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM /** - * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + * @def CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE * * @brief - * Enable (1) or disable (0) support for a Weave-provided - * implementation of Weave Security Manager memory-management + * Enable (1) or disable (0) support for a chip-provided + * implementation of chip Security Manager memory-management * functions based on temporary network buffer allocation / * release. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC. * */ -#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE -#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE 0 -#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE +#ifndef CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE +#define CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE 0 +#endif // CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE /** - * @def WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC + * @def CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC * * @brief - * Enable (1) or disable (0) support for a Weave-provided - * implementation of Weave Security Manager memory-management + * Enable (1) or disable (0) support for a chip-provided + * implementation of chip Security Manager memory-management * functions based on the C Standard Library malloc / free * functions. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE. + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM and + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE. * */ -#ifndef WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC -#define WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC 1 -#endif // WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC +#ifndef CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC +#define CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC 1 +#endif // CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC /** * @} */ -#if ((WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) -#error "Please assert exactly one of WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM, WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE, or WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC." -#endif // ((WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) +#if ((CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) +#error "Please assert exactly one of CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM, CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE, or CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC." +#endif // ((CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_PLATFORM + CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE + CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_MALLOC) != 1) /** - * @def WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS + * @def CHIP_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS * * @brief * Enable (1) or disable (0) simple memory allocator support @@ -547,23 +545,23 @@ * 600 bytes. * * @note This configuration is only relevant when - * #WEAVE_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE is set and + * #CHIP_CONFIG_SECURITY_MGR_MEMORY_MGMT_SIMPLE is set and * ignored otherwise. * */ -#ifndef WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS -#define WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS 0 -#endif // WEAVE_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS +#ifndef CHIP_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS +#define CHIP_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS 0 +#endif // CHIP_CONFIG_SIMPLE_ALLOCATOR_USE_SMALL_BUFFERS /** - * @name Weave Security Manager Time-Consuming Crypto Alerts. + * @name chip Security Manager Time-Consuming Crypto Alerts. * * @brief - * The following definitions enable one of two potential Weave + * The following definitions enable one of two potential chip * Security Manager time-consuming crypto alerts implementations: * - * * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY - * * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM + * * #CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + * * #CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM * * Note that these options are mutually exclusive and only one * of these options should be set. @@ -572,55 +570,55 @@ */ /** - * @def WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + * @def CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY * * @brief - * Enable (1) or disable (0) support for Weave-provided dummy - * implementation of Weave security manager time-consuming + * Enable (1) or disable (0) support for chip-provided dummy + * implementation of chip security manager time-consuming * crypto alerts functions. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM. + * #CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM. * */ -#ifndef WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY -#define WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY 1 -#endif // WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY +#ifndef CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY +#define CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY 1 +#endif // CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY /** - * @def WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM + * @def CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM * * @brief * Enable (1) or disable (0) support for a platform-specific - * implementation of Weave security manager time-consuming + * implementation of chip security manager time-consuming * crypto alerts functions. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY. + * #CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY. * */ -#ifndef WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM -#define WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM 0 -#endif // WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM +#ifndef CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM +#define CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM 0 +#endif // CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM /** * @} */ -#if ((WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) -#error "Please assert exactly one of WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY or WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM." -#endif // ((WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + WEAVE_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) +#if ((CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) +#error "Please assert exactly one of CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY or CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM." +#endif // ((CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_DUMMY + CHIP_CONFIG_SECURITY_MGR_TIME_ALERTS_PLATFORM) != 1) /** - * @name Weave Random Number Generator (RNG) Implementation Configuration + * @name chip Random Number Generator (RNG) Implementation Configuration * * @brief - * The following definitions enable one of three potential Weave + * The following definitions enable one of three potential chip * RNG implementation options: * - * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM - * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG - * * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL + * * #CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM + * * #CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * * #CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL * * Note that these options are mutually exclusive and only one of * these options should be set. @@ -629,104 +627,104 @@ */ /** - * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + * @def CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM * * @brief * Enable (1) or disable (0) support for platform-specific - * implementation of the Weave Random Number Generator. + * implementation of the chip Random Number Generator. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG and - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL. + * #CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG and + * #CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL. * */ -#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM -#define WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM 0 -#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM +#ifndef CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM +#define CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM 0 +#endif // CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM /** - * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * @def CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG * * @brief - * Enable (1) or disable (0) support for a Weave-provided - * implementation of the Weave Random Number Generator. + * Enable (1) or disable (0) support for a chip-provided + * implementation of the chip Random Number Generator. * This implementation is based on AES-CTR DRBG as * specified in the NIST SP800-90A document. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM and - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL. + * #CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM and + * #CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL. * */ -#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG -#define WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG 0 -#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG +#ifndef CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG +#define CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG 0 +#endif // CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG /** - * @def WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL + * @def CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL * * @brief * Enable (1) or disable (0) support for a standard OpenSSL - * implementation of the Weave Random Number Generator. + * implementation of the chip Random Number Generator. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM and - * #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG. + * #CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM and + * #CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG. * */ -#ifndef WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL -#define WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL 1 -#endif // WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL +#ifndef CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL +#define CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL 1 +#endif // CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL /** * @} */ -#if ((WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) -#error "Please assert exactly one of WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM, WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG, or WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL." -#endif // ((WEAVE_CONFIG_RNG_IMPLEMENTATION_PLATFORM + WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + WEAVE_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) +#if ((CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM + CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) +#error "Please assert exactly one of CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM, CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG, or CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL." +#endif // ((CHIP_CONFIG_RNG_IMPLEMENTATION_PLATFORM + CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + CHIP_CONFIG_RNG_IMPLEMENTATION_OPENSSL) != 1) /** - * @def WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED + * @def CHIP_CONFIG_DEV_RANDOM_DRBG_SEED * * @brief * Enable (1) or disable (0) a function for seeding the DRBG with * entropy from the /dev/(u)random device. * - * @note When enabled along with #WEAVE_CONFIG_RNG_IMPLEMENTATION_NESTDRBG + * @note When enabled along with #CHIP_CONFIG_RNG_IMPLEMENTATION_NESTDRBG * this function becomes the default seeding function for the DRBG if * another isn't specified at initialization time. * */ -#ifndef WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED -#define WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED 0 -#endif // WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED +#ifndef CHIP_CONFIG_DEV_RANDOM_DRBG_SEED +#define CHIP_CONFIG_DEV_RANDOM_DRBG_SEED 0 +#endif // CHIP_CONFIG_DEV_RANDOM_DRBG_SEED /** - * @def WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME + * @def CHIP_CONFIG_DEV_RANDOM_DEVICE_NAME * * @brief * The device name used by the dev random entropy function. * - * @note Only meaningful when #WEAVE_CONFIG_DEV_RANDOM_DRBG_SEED is enabled. + * @note Only meaningful when #CHIP_CONFIG_DEV_RANDOM_DRBG_SEED is enabled. * */ -#ifndef WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME -#define WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME "/dev/urandom" -#endif // WEAVE_CONFIG_DEV_RANDOM_DEVICE_NAME +#ifndef CHIP_CONFIG_DEV_RANDOM_DEVICE_NAME +#define CHIP_CONFIG_DEV_RANDOM_DEVICE_NAME "/dev/urandom" +#endif // CHIP_CONFIG_DEV_RANDOM_DEVICE_NAME /** - * @name Weave AES Block Cipher Algorithm Implementation Configuration. + * @name chip AES Block Cipher Algorithm Implementation Configuration. * * @brief - * The following definitions enable one of the potential Weave + * The following definitions enable one of the potential chip * AES implementation options: * - * * #WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM - * * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + * * #CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM + * * #CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL * * Note that these options are mutually exclusive and only one of * these options should be set. @@ -735,104 +733,104 @@ */ /** - * @def WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + * @def CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM * * @brief * Enable (1) or disable (0) support for platform-specific - * implementation of the Weave AES functions. + * implementation of the chip AES functions. * * @note This configuration is mutual exclusive with - * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL and - * #WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + * #CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL and + * #CHIP_CONFIG_AES_IMPLEMENTATION_AESNI * */ -#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM -#define WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM 0 -#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM +#ifndef CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM +#define CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM 0 +#endif // CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM /** - * @def WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + * @def CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL * * @brief * Enable (1) or disable (0) support for the OpenSSL - * implementation of the Weave AES functions. + * implementation of the chip AES functions. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * CHIP_CONFIG_AES_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL -#define WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL 1 -#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL +#ifndef CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL +#define CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL 1 +#endif // CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL /** - * @def WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + * @def CHIP_CONFIG_AES_IMPLEMENTATION_AESNI * * @brief * Enable (1) or disable (0) support for an implementation - * of the Weave AES functions using Intel AES-NI intrinsics. + * of the chip AES functions using Intel AES-NI intrinsics. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * CHIP_CONFIG_AES_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI -#define WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI 0 -#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI +#ifndef CHIP_CONFIG_AES_IMPLEMENTATION_AESNI +#define CHIP_CONFIG_AES_IMPLEMENTATION_AESNI 0 +#endif // CHIP_CONFIG_AES_IMPLEMENTATION_AESNI /** - * @def WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS + * @def CHIP_CONFIG_AES_IMPLEMENTATION_MBEDTLS * * @brief * Enable (1) or disable (0) support the mbed TLS - * implementation of the Weave AES functions. + * implementation of the chip AES functions. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_AES_IMPLEMENTATION options. + * CHIP_CONFIG_AES_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS -#define WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS 0 -#endif // WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS +#ifndef CHIP_CONFIG_AES_IMPLEMENTATION_MBEDTLS +#define CHIP_CONFIG_AES_IMPLEMENTATION_MBEDTLS 0 +#endif // CHIP_CONFIG_AES_IMPLEMENTATION_MBEDTLS /** * @} */ -#if ((WEAVE_CONFIG_AES_IMPLEMENTATION_PLATFORM + \ - WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL + \ - WEAVE_CONFIG_AES_IMPLEMENTATION_AESNI + \ - WEAVE_CONFIG_AES_IMPLEMENTATION_MBEDTLS) != 1) -#error "Please assert exactly one WEAVE_CONFIG_AES_IMPLEMENTATION_... option." +#if ((CHIP_CONFIG_AES_IMPLEMENTATION_PLATFORM + \ + CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL + \ + CHIP_CONFIG_AES_IMPLEMENTATION_AESNI + \ + CHIP_CONFIG_AES_IMPLEMENTATION_MBEDTLS) != 1) +#error "Please assert exactly one CHIP_CONFIG_AES_IMPLEMENTATION_... option." #endif /** - * @def WEAVE_CONFIG_AES_USE_EXPANDED_KEY + * @def CHIP_CONFIG_AES_USE_EXPANDED_KEY * * @brief * Defines whether AES key is used in its expanded (1) or native (0) form. * * @note OpenSSL AES implementation uses its own AES key declaration * and this configuration option is ignored when - * #WEAVE_CONFIG_AES_IMPLEMENTATION_OPENSSL is set. + * #CHIP_CONFIG_AES_IMPLEMENTATION_OPENSSL is set. * */ -#ifndef WEAVE_CONFIG_AES_USE_EXPANDED_KEY -#define WEAVE_CONFIG_AES_USE_EXPANDED_KEY 0 -#endif // WEAVE_CONFIG_AES_USE_EXPANDED_KEY +#ifndef CHIP_CONFIG_AES_USE_EXPANDED_KEY +#define CHIP_CONFIG_AES_USE_EXPANDED_KEY 0 +#endif // CHIP_CONFIG_AES_USE_EXPANDED_KEY /** - * @name Weave SHA1 and SHA256 Hash Algorithms Implementation Configuration. + * @name chip SHA1 and SHA256 Hash Algorithms Implementation Configuration. * * @brief - * The following definitions enable one of three potential Weave + * The following definitions enable one of three potential chip * hash implementation options: * - * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM - * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT - * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL - * * #WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS + * * #CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM + * * #CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + * * #CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL + * * #CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS * * Note that these options are mutually exclusive and only one of * these options should be set. @@ -841,91 +839,91 @@ */ /** - * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + * @def CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM * * @brief * Enable (1) or disable (0) support for platform-specific - * implementation of the Weave SHA1 and SHA256 hashes. + * implementation of the chip SHA1 and SHA256 hashes. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * CHIP_CONFIG_HASH_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM -#define WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM 0 -#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM +#ifndef CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM +#define CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM 0 +#endif // CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM /** - * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + * @def CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT * * @brief - * Enable (1) or disable (0) support for a Weave-provided - * implementation of the Weave SHA1 and SHA256 hash functions. + * Enable (1) or disable (0) support for a chip-provided + * implementation of the chip SHA1 and SHA256 hash functions. * This implementation is using sha1 and sha256 engines from * mincrypt library of Android core. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * CHIP_CONFIG_HASH_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT -#define WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT 0 -#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT +#ifndef CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT +#define CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT 0 +#endif // CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT /** - * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + * @def CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL * * @brief * Enable (1) or disable (0) support for the OpenSSL - * implementation of the Weave SHA1 and SHA256 hash functions. + * implementation of the chip SHA1 and SHA256 hash functions. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * CHIP_CONFIG_HASH_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL -#define WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL 1 -#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL +#ifndef CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL +#define CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL 1 +#endif // CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL /** - * @def WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS + * @def CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS * * @brief * Enable (1) or disable (0) support for the mbedTLS - * implementation of the Weave SHA1 and SHA256 hash functions. + * implementation of the chip SHA1 and SHA256 hash functions. * * @note This configuration is mutual exclusive with other - * WEAVE_CONFIG_HASH_IMPLEMENTATION options. + * CHIP_CONFIG_HASH_IMPLEMENTATION options. * */ -#ifndef WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS -#define WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS 0 -#endif // WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS +#ifndef CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS +#define CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS 0 +#endif // CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS /** * @} */ -#if ((WEAVE_CONFIG_HASH_IMPLEMENTATION_PLATFORM + \ - WEAVE_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + \ - WEAVE_CONFIG_HASH_IMPLEMENTATION_OPENSSL + \ - WEAVE_CONFIG_HASH_IMPLEMENTATION_MBEDTLS) != 1) -#error "Please assert exactly one WEAVE_CONFIG_HASH_IMPLEMENTATION_... option." +#if ((CHIP_CONFIG_HASH_IMPLEMENTATION_PLATFORM + \ + CHIP_CONFIG_HASH_IMPLEMENTATION_MINCRYPT + \ + CHIP_CONFIG_HASH_IMPLEMENTATION_OPENSSL + \ + CHIP_CONFIG_HASH_IMPLEMENTATION_MBEDTLS) != 1) +#error "Please assert exactly one CHIP_CONFIG_HASH_IMPLEMENTATION_... option." #endif /** - * @name Weave key export protocol configuration. + * @name chip key export protocol configuration. * * @brief * The following definitions define the configurations supported - * for Weave's key export protocol. + * for chip's key export protocol. * - * This protocol is used to export secret key material from Weave device. - * Weave supports the following protocol configurations: + * This protocol is used to export secret key material from chip device. + * chip supports the following protocol configurations: * - * * #WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 - * * #WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 + * * #CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 + * * #CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 * * which are summarized in the table below: * @@ -939,28 +937,28 @@ */ /** - * @def WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 + * @def CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 * * @brief - * This Weave key export protocol configuration uses secp224r1 + * This chip key export protocol configuration uses secp224r1 * Elliptic Curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 -#define WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 1 -#endif // WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 +#ifndef CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 +#define CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 1 +#endif // CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG1 /** - * @def WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 + * @def CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 * * @brief - * This Weave key export protocol configuration uses secp256r1 + * This chip key export protocol configuration uses secp256r1 * Elliptic Curve. * */ -#ifndef WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 -#define WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 1 -#endif // WEAVE_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 +#ifndef CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 +#define CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 1 +#endif // CHIP_CONFIG_SUPPORT_KEY_EXPORT_CONFIG2 /** * @} @@ -968,196 +966,196 @@ /** - * @def WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES + * @def CHIP_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES * * @brief * Allow the use of elliptic curves beyond the standard ones - * supported by Weave. + * supported by chip. * */ -#ifndef WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES -#define WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES 0 -#endif // WEAVE_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES +#ifndef CHIP_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES +#define CHIP_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES 0 +#endif // CHIP_CONFIG_ALLOW_NON_STANDARD_ELLIPTIC_CURVES /** - * @def WEAVE_CONFIG_MAX_EC_BITS + * @def CHIP_CONFIG_MAX_EC_BITS * * @brief * The maximum size elliptic curve supported, in bits. * */ -#ifndef WEAVE_CONFIG_MAX_EC_BITS -#define WEAVE_CONFIG_MAX_EC_BITS 256 -#endif // WEAVE_CONFIG_MAX_EC_BITS +#ifndef CHIP_CONFIG_MAX_EC_BITS +#define CHIP_CONFIG_MAX_EC_BITS 256 +#endif // CHIP_CONFIG_MAX_EC_BITS /** - * @def WEAVE_CONFIG_MAX_RSA_BITS + * @def CHIP_CONFIG_MAX_RSA_BITS * * @brief * The maximum size RSA modulus supported, in bits. * */ -#ifndef WEAVE_CONFIG_MAX_RSA_BITS -#define WEAVE_CONFIG_MAX_RSA_BITS 4096 -#endif // WEAVE_CONFIG_MAX_RSA_BITS +#ifndef CHIP_CONFIG_MAX_RSA_BITS +#define CHIP_CONFIG_MAX_RSA_BITS 4096 +#endif // CHIP_CONFIG_MAX_RSA_BITS /** - * @def WEAVE_CONFIG_MAX_PEER_NODES + * @def CHIP_CONFIG_MAX_PEER_NODES * * @brief * Maximum number of peer nodes that the local node can communicate * with. * */ -#ifndef WEAVE_CONFIG_MAX_PEER_NODES -#define WEAVE_CONFIG_MAX_PEER_NODES 128 -#endif // WEAVE_CONFIG_MAX_PEER_NODES +#ifndef CHIP_CONFIG_MAX_PEER_NODES +#define CHIP_CONFIG_MAX_PEER_NODES 128 +#endif // CHIP_CONFIG_MAX_PEER_NODES /** - * @def WEAVE_CONFIG_MAX_CONNECTIONS + * @def CHIP_CONFIG_MAX_CONNECTIONS * * @brief * Maximum number of simultaneously active connections. * */ -#ifndef WEAVE_CONFIG_MAX_CONNECTIONS -#define WEAVE_CONFIG_MAX_CONNECTIONS INET_CONFIG_NUM_TCP_ENDPOINTS -#endif // WEAVE_CONFIG_MAX_CONNECTIONS +#ifndef CHIP_CONFIG_MAX_CONNECTIONS +#define CHIP_CONFIG_MAX_CONNECTIONS INET_CONFIG_NUM_TCP_ENDPOINTS +#endif // CHIP_CONFIG_MAX_CONNECTIONS /** - * @def WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS + * @def CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS * * @brief * Maximum number of simultaneously active inbound TCP connections. * - * Regardless of what #WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS + * Regardless of what #CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS * is set to, the total number of inbound connections cannot exceed - * #WEAVE_CONFIG_MAX_CONNECTIONS, which is the overall limit for + * #CHIP_CONFIG_MAX_CONNECTIONS, which is the overall limit for * inbound and outbound connections. */ -#ifndef WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS -#define WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS (WEAVE_CONFIG_MAX_CONNECTIONS * 4 / 5) -#endif // WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS +#ifndef CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS +#define CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS (CHIP_CONFIG_MAX_CONNECTIONS * 4 / 5) +#endif // CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS /** - * @def WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP + * @def CHIP_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP * * @brief * Maximum number of simultaneously active inbound TCP connections * from the single IP address. * - * Regardless of what #WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP + * Regardless of what #CHIP_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP * is set to, the total number of inbound connections from a single IP - * address cannot exceed #WEAVE_CONFIG_MAX_CONNECTIONS or - * #WEAVE_CONFIG_MAX_INCOMING_TCP_CONNECTIONS. + * address cannot exceed #CHIP_CONFIG_MAX_CONNECTIONS or + * #CHIP_CONFIG_MAX_INCOMING_TCP_CONNECTIONS. */ -#ifndef WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP -#define WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP 2 -#endif // WEAVE_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP +#ifndef CHIP_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP +#define CHIP_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP 2 +#endif // CHIP_CONFIG_MAX_INCOMING_TCP_CON_FROM_SINGLE_IP /** - * @def WEAVE_CONFIG_MAX_TUNNELS + * @def CHIP_CONFIG_MAX_TUNNELS * * @brief * Maximum number of simultaneously active connection tunnels. * */ -#ifndef WEAVE_CONFIG_MAX_TUNNELS -#define WEAVE_CONFIG_MAX_TUNNELS 1 -#endif // WEAVE_CONFIG_MAX_TUNNELS +#ifndef CHIP_CONFIG_MAX_TUNNELS +#define CHIP_CONFIG_MAX_TUNNELS 1 +#endif // CHIP_CONFIG_MAX_TUNNELS /** - * @def WEAVE_CONFIG_MAX_SESSION_KEYS + * @def CHIP_CONFIG_MAX_SESSION_KEYS * * @brief * Maximum number of simultaneously active session keys. * */ -#ifndef WEAVE_CONFIG_MAX_SESSION_KEYS -#define WEAVE_CONFIG_MAX_SESSION_KEYS WEAVE_CONFIG_MAX_CONNECTIONS -#endif // WEAVE_CONFIG_MAX_SESSION_KEYS +#ifndef CHIP_CONFIG_MAX_SESSION_KEYS +#define CHIP_CONFIG_MAX_SESSION_KEYS CHIP_CONFIG_MAX_CONNECTIONS +#endif // CHIP_CONFIG_MAX_SESSION_KEYS /** - * @def WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS + * @def CHIP_CONFIG_MAX_APPLICATION_EPOCH_KEYS * * @brief * Maximum number of simultaneously supported application epoch keys. * This define should be set to the maximum number of epoch keys - * that can be simultaneously provisioned on Weave node by Weave + * that can be simultaneously provisioned on chip node by chip * service. The maximum supported value is 8, however, in most cases * only two such keys will exist on device at any given point in time. * */ -#ifndef WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS -#define WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS 4 -#endif // WEAVE_CONFIG_MAX_APPLICATION_EPOCH_KEYS +#ifndef CHIP_CONFIG_MAX_APPLICATION_EPOCH_KEYS +#define CHIP_CONFIG_MAX_APPLICATION_EPOCH_KEYS 4 +#endif // CHIP_CONFIG_MAX_APPLICATION_EPOCH_KEYS /** - * @def WEAVE_CONFIG_MAX_APPLICATION_GROUPS + * @def CHIP_CONFIG_MAX_APPLICATION_GROUPS * * @brief * Maximum number of simultaneously supported application groups. - * This define should be set to the number of Weave application - * groups, in which associated Weave node has membership. + * This define should be set to the number of chip application + * groups, in which associated chip node has membership. * */ -#ifndef WEAVE_CONFIG_MAX_APPLICATION_GROUPS -#define WEAVE_CONFIG_MAX_APPLICATION_GROUPS 8 -#endif // WEAVE_CONFIG_MAX_APPLICATION_GROUPS +#ifndef CHIP_CONFIG_MAX_APPLICATION_GROUPS +#define CHIP_CONFIG_MAX_APPLICATION_GROUPS 8 +#endif // CHIP_CONFIG_MAX_APPLICATION_GROUPS /** - * @def WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC + * @def CHIP_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC * * @brief * Enable (1) or disable (0) support for the application group keys - * used for Weave message encryption. + * used for chip message encryption. * */ -#ifndef WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC -#define WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC 1 -#endif // WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC +#ifndef CHIP_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC +#define CHIP_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC 1 +#endif // CHIP_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC /** - * @def WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS + * @def CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS * * @brief - * Maximum number of simultaneously cached Weave message encryption + * Maximum number of simultaneously cached chip message encryption * application keys. * Caching these keys speeds up message encoding/decoding processes * and eliminates the need to retrieve constituent key material from * the platform memory every time we derive these keys. * This define can be set equal to the number of application groups - * (#WEAVE_CONFIG_MAX_APPLICATION_GROUPS) supported by the Weave node + * (#CHIP_CONFIG_MAX_APPLICATION_GROUPS) supported by the chip node * such that exactly one key can be cached for each application group. * It might be a good idea to allocate few more entries in the key * cache for the corner cases, where application group is having * simultaneous conversations using an 'old' and a 'new' epoch key. * * @note This configuration is only relevant when - * #WEAVE_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC is set and + * #CHIP_CONFIG_USE_APP_GROUP_KEYS_FOR_MSG_ENC is set and * ignored otherwise. * */ -#ifndef WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS -#define WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS (WEAVE_CONFIG_MAX_APPLICATION_GROUPS + 1) -#endif // WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS +#ifndef CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS +#define CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS (CHIP_CONFIG_MAX_APPLICATION_GROUPS + 1) +#endif // CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS -#if !(WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) -#error "Please set WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS to a value greater than zero and smaller than 256." -#endif // !(WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && WEAVE_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) +#if !(CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) +#error "Please set CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS to a value greater than zero and smaller than 256." +#endif // !(CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS > 0 && CHIP_CONFIG_MAX_CACHED_MSG_ENC_APP_KEYS < 256) /** - * @name Weave Encrypted Passcode Configuration + * @name chip Encrypted Passcode Configuration * * @brief * The following definitions enable (1) or disable (0) supported for - * Weave encrypted passcode configurations. Each configuration - * uniquely specifies how Weave passcode was encrypted, authenticated, - * and structured. Weave supports the following passcode + * chip encrypted passcode configurations. Each configuration + * uniquely specifies how chip passcode was encrypted, authenticated, + * and structured. chip supports the following passcode * configurations: * - * * #WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY - * * #WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 + * * #CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY + * * #CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG2 * * which are summarized in the table below: * @@ -1171,10 +1169,10 @@ */ /** - * @def WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY + * @def CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY * * @brief - * This Weave passcode configuration does not encrypt the passcode + * This chip passcode configuration does not encrypt the passcode * and doesn't use secret keys to authenticate and uniquely identify * (fingerprint) the passcode. * @@ -1185,42 +1183,42 @@ * cryptography. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY -#define WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY 0 -#endif // WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY +#ifndef CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY +#define CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY 0 +#endif // CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY /** - * @def WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 + * @def CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG2 * * @brief - * This Weave passcode configuration uses AES128 algorithm in ECB + * This chip passcode configuration uses AES128 algorithm in ECB * mode to encrypt passcodes. It also uses SHA1 Hash-based Message * Authentication Code (HMAC) to authenticate and uniquely identify * (fingerprint) the passcode. * */ -#ifndef WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 -#define WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 1 -#endif // WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG2 +#ifndef CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG2 +#define CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG2 1 +#endif // CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG2 /** * @} */ /** - * @def WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT + * @def CHIP_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT * * @brief * The default amount of time, in milliseconds, after which an in-progess * session establishment will fail due to a timeout. * */ -#ifndef WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT -#define WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT 30000 -#endif // WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT +#ifndef CHIP_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT +#define CHIP_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT 30000 +#endif // CHIP_CONFIG_DEFAULT_SECURITY_SESSION_ESTABLISHMENT_TIMEOUT /** - * @def WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT + * @def CHIP_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT * * @brief * The default minimum amount of time, in milliseconds, that an unreserved and idle @@ -1228,97 +1226,97 @@ * unreserved idle sessions can exist for up to twice this value. * */ -#ifndef WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT -#define WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT 15000 -#endif // WEAVE_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT +#ifndef CHIP_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT +#define CHIP_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT 15000 +#endif // CHIP_CONFIG_DEFAULT_SECURITY_SESSION_IDLE_TIMEOUT /** - * @def WEAVE_CONFIG_NUM_MESSAGE_BUFS + * @def CHIP_CONFIG_NUM_MESSAGE_BUFS * * @brief * Total number of message buffers. Only used for the BSD sockets * configuration. * */ -#ifndef WEAVE_CONFIG_NUM_MESSAGE_BUFS -#define WEAVE_CONFIG_NUM_MESSAGE_BUFS 16 -#endif // WEAVE_CONFIG_NUM_MESSAGE_BUFS +#ifndef CHIP_CONFIG_NUM_MESSAGE_BUFS +#define CHIP_CONFIG_NUM_MESSAGE_BUFS 16 +#endif // CHIP_CONFIG_NUM_MESSAGE_BUFS /** - * @def WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS + * @def CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS * * @brief * Maximum number of simultaneously active unsolicited message * handlers. * */ -#ifndef WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS -#define WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS 32 -#endif // WEAVE_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS +#ifndef CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS +#define CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS 32 +#endif // CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS /** - * @def WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS + * @def CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS * * @brief * Maximum number of simultaneously active exchange contexts. * */ -#ifndef WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS -#define WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS 16 -#endif // WEAVE_CONFIG_MAX_EXCHANGE_CONTEXTS +#ifndef CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS +#define CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS 16 +#endif // CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS /** - * @def WEAVE_CONFIG_MAX_BINDINGS + * @def CHIP_CONFIG_MAX_BINDINGS * * @brief - * Maximum number of simultaneously active bindings per WeaveExchangeManager + * Maximum number of simultaneously active bindings per chipExchangeManager * The new single source TimeSync client takes one binding. * Every WDM one-way subscription takes one binding. Mutual subscription counts as two one-way subscriptions. * A reserved slot is needed to take an incoming subscription request. * For a device with 2 mutual subscriptions, and one single source time sync client, it needs 2 x 2 + 1 = 5 bindings at least. * At least six is needed if it still wants to take new WDM subscriptions under this load. */ -#ifndef WEAVE_CONFIG_MAX_BINDINGS -#define WEAVE_CONFIG_MAX_BINDINGS 6 -#endif // WEAVE_CONFIG_MAX_BINDINGS +#ifndef CHIP_CONFIG_MAX_BINDINGS +#define CHIP_CONFIG_MAX_BINDINGS 6 +#endif // CHIP_CONFIG_MAX_BINDINGS /** - * @def WEAVE_CONFIG_CONNECT_IP_ADDRS + * @def CHIP_CONFIG_CONNECT_IP_ADDRS * * @brief * Maximum number of IP addresses tried when connecting to a * hostname. * */ -#ifndef WEAVE_CONFIG_CONNECT_IP_ADDRS -#define WEAVE_CONFIG_CONNECT_IP_ADDRS 4 -#endif // WEAVE_CONFIG_CONNECT_IP_ADDRS +#ifndef CHIP_CONFIG_CONNECT_IP_ADDRS +#define CHIP_CONFIG_CONNECT_IP_ADDRS 4 +#endif // CHIP_CONFIG_CONNECT_IP_ADDRS /** - * @def WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE + * @def CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE * * @brief * The default MTU size for an IPv6 datagram carrying UDP. This is useful - * for senders who want to send UDP Weave messages that fit within a single + * for senders who want to send UDP chip messages that fit within a single * IPv6 datagram. * * 1280 is the guaranteed minimum IPv6 MTU. * */ -#ifndef WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE -#define WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE 1280 -#endif // WEAVE_CONFIG_DEFAULT_UDP_MTU_SIZE +#ifndef CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE +#define CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE 1280 +#endif // CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE /** - * @def WEAVE_HEADER_RESERVE_SIZE + * @def CHIP_HEADER_RESERVE_SIZE * * @brief * The number of bytes to reserve in a network packet buffer to contain the - * Weave message and exchange headers. + * chip message and exchange headers. * * This number was calculated as follows: * - * Weave Message Header: + * chip Message Header: * * 2 -- Frame Length * 2 -- Message Header @@ -1327,7 +1325,7 @@ * 8 -- Destination Node Id * 2 -- Key Id * - * Weave Exchange Header: + * chip Exchange Header: * * 1 -- Application Version * 1 -- Message Type @@ -1339,108 +1337,108 @@ * So most headers will be considerably smaller than this. * */ -#ifndef WEAVE_HEADER_RESERVE_SIZE -#define WEAVE_HEADER_RESERVE_SIZE 38 -#endif // WEAVE_HEADER_RESERVE_SIZE +#ifndef CHIP_HEADER_RESERVE_SIZE +#define CHIP_HEADER_RESERVE_SIZE 38 +#endif // CHIP_HEADER_RESERVE_SIZE /** - * @def WEAVE_TRAILER_RESERVE_SIZE + * @def CHIP_TRAILER_RESERVE_SIZE * * @brief * TODO * */ -#ifndef WEAVE_TRAILER_RESERVE_SIZE -#define WEAVE_TRAILER_RESERVE_SIZE 20 -#endif // WEAVE_TRAILER_RESERVE_SIZE +#ifndef CHIP_TRAILER_RESERVE_SIZE +#define CHIP_TRAILER_RESERVE_SIZE 20 +#endif // CHIP_TRAILER_RESERVE_SIZE /** - * @def WEAVE_PORT + * @def CHIP_PORT * * @brief - * Weave TCP/UDP port for secured Weave traffic. + * chip TCP/UDP port for secured chip traffic. * */ -#ifndef WEAVE_PORT -#define WEAVE_PORT 11095 -#endif // WEAVE_PORT +#ifndef CHIP_PORT +#define CHIP_PORT 11095 +#endif // CHIP_PORT /** - * @def WEAVE_UNSECURED_PORT + * @def CHIP_UNSECURED_PORT * * @brief - * Weave TCP/UDP port for unsecured Weave traffic. + * chip TCP/UDP port for unsecured chip traffic. * */ -#ifndef WEAVE_UNSECURED_PORT -#define WEAVE_UNSECURED_PORT 11096 -#endif // WEAVE_UNSECURED_PORT +#ifndef CHIP_UNSECURED_PORT +#define CHIP_UNSECURED_PORT 11096 +#endif // CHIP_UNSECURED_PORT /** - * @def WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT + * @def CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT * * @brief - * Enable use of an ephemeral UDP source port for locally initiated Weave exchanges. + * Enable use of an ephemeral UDP source port for locally initiated chip exchanges. */ -#ifndef WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT -#define WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 0 -#endif // WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT +#ifndef CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT +#define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 0 +#endif // CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT /** - * @def WEAVE_CONFIG_SECURITY_TEST_MODE + * @def CHIP_CONFIG_SECURITY_TEST_MODE * * @brief - * Enable various features that make it easier to debug secure Weave communication. + * Enable various features that make it easier to debug secure chip communication. * * @note - * WARNING: This option makes it possible to circumvent basic Weave security functionality, + * WARNING: This option makes it possible to circumvent basic chip security functionality, * including message encryption. Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS. */ -#ifndef WEAVE_CONFIG_SECURITY_TEST_MODE -#define WEAVE_CONFIG_SECURITY_TEST_MODE 0 -#endif // WEAVE_CONFIG_SECURITY_TEST_MODE +#ifndef CHIP_CONFIG_SECURITY_TEST_MODE +#define CHIP_CONFIG_SECURITY_TEST_MODE 0 +#endif // CHIP_CONFIG_SECURITY_TEST_MODE /** - * @def WEAVE_CONFIG_ENABLE_DNS_RESOLVER + * @def CHIP_CONFIG_ENABLE_DNS_RESOLVER * * @brief * Enable support for resolving hostnames with a DNS resolver. */ -#ifndef WEAVE_CONFIG_ENABLE_DNS_RESOLVER -#define WEAVE_CONFIG_ENABLE_DNS_RESOLVER (INET_CONFIG_ENABLE_DNS_RESOLVER) -#endif // WEAVE_CONFIG_ENABLE_DNS_RESOLVER +#ifndef CHIP_CONFIG_ENABLE_DNS_RESOLVER +#define CHIP_CONFIG_ENABLE_DNS_RESOLVER (INET_CONFIG_ENABLE_DNS_RESOLVER) +#endif // CHIP_CONFIG_ENABLE_DNS_RESOLVER /** - * @def WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL + * @def CHIP_CONFIG_RESOLVE_IPADDR_LITERAL * * @brief * Enable support for resolving hostnames as literal IP addresses without a DNS resolver. * - * For historical reasons, the default is \c TRUE where \c WEAVE_SYSTEM_CONFIG_USE_SOCKETS=1, + * For historical reasons, the default is \c TRUE where \c CHIP_SYSTEM_CONFIG_USE_SOCKETS=1, * and \c FALSE otherwise. The exception in the LwIP-only case was originally made to facilitate * integration and change management with existing development lines. The default may * change in the future to \c TRUE in all cases. */ -#ifndef WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL -#define WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL (WEAVE_SYSTEM_CONFIG_USE_SOCKETS) -#endif // WEAVE_CONFIG_RESOLVE_IPADDR_LITERAL +#ifndef CHIP_CONFIG_RESOLVE_IPADDR_LITERAL +#define CHIP_CONFIG_RESOLVE_IPADDR_LITERAL (CHIP_SYSTEM_CONFIG_USE_SOCKETS) +#endif // CHIP_CONFIG_RESOLVE_IPADDR_LITERAL /** - * @def WEAVE_CONFIG_ENABLE_TARGETED_LISTEN + * @def CHIP_CONFIG_ENABLE_TARGETED_LISTEN * * @brief * Enable support for listening on particular addresses/interfaces. * - * This allows testing multiple instances of the Weave stack + * This allows testing multiple instances of the chip stack * running on a single host. * */ -#ifndef WEAVE_CONFIG_ENABLE_TARGETED_LISTEN -#define WEAVE_CONFIG_ENABLE_TARGETED_LISTEN (!WEAVE_SYSTEM_CONFIG_USE_LWIP) -#endif // WEAVE_CONFIG_ENABLE_TARGETED_LISTEN +#ifndef CHIP_CONFIG_ENABLE_TARGETED_LISTEN +#define CHIP_CONFIG_ENABLE_TARGETED_LISTEN (!CHIP_SYSTEM_CONFIG_USE_LWIP) +#endif // CHIP_CONFIG_ENABLE_TARGETED_LISTEN /** - * @def WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN + * @def CHIP_CONFIG_ENABLE_UNSECURED_TCP_LISTEN * * @brief * Enable support for receiving TCP connections over an unsecured @@ -1449,119 +1447,119 @@ * keys). * */ -#ifndef WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN -#define WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN 0 -#endif // WEAVE_CONFIG_ENABLE_UNSECURED_TCP_LISTEN +#ifndef CHIP_CONFIG_ENABLE_UNSECURED_TCP_LISTEN +#define CHIP_CONFIG_ENABLE_UNSECURED_TCP_LISTEN 0 +#endif // CHIP_CONFIG_ENABLE_UNSECURED_TCP_LISTEN /** - * @def WEAVE_CONFIG_DEBUG_CERT_VALIDATION + * @def CHIP_CONFIG_DEBUG_CERT_VALIDATION * * @brief * Enable support for debugging output from certificate validation. * */ -#ifndef WEAVE_CONFIG_DEBUG_CERT_VALIDATION -#define WEAVE_CONFIG_DEBUG_CERT_VALIDATION 1 -#endif // WEAVE_CONFIG_DEBUG_CERT_VALIDATION +#ifndef CHIP_CONFIG_DEBUG_CERT_VALIDATION +#define CHIP_CONFIG_DEBUG_CERT_VALIDATION 1 +#endif // CHIP_CONFIG_DEBUG_CERT_VALIDATION /** - * @def WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID + * @def CHIP_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID * * @brief - * EC curve to be used to generate Weave operational device certificate. + * EC curve to be used to generate chip operational device certificate. * */ -#ifndef WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID -#define WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime256v1) -#endif // WEAVE_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID +#ifndef CHIP_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID +#define CHIP_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID (chip::Profiles::Security::kchipCurveId_prime256v1) +#endif // CHIP_CONFIG_OPERATIONAL_DEVICE_CERT_CURVE_ID /** - * @def WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE + * @def CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE * * @brief - * This is a packed valid date to be encoded in the Weave + * This is a packed valid date to be encoded in the chip * operational device certificate. Any date before * that date the certificate is considered invalid. * The following functions can be used to calculate packed * date/time: PackCertTime() and PackedCertTimeToDate(). - * Weave packed certificate dates are limited to representing + * chip packed certificate dates are limited to representing * dates that are on or after 2000/01/01. * Mathematical expression to calculate packed date is: * (((year - 2000) * 12 + (mon - 1)) * 31 + (day - 1)) * Currently encoded value corresponds to 2019/01/01. * */ -#ifndef WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE -#define WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE 0x1B9C -#endif // WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE +#ifndef CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE +#define CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE 0x1B9C +#endif // CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_BEFORE /** - * @def WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER + * @def CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER * * @brief - * This is the valid date to be encoded in the Weave + * This is the valid date to be encoded in the chip * operational device certificate. Any date after * that date the certificate is considered invalid. * The following functions can be used to calculate packed * date/time: PackCertTime() and PackedCertTimeToDate(). - * Weave packed certificate dates are limited to representing + * chip packed certificate dates are limited to representing * dates that are on or after 2000/01/01. * Mathematical expression to calculate packed date is: * (((year - 2000) * 12 + (mon - 1)) * 31 + (day - 1)) * Currently encoded value corresponds to 2069/01/01. * */ -#ifndef WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER -#define WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER 0x6444 -#endif // WEAVE_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER +#ifndef CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER +#define CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER 0x6444 +#endif // CHIP_CONFIG_OP_DEVICE_CERT_VALID_DATE_NOT_AFTER /** - * @def WEAVE_CONFIG_ENABLE_PASE_INITIATOR + * @def CHIP_CONFIG_ENABLE_PASE_INITIATOR * * @brief * Enable support for initiating PASE sessions. * */ -#ifndef WEAVE_CONFIG_ENABLE_PASE_INITIATOR -#define WEAVE_CONFIG_ENABLE_PASE_INITIATOR 1 -#endif // WEAVE_CONFIG_ENABLE_PASE_INITIATOR +#ifndef CHIP_CONFIG_ENABLE_PASE_INITIATOR +#define CHIP_CONFIG_ENABLE_PASE_INITIATOR 1 +#endif // CHIP_CONFIG_ENABLE_PASE_INITIATOR /** - * @def WEAVE_CONFIG_ENABLE_PASE_RESPONDER + * @def CHIP_CONFIG_ENABLE_PASE_RESPONDER * * @brief * Enable support for responding to PASE sessions initiated by * other nodes. * */ -#ifndef WEAVE_CONFIG_ENABLE_PASE_RESPONDER -#define WEAVE_CONFIG_ENABLE_PASE_RESPONDER 1 -#endif // WEAVE_CONFIG_ENABLE_PASE_RESPONDER +#ifndef CHIP_CONFIG_ENABLE_PASE_RESPONDER +#define CHIP_CONFIG_ENABLE_PASE_RESPONDER 1 +#endif // CHIP_CONFIG_ENABLE_PASE_RESPONDER /** - * @def WEAVE_CONFIG_ENABLE_CASE_INITIATOR + * @def CHIP_CONFIG_ENABLE_CASE_INITIATOR * * @brief * Enable support for initiating CASE sessions. * */ -#ifndef WEAVE_CONFIG_ENABLE_CASE_INITIATOR -#define WEAVE_CONFIG_ENABLE_CASE_INITIATOR 1 -#endif // WEAVE_CONFIG_ENABLE_CASE_INITIATOR +#ifndef CHIP_CONFIG_ENABLE_CASE_INITIATOR +#define CHIP_CONFIG_ENABLE_CASE_INITIATOR 1 +#endif // CHIP_CONFIG_ENABLE_CASE_INITIATOR /** - * @def WEAVE_CONFIG_ENABLE_CASE_RESPONDER + * @def CHIP_CONFIG_ENABLE_CASE_RESPONDER * * @brief * Enable support for responding to CASE sessions initiated by other nodes. * */ -#ifndef WEAVE_CONFIG_ENABLE_CASE_RESPONDER -#define WEAVE_CONFIG_ENABLE_CASE_RESPONDER 1 -#endif // WEAVE_CONFIG_ENABLE_CASE_RESPONDER +#ifndef CHIP_CONFIG_ENABLE_CASE_RESPONDER +#define CHIP_CONFIG_ENABLE_CASE_RESPONDER 1 +#endif // CHIP_CONFIG_ENABLE_CASE_RESPONDER /** - * @def WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 + * @def CHIP_CONFIG_SUPPORT_CASE_CONFIG1 * * @brief * Enable use of CASE protocol configuration 1. @@ -1569,343 +1567,343 @@ * @note CASE config 1 uses SHA-1 for message signatures, which is deprecated. * */ -#ifndef WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 -#define WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 1 -#endif // WEAVE_CONFIG_SUPPORT_CASE_CONFIG1 +#ifndef CHIP_CONFIG_SUPPORT_CASE_CONFIG1 +#define CHIP_CONFIG_SUPPORT_CASE_CONFIG1 1 +#endif // CHIP_CONFIG_SUPPORT_CASE_CONFIG1 /** - * @def WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID + * @def CHIP_CONFIG_DEFAULT_CASE_CURVE_ID * * @brief * Default ECDH curve to be used when initiating a CASE session, if not overridden by the application. * */ -#ifndef WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID -#if WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 -#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_secp224r1) -#elif WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 -#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime256v1) -#elif WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 -#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_prime192v1) +#ifndef CHIP_CONFIG_DEFAULT_CASE_CURVE_ID +#if CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 +#define CHIP_CONFIG_DEFAULT_CASE_CURVE_ID (chip::Profiles::Security::kchipCurveId_secp224r1) +#elif CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define CHIP_CONFIG_DEFAULT_CASE_CURVE_ID (chip::Profiles::Security::kchipCurveId_prime256v1) +#elif CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP192R1 +#define CHIP_CONFIG_DEFAULT_CASE_CURVE_ID (chip::Profiles::Security::kchipCurveId_prime192v1) #else -#define WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID (nl::Weave::Profiles::Security::kWeaveCurveId_secp160r1) +#define CHIP_CONFIG_DEFAULT_CASE_CURVE_ID (chip::Profiles::Security::kchipCurveId_secp160r1) #endif -#endif // WEAVE_CONFIG_DEFAULT_CASE_CURVE_ID +#endif // CHIP_CONFIG_DEFAULT_CASE_CURVE_ID /** - * @def WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES + * @def CHIP_CONFIG_DEFAULT_CASE_ALLOWED_CURVES * * @brief * Default set of ECDH curves allowed to be used in a CASE session (initiating or responding), if not overridden by the application. * */ -#ifndef WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES -#if WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 || WEAVE_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 -#define WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (nl::Weave::Profiles::Security::kWeaveCurveSet_secp224r1|nl::Weave::Profiles::Security::kWeaveCurveSet_prime256v1) +#ifndef CHIP_CONFIG_DEFAULT_CASE_ALLOWED_CURVES +#if CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP224R1 || CHIP_CONFIG_SUPPORT_ELLIPTIC_CURVE_SECP256R1 +#define CHIP_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (chip::Profiles::Security::kchipCurveSet_secp224r1|chip::Profiles::Security::kchipCurveSet_prime256v1) #else -#define WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (nl::Weave::Profiles::Security::kWeaveCurveSet_All) +#define CHIP_CONFIG_DEFAULT_CASE_ALLOWED_CURVES (chip::Profiles::Security::kchipCurveSet_All) #endif -#endif // WEAVE_CONFIG_DEFAULT_CASE_ALLOWED_CURVES +#endif // CHIP_CONFIG_DEFAULT_CASE_ALLOWED_CURVES /** - * @def WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE + * @def CHIP_CONFIG_LEGACY_CASE_AUTH_DELEGATE * * @brief - * Enable use of the legacy WeaveCASEAuthDelegate interface. + * Enable use of the legacy chipCASEAuthDelegate interface. */ -#ifndef WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE -#define WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE 1 +#ifndef CHIP_CONFIG_LEGACY_CASE_AUTH_DELEGATE +#define CHIP_CONFIG_LEGACY_CASE_AUTH_DELEGATE 1 #endif /** - * @def WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES + * @def CHIP_CONFIG_MAX_SHARED_SESSIONS_END_NODES * * @brief * The maximum number of end nodes simultaneously supported * for all active shared sessions. * */ -#ifndef WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES -#define WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES 10 -#endif // WEAVE_CONFIG_MAX_SHARED_SESSIONS_END_NODES +#ifndef CHIP_CONFIG_MAX_SHARED_SESSIONS_END_NODES +#define CHIP_CONFIG_MAX_SHARED_SESSIONS_END_NODES 10 +#endif // CHIP_CONFIG_MAX_SHARED_SESSIONS_END_NODES /** - * @def WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION + * @def CHIP_CONFIG_MAX_END_NODES_PER_SHARED_SESSION * * @brief * The maximum number of end nodes simultaneously supported * per active shared session. * */ -#ifndef WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION -#define WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION 10 -#endif // WEAVE_CONFIG_MAX_END_NODES_PER_SHARED_SESSION +#ifndef CHIP_CONFIG_MAX_END_NODES_PER_SHARED_SESSION +#define CHIP_CONFIG_MAX_END_NODES_PER_SHARED_SESSION 10 +#endif // CHIP_CONFIG_MAX_END_NODES_PER_SHARED_SESSION /** - * @def WEAVE_CONFIG_ENABLE_TAKE_INITIATOR + * @def CHIP_CONFIG_ENABLE_TAKE_INITIATOR * * @brief * Enable support for initiating TAKE sessions. * */ -#ifndef WEAVE_CONFIG_ENABLE_TAKE_INITIATOR -#define WEAVE_CONFIG_ENABLE_TAKE_INITIATOR 0 -#endif // WEAVE_CONFIG_ENABLE_TAKE_INITIATOR +#ifndef CHIP_CONFIG_ENABLE_TAKE_INITIATOR +#define CHIP_CONFIG_ENABLE_TAKE_INITIATOR 0 +#endif // CHIP_CONFIG_ENABLE_TAKE_INITIATOR /** - * @def WEAVE_CONFIG_ENABLE_TAKE_RESPONDER + * @def CHIP_CONFIG_ENABLE_TAKE_RESPONDER * * @brief * Enable support for responding to TAKE sessions initiated by other nodes. * */ -#ifndef WEAVE_CONFIG_ENABLE_TAKE_RESPONDER -#define WEAVE_CONFIG_ENABLE_TAKE_RESPONDER 0 -#endif // WEAVE_CONFIG_ENABLE_TAKE_RESPONDER +#ifndef CHIP_CONFIG_ENABLE_TAKE_RESPONDER +#define CHIP_CONFIG_ENABLE_TAKE_RESPONDER 0 +#endif // CHIP_CONFIG_ENABLE_TAKE_RESPONDER /** - * @def WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR + * @def CHIP_CONFIG_ENABLE_KEY_EXPORT_INITIATOR * * @brief * Enable support for initiating key export request. * */ -#ifndef WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR -#define WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR 1 -#endif // WEAVE_CONFIG_ENABLE_KEY_EXPORT_INITIATOR +#ifndef CHIP_CONFIG_ENABLE_KEY_EXPORT_INITIATOR +#define CHIP_CONFIG_ENABLE_KEY_EXPORT_INITIATOR 1 +#endif // CHIP_CONFIG_ENABLE_KEY_EXPORT_INITIATOR /** - * @def WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER + * @def CHIP_CONFIG_ENABLE_KEY_EXPORT_RESPONDER * * @brief * Enable support for responding to key export request initiated by other nodes. * */ -#ifndef WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER -#define WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER 1 -#endif // WEAVE_CONFIG_ENABLE_KEY_EXPORT_RESPONDER +#ifndef CHIP_CONFIG_ENABLE_KEY_EXPORT_RESPONDER +#define CHIP_CONFIG_ENABLE_KEY_EXPORT_RESPONDER 1 +#endif // CHIP_CONFIG_ENABLE_KEY_EXPORT_RESPONDER /** - * @def WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE + * @def CHIP_CONFIG_LEGACY_KEY_EXPORT_DELEGATE * * @brief - * Enable use of the legacy WeaveKeyExportDelegate interface. + * Enable use of the legacy chipKeyExportDelegate interface. */ -#ifndef WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE -#define WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE 1 +#ifndef CHIP_CONFIG_LEGACY_KEY_EXPORT_DELEGATE +#define CHIP_CONFIG_LEGACY_KEY_EXPORT_DELEGATE 1 #endif /** - * @def WEAVE_CONFIG_REQUIRE_AUTH + * @def CHIP_CONFIG_REQUIRE_AUTH * * @brief * Enable (1) or disable (0) support for client requests via an * authenticated session. * - * This broadly controls whether or not a number of Weave servers + * This broadly controls whether or not a number of chip servers * require client requests to be sent via an authenticated session * and provides a default configuration value to these related * definitions: * - * * #WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL - * * #WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV - * * #WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV - * * #WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV + * * #CHIP_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL + * * #CHIP_CONFIG_REQUIRE_AUTH_FABRIC_PROV + * * #CHIP_CONFIG_REQUIRE_AUTH_NETWORK_PROV + * * #CHIP_CONFIG_REQUIRE_AUTH_SERVICE_PROV * * @note These configurations shall be deasserted for development - * and testing purposes only. No Weave-enabled device shall + * and testing purposes only. No chip-enabled device shall * be certified without these asserted. * */ -#ifndef WEAVE_CONFIG_REQUIRE_AUTH -#define WEAVE_CONFIG_REQUIRE_AUTH 1 -#endif // WEAVE_CONFIG_REQUIRE_AUTH +#ifndef CHIP_CONFIG_REQUIRE_AUTH +#define CHIP_CONFIG_REQUIRE_AUTH 1 +#endif // CHIP_CONFIG_REQUIRE_AUTH /** - * @def WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL + * @def CHIP_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL * * @brief * Enable (1) or disable (0) support for client requests to the - * Weave Device Control server via an authenticated session. See - * also #WEAVE_CONFIG_REQUIRE_AUTH. + * chip Device Control server via an authenticated session. See + * also #CHIP_CONFIG_REQUIRE_AUTH. * * @note This configuration shall be deasserted for development - * and testing purposes only. No Weave-enabled device shall + * and testing purposes only. No chip-enabled device shall * be certified without this asserted. * */ -#ifndef WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL -#define WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL WEAVE_CONFIG_REQUIRE_AUTH -#endif // WEAVE_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL +#ifndef CHIP_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL +#define CHIP_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL CHIP_CONFIG_REQUIRE_AUTH +#endif // CHIP_CONFIG_REQUIRE_AUTH_DEVICE_CONTROL /** - * @def WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV + * @def CHIP_CONFIG_REQUIRE_AUTH_FABRIC_PROV * * @brief * Enable (1) or disable (0) support for client requests to the - * Weave Fabric Provisioning server via an authenticated - * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * chip Fabric Provisioning server via an authenticated + * session. See also #CHIP_CONFIG_REQUIRE_AUTH. * * @note This configuration shall be deasserted for development - * and testing purposes only. No Weave-enabled device shall + * and testing purposes only. No chip-enabled device shall * be certified without this asserted. * */ -#ifndef WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV -#define WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV WEAVE_CONFIG_REQUIRE_AUTH -#endif // WEAVE_CONFIG_REQUIRE_AUTH_FABRIC_PROV +#ifndef CHIP_CONFIG_REQUIRE_AUTH_FABRIC_PROV +#define CHIP_CONFIG_REQUIRE_AUTH_FABRIC_PROV CHIP_CONFIG_REQUIRE_AUTH +#endif // CHIP_CONFIG_REQUIRE_AUTH_FABRIC_PROV /** - * @def WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV + * @def CHIP_CONFIG_REQUIRE_AUTH_NETWORK_PROV * * @brief * Enable (1) or disable (0) support for client requests to the - * Weave Network Provisioning server via an authenticated - * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * chip Network Provisioning server via an authenticated + * session. See also #CHIP_CONFIG_REQUIRE_AUTH. * * @note This configuration shall be deasserted for development - * and testing purposes only. No Weave-enabled device shall + * and testing purposes only. No chip-enabled device shall * be certified without this asserted. * */ -#ifndef WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV -#define WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV WEAVE_CONFIG_REQUIRE_AUTH -#endif // WEAVE_CONFIG_REQUIRE_AUTH_NETWORK_PROV +#ifndef CHIP_CONFIG_REQUIRE_AUTH_NETWORK_PROV +#define CHIP_CONFIG_REQUIRE_AUTH_NETWORK_PROV CHIP_CONFIG_REQUIRE_AUTH +#endif // CHIP_CONFIG_REQUIRE_AUTH_NETWORK_PROV /** - * @def WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV + * @def CHIP_CONFIG_REQUIRE_AUTH_SERVICE_PROV * * @brief * Enable (1) or disable (0) support for client requests to the - * Weave Service Provisioning server via an authenticated - * session. See also #WEAVE_CONFIG_REQUIRE_AUTH. + * chip Service Provisioning server via an authenticated + * session. See also #CHIP_CONFIG_REQUIRE_AUTH. * * @note This configuration shall be deasserted for development - * and testing purposes only. No Weave-enabled device shall + * and testing purposes only. No chip-enabled device shall * be certified without this asserted. * */ -#ifndef WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV -#define WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV WEAVE_CONFIG_REQUIRE_AUTH -#endif // WEAVE_CONFIG_REQUIRE_AUTH_SERVICE_PROV +#ifndef CHIP_CONFIG_REQUIRE_AUTH_SERVICE_PROV +#define CHIP_CONFIG_REQUIRE_AUTH_SERVICE_PROV CHIP_CONFIG_REQUIRE_AUTH +#endif // CHIP_CONFIG_REQUIRE_AUTH_SERVICE_PROV /** - * @def WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT + * @def CHIP_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT * * @brief - * Enable (1) or disable (0) support for the handling of Weave + * Enable (1) or disable (0) support for the handling of chip * Provisioning Bundles. * - * Weave Provisioning Bundles are a Weave TLV payload containing - * the Weave certificate, corresponding private key, and pairing - * code / entry key that a Weave device would have otherwise + * chip Provisioning Bundles are a chip TLV payload containing + * the chip certificate, corresponding private key, and pairing + * code / entry key that a chip device would have otherwise * received at its time of manufacture. * * Enable this if your family of device needs to support in-field - * provisioning (IFP). IFP for Weave devices is neither generally + * provisioning (IFP). IFP for chip devices is neither generally * supported nor recommended. * */ -#ifndef WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT -#define WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT 1 -#endif // WEAVE_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT +#ifndef CHIP_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT +#define CHIP_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT 1 +#endif // CHIP_CONFIG_ENABLE_PROVISIONING_BUNDLE_SUPPORT /** - * @def WEAVE_ERROR_LOGGING + * @def CHIP_ERROR_LOGGING * * @brief * If asserted (1), enable logging of all messages in the - * nl::Weave::Logging::LogCategory::kLogCategory_Error category. + * chip::Logging::LogCategory::kLogCategory_Error category. * */ -#ifndef WEAVE_ERROR_LOGGING -#define WEAVE_ERROR_LOGGING 1 -#endif // WEAVE_ERROR_LOGGING +#ifndef CHIP_ERROR_LOGGING +#define CHIP_ERROR_LOGGING 1 +#endif // CHIP_ERROR_LOGGING /** - * @def WEAVE_PROGRESS_LOGGING + * @def CHIP_PROGRESS_LOGGING * * @brief * If asserted (1), enable logging of all messages in the - * nl::Weave::Logging::LogCategory::kLogCategory_Progress category. + * chip::Logging::LogCategory::kLogCategory_Progress category. * */ -#ifndef WEAVE_PROGRESS_LOGGING -#define WEAVE_PROGRESS_LOGGING 1 -#endif // WEAVE_PROGRESS_LOGGING +#ifndef CHIP_PROGRESS_LOGGING +#define CHIP_PROGRESS_LOGGING 1 +#endif // CHIP_PROGRESS_LOGGING /** - * @def WEAVE_DETAIL_LOGGING + * @def CHIP_DETAIL_LOGGING * * @brief * If asserted (1), enable logging of all messages in the - * nl::Weave::Logging::kLogCategory_Detail category. + * chip::Logging::kLogCategory_Detail category. * */ -#ifndef WEAVE_DETAIL_LOGGING -#define WEAVE_DETAIL_LOGGING 1 -#endif // WEAVE_DETAIL_LOGGING +#ifndef CHIP_DETAIL_LOGGING +#define CHIP_DETAIL_LOGGING 1 +#endif // CHIP_DETAIL_LOGGING /** - * @def WEAVE_RETAIN_LOGGING + * @def CHIP_RETAIN_LOGGING * * @brief * If asserted (1), enable logging of all messages in the - * nl::Weave::Logging::LogCategory::kLogCategory_Retain category. - * If not defined by the application, by default WEAVE_RETAIN_LOGGING is - * remapped to WEAVE_PROGRESS_LOGGING + * chip::Logging::LogCategory::kLogCategory_Retain category. + * If not defined by the application, by default CHIP_RETAIN_LOGGING is + * remapped to CHIP_PROGRESS_LOGGING * */ /** - * @def WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + * @def CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING * * @brief * If asserted (1), enable logging of errors at function exit via the - * WeaveLogFunctError() macro. + * chipLogFunctError() macro. */ -#ifndef WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING -#define WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 0 -#endif // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING +#ifndef CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING +#define CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 0 +#endif // CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING /** - * @def WEAVE_CONFIG_ENABLE_CONDITION_LOGGING + * @def CHIP_CONFIG_ENABLE_CONDITION_LOGGING * * @brief * If asserted (1), enable logging of failed conditions via the - * WeaveLogIfFalse() macro. + * chipLogIfFalse() macro. */ -#ifndef WEAVE_CONFIG_ENABLE_CONDITION_LOGGING -#define WEAVE_CONFIG_ENABLE_CONDITION_LOGGING 0 -#endif // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING +#ifndef CHIP_CONFIG_ENABLE_CONDITION_LOGGING +#define CHIP_CONFIG_ENABLE_CONDITION_LOGGING 0 +#endif // CHIP_CONFIG_ENABLE_CONDITION_LOGGING /** - * @def WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY + * @def CHIP_CONFIG_ENABLE_SERVICE_DIRECTORY * * @brief * If set to (1), use of the ServiceDirectory implementation * is enabled. Default value is (1) or enabled. * * @note - * Enabling this profile allows applications using Weave to - * request a connection to a particular Weave service using + * Enabling this profile allows applications using chip to + * request a connection to a particular chip service using * a predefined service endpoint. It is relevant for * applications that run on devices that interact with the * Service over a direct TCP/IPv4 connection rather than those - * that use the Weave Tunnel through a gateway device. For + * that use the chip Tunnel through a gateway device. For * devices of the latter category, the Service Directory * profile can be disabled via this compilation switch. * */ -#ifndef WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY -#define WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY 1 -#endif // WEAVE_CONFIG_ENABLE_SERVICE_DIRECTORY +#ifndef CHIP_CONFIG_ENABLE_SERVICE_DIRECTORY +#define CHIP_CONFIG_ENABLE_SERVICE_DIRECTORY 1 +#endif // CHIP_CONFIG_ENABLE_SERVICE_DIRECTORY /** - * @def WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS + * @def CHIP_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS * * @brief * This is the default timeout for the connect call to the @@ -1913,16 +1911,16 @@ * of an error. * */ -#ifndef WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS -#define WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS (10000) -#endif // WEAVE_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS +#ifndef CHIP_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS +#define CHIP_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS (10000) +#endif // CHIP_CONFIG_SERVICE_DIR_CONNECT_TIMEOUT_MSECS /** - * @def WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT + * @def CHIP_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT * * @brief * The maximum amount of time, in milliseconds, that an idle inbound - * Weave connection will be allowed to exist before being closed. + * chip connection will be allowed to exist before being closed. * * This is a default value that can be overridden at runtime by the * application. @@ -1930,12 +1928,12 @@ * A value of 0 disables automatic closing of idle connections. * */ -#ifndef WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT -#define WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT 15000 -#endif // WEAVE_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT +#ifndef CHIP_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT +#define CHIP_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT 15000 +#endif // CHIP_CONFIG_DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT /** - * @def WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT + * @def CHIP_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT * * @brief * The amount of time (in milliseconds) which a peer is given @@ -1944,77 +1942,77 @@ * actually have up to twice this time. * */ -#ifndef WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT -#define WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT 2000 -#endif // WEAVE_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT +#ifndef CHIP_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT +#define CHIP_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT 2000 +#endif // CHIP_CONFIG_MSG_COUNTER_SYNC_RESP_TIMEOUT /** - * @def WEAVE_CONFIG_TEST + * @def CHIP_CONFIG_TEST * * @brief * If asserted (1), enable APIs that help implement * unit and integration tests. * */ -#ifndef WEAVE_CONFIG_TEST -#define WEAVE_CONFIG_TEST 0 -#endif // WEAVE_CONFIG_TEST +#ifndef CHIP_CONFIG_TEST +#define CHIP_CONFIG_TEST 0 +#endif // CHIP_CONFIG_TEST /** - * @def WEAVE_CONFIG_SHORT_ERROR_STR + * @def CHIP_CONFIG_SHORT_ERROR_STR * * @brief * If asserted (1), produce shorter error strings that only carry a * minimum of information. * */ -#ifndef WEAVE_CONFIG_SHORT_ERROR_STR -#define WEAVE_CONFIG_SHORT_ERROR_STR 0 -#endif // WEAVE_CONFIG_SHORT_ERROR_STR +#ifndef CHIP_CONFIG_SHORT_ERROR_STR +#define CHIP_CONFIG_SHORT_ERROR_STR 0 +#endif // CHIP_CONFIG_SHORT_ERROR_STR /** - * @def WEAVE_CONFIG_ERROR_STR_SIZE + * @def CHIP_CONFIG_ERROR_STR_SIZE * * @brief * This defines the size of the buffer to store a formatted error string. * If the formatting of an error string exceeds this size it will be truncated. * - * The default size varies based on the WEAVE_CONFIG_SHORT_ERROR_STR option. + * The default size varies based on the CHIP_CONFIG_SHORT_ERROR_STR option. * - * When WEAVE_CONFIG_SHORT_ERROR_STR is 0, a large default buffer size is used + * When CHIP_CONFIG_SHORT_ERROR_STR is 0, a large default buffer size is used * to accommodate descriptive text summarizing the cause of the error. E.g.: * - * "Weave Error 4047 (0x00000FCF): Invalid Argument" + * "chip Error 4047 (0x00000FCF): Invalid Argument" * - * When WEAVE_CONFIG_SHORT_ERROR_STR is 1, the buffer size is set to accommodate + * When CHIP_CONFIG_SHORT_ERROR_STR is 1, the buffer size is set to accommodate * a minimal error string consisting of a 10 character subsystem name followed * by an 8 character error number, plus boilerplate. E.g.: * - * "Error Weave:0x00000FCF" + * "Error chip:0x00000FCF" * */ -#ifndef WEAVE_CONFIG_ERROR_STR_SIZE -#if WEAVE_CONFIG_SHORT_ERROR_STR -#define WEAVE_CONFIG_ERROR_STR_SIZE (5 + 1 + 10 + 3 + 8 + 1) -#else // WEAVE_CONFIG_SHORT_ERROR_STR -#define WEAVE_CONFIG_ERROR_STR_SIZE 256 -#endif // WEAVE_CONFIG_SHORT_ERROR_STR -#endif // WEAVE_CONFIG_ERROR_STR_SIZE +#ifndef CHIP_CONFIG_ERROR_STR_SIZE +#if CHIP_CONFIG_SHORT_ERROR_STR +#define CHIP_CONFIG_ERROR_STR_SIZE (5 + 1 + 10 + 3 + 8 + 1) +#else // CHIP_CONFIG_SHORT_ERROR_STR +#define CHIP_CONFIG_ERROR_STR_SIZE 256 +#endif // CHIP_CONFIG_SHORT_ERROR_STR +#endif // CHIP_CONFIG_ERROR_STR_SIZE /** - * @def WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER + * @def CHIP_CONFIG_CUSTOM_ERROR_FORMATTER * * @brief * If asserted (1), suppress definition of the standard error formatting function - * (#nl::FormatError()) allowing an application-specific implementation to be used. + * (#FormatError()) allowing an application-specific implementation to be used. * */ -#ifndef WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER -#define WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER 0 -#endif // WEAVE_CONFIG_CUSTOM_ERROR_FORMATTER +#ifndef CHIP_CONFIG_CUSTOM_ERROR_FORMATTER +#define CHIP_CONFIG_CUSTOM_ERROR_FORMATTER 0 +#endif // CHIP_CONFIG_CUSTOM_ERROR_FORMATTER /** - * @def WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT + * @def CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT * * @brief * The printf-style format string used to format error values. @@ -2024,40 +2022,40 @@ * the default hex format. * * Note that this option only affects short-form error strings (i.e. when - * WEAVE_CONFIG_SHORT_ERROR_STR == 1). Long form error strings always show both hex + * CHIP_CONFIG_SHORT_ERROR_STR == 1). Long form error strings always show both hex * and decimal values */ -#ifndef WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT -#define WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT "0x%08" PRIX32 -#endif // WEAVE_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT +#ifndef CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT +#define CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT "0x%08" PRIX32 +#endif // CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT /** - * @def WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE + * @def CHIP_CONFIG_BLE_PKT_RESERVED_SIZE * * @brief - * The number of bytes that Weave should reserve at the front of + * The number of bytes that chip should reserve at the front of * every outgoing BLE packet for the sake of the underlying BLE * stack. * */ -#ifndef WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE -#define WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE 0 -#endif // WEAVE_CONFIG_BLE_PKT_RESERVED_SIZE +#ifndef CHIP_CONFIG_BLE_PKT_RESERVED_SIZE +#define CHIP_CONFIG_BLE_PKT_RESERVED_SIZE 0 +#endif // CHIP_CONFIG_BLE_PKT_RESERVED_SIZE /** - * @def WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS + * @def CHIP_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS * * @brief * Enable (1) or disable (0) support for utility functions for - * decoding and outputing information related to Weave security. + * decoding and outputing information related to chip security. * */ -#ifndef WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS -#define WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS 1 -#endif // WEAVE_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS +#ifndef CHIP_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS +#define CHIP_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS 1 +#endif // CHIP_CONFIG_ENABLE_SECURITY_DEBUG_FUNCS /** - * @def WEAVE_CONFIG_IsPlatformErrorNonCritical(CODE) + * @def CHIP_CONFIG_IsPlatformErrorNonCritical(CODE) * * This macro checks if a platform generated error is critical and * needs to be reported to the application/caller. The criticality @@ -2073,37 +2071,37 @@ * this default macro definition after careful thought towards its * implication in the logic flow in that platform. * - * @param[in] CODE The #WEAVE_ERROR being checked for criticality. + * @param[in] CODE The #CHIP_ERROR being checked for criticality. * * @return true if the error is non-critical; false otherwise. * */ -#ifndef WEAVE_CONFIG_IsPlatformErrorNonCritical -#if WEAVE_SYSTEM_CONFIG_USE_LWIP -#define _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) \ - ((CODE) == nl::Weave::System::MapErrorLwIP(ERR_RTE) || \ - (CODE) == nl::Weave::System::MapErrorLwIP(ERR_MEM)) -#else // !WEAVE_SYSTEM_CONFIG_USE_LWIP -#define _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) 0 -#endif // !WEAVE_SYSTEM_CONFIG_USE_LWIP +#ifndef CHIP_CONFIG_IsPlatformErrorNonCritical +#if CHIP_SYSTEM_CONFIG_USE_LWIP +#define _CHIP_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) \ + ((CODE) == chip::System::MapErrorLwIP(ERR_RTE) || \ + (CODE) == chip::System::MapErrorLwIP(ERR_MEM)) +#else // !CHIP_SYSTEM_CONFIG_USE_LWIP +#define _CHIP_CONFIG_IsPlatformLwIPErrorNonCritical(CODE) 0 +#endif // !CHIP_SYSTEM_CONFIG_USE_LWIP -#if WEAVE_SYSTEM_CONFIG_USE_SOCKETS -#define _WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) \ - ((CODE) == nl::Weave::System::MapErrorPOSIX(EHOSTUNREACH) || \ - (CODE) == nl::Weave::System::MapErrorPOSIX(ENETUNREACH) || \ - (CODE) == nl::Weave::System::MapErrorPOSIX(EADDRNOTAVAIL) || \ - (CODE) == nl::Weave::System::MapErrorPOSIX(EPIPE)) -#else // !WEAVE_SYSTEM_CONFIG_USE_SOCKETS -#define _WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) 0 -#endif // !WEAVE_SYSTEM_CONFIG_USE_SOCKETS +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS +#define _CHIP_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) \ + ((CODE) == chip::System::MapErrorPOSIX(EHOSTUNREACH) || \ + (CODE) == chip::System::MapErrorPOSIX(ENETUNREACH) || \ + (CODE) == chip::System::MapErrorPOSIX(EADDRNOTAVAIL) || \ + (CODE) == chip::System::MapErrorPOSIX(EPIPE)) +#else // !CHIP_SYSTEM_CONFIG_USE_SOCKETS +#define _CHIP_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) 0 +#endif // !CHIP_SYSTEM_CONFIG_USE_SOCKETS -#define WEAVE_CONFIG_IsPlatformErrorNonCritical(CODE) \ - (_WEAVE_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) || \ - _WEAVE_CONFIG_IsPlatformLwIPErrorNonCritical(CODE)) -#endif // WEAVE_CONFIG_IsPlatformErrorNonCritical +#define CHIP_CONFIG_IsPlatformErrorNonCritical(CODE) \ + (_CHIP_CONFIG_IsPlatformPOSIXErrorNonCritical(CODE) || \ + _CHIP_CONFIG_IsPlatformLwIPErrorNonCritical(CODE)) +#endif // CHIP_CONFIG_IsPlatformErrorNonCritical /** - * @def WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS + * @def CHIP_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS * * @brief * Enable (1) or disable (0) replacing math functions @@ -2111,12 +2109,12 @@ * and hence require special support from the platform. * */ -#ifndef WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS -#define WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS 0 -#endif // WEAVE_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS +#ifndef CHIP_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS +#define CHIP_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS 0 +#endif // CHIP_CONFIG_WILL_OVERRIDE_PLATFORM_MATH_FUNCS /** - * @def WEAVE_CONFIG_SERIALIZATION_USE_MALLOC + * @def CHIP_CONFIG_SERIALIZATION_USE_MALLOC * * @brief If turned on, then schema event serialization and * deserialization will use the stdlib implementations of malloc, @@ -2124,21 +2122,21 @@ * been provided). We will fail at compile time if the stdlib * implementations are not present. */ -#ifndef WEAVE_CONFIG_SERIALIZATION_USE_MALLOC -#define WEAVE_CONFIG_SERIALIZATION_USE_MALLOC 0 +#ifndef CHIP_CONFIG_SERIALIZATION_USE_MALLOC +#define CHIP_CONFIG_SERIALIZATION_USE_MALLOC 0 #endif /** - * @def WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING + * @def CHIP_CONFIG_SERIALIZATION_DEBUG_LOGGING * * @brief Enable debug logging for the serialization/deserialization APIs. */ -#ifndef WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING -#define WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING 0 +#ifndef CHIP_CONFIG_SERIALIZATION_DEBUG_LOGGING +#define CHIP_CONFIG_SERIALIZATION_DEBUG_LOGGING 0 #endif /** - * @def WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION + * @def CHIP_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION * * @brief Enable deserialization as well as serialization APIs. We * make deserialization configurable because it requires some extra @@ -2146,127 +2144,127 @@ * if it doesn't consume WDM events or otherwise has no need to * deserialize. */ -#ifndef WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION -#define WEAVE_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION 1 +#ifndef CHIP_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION +#define CHIP_CONFIG_SERIALIZATION_ENABLE_DESERIALIZATION 1 #endif /** - * @def WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS + * @def CHIP_CONFIG_SERIALIZATION_LOG_FLOATS * * @brief Enable debug logging of floats and doubles for the * serialization/deserialization APIs. Not all platforms * support these types, and may not compile if there are * any references to them. Only matters if - * WEAVE_CONFIG_SERIALIZATION_DEBUG_LOGGING is enabled. + * CHIP_CONFIG_SERIALIZATION_DEBUG_LOGGING is enabled. */ -#ifndef WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS -#define WEAVE_CONFIG_SERIALIZATION_LOG_FLOATS 1 +#ifndef CHIP_CONFIG_SERIALIZATION_LOG_FLOATS +#define CHIP_CONFIG_SERIALIZATION_LOG_FLOATS 1 #endif /** - * @def WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE + * @def CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE * * @brief * The data type used to represent the key of a persistedly-stored * key/value pair. */ -#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE -#define WEAVE_CONFIG_PERSISTED_STORAGE_KEY_TYPE const char * +#ifndef CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE +#define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE const char * #endif /** - * @def WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID + * @def CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID * * @brief * The group key message counter persisted storage Id. * */ -#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID -#define WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID "EncMsgCntr" -#endif // WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID +#ifndef CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID +#define CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID "EncMsgCntr" +#endif // CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID /** - * @def WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH + * @def CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH * * @brief * The group key message counter persisted storage epoch. * */ -#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH -#define WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH 0x1000 -#endif // WEAVE_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH +#ifndef CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH +#define CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH 0x1000 +#endif // CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_EPOCH /** - * @def WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH + * @def CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH * * @brief The maximum length of the key in a key/value pair * stored in the platform's persistent storage. */ -#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH -#define WEAVE_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 16 +#ifndef CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH +#define CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 16 #endif /** - * @def WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH + * @def CHIP_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH * * @brief The maximum length of the value in a key/value pair * stored in the platform's persistent storage. */ -#ifndef WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH -#define WEAVE_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH 256 +#ifndef CHIP_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH +#define CHIP_CONFIG_PERSISTED_STORAGE_MAX_VALUE_LENGTH 256 #endif /** - * @def WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING + * @def CHIP_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING * * @brief Enable debug logging for the PersistedCounter API. */ -#ifndef WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING -#define WEAVE_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING 0 +#ifndef CHIP_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING +#define CHIP_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING 0 #endif /** - * @def WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS + * @def CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS * * @brief Enable verbose debug logging for the EventLogging API. * This setting is incompatible with platforms that route console * logs into event logging, as it would result in circular logic. */ -#ifndef WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS -#define WEAVE_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS 1 +#ifndef CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS +#define CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS 1 #endif /** - * @def WEAVE_CONFIG_ENABLE_ARG_PARSER + * @def CHIP_CONFIG_ENABLE_ARG_PARSER * * @brief Enable support functions for parsing command-line arguments */ -#ifndef WEAVE_CONFIG_ENABLE_ARG_PARSER -#define WEAVE_CONFIG_ENABLE_ARG_PARSER 0 +#ifndef CHIP_CONFIG_ENABLE_ARG_PARSER +#define CHIP_CONFIG_ENABLE_ARG_PARSER 0 #endif /** - * @def WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK + * @def CHIP_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK * * @brief Enable santiy checking of command-line argument definitions. */ -#ifndef WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK -#define WEAVE_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK 1 +#ifndef CHIP_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK +#define CHIP_CONFIG_ENABLE_ARG_PARSER_SANTIY_CHECK 1 #endif /** - * @def WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT + * @def CHIP_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT * * @brief * The amount of time (in milliseconds) which the service is given * to respond to a pair device to account request. */ -#ifndef WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT -#define WEAVE_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT 60000 +#ifndef CHIP_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT +#define CHIP_CONFIG_SERVICE_PROV_RESPONSE_TIMEOUT 60000 #endif /** - * @def WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE + * @def CHIP_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE * * @brief * Enable (1) or disable (0) support for the depricated @@ -2276,12 +2274,12 @@ * legacy devices that don't have latest SW. * */ -#ifndef WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE -#define WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE 1 -#endif // WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE +#ifndef CHIP_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE +#define CHIP_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE 1 +#endif // CHIP_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE /** - * @def WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE + * @def CHIP_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE * * @brief * Enable (1) or disable (0) the exclusive use of the depricated @@ -2290,44 +2288,44 @@ * This option should be enabled when exclusively pairing with Nest * legacy devices that don't have latest SW. * This option requires that - * WEAVE_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE is enabled. + * CHIP_CONFIG_SUPPORT_LEGACY_ADD_NETWORK_MESSAGE is enabled. * */ -#ifndef WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE -#define WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE 0 -#endif // WEAVE_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE +#ifndef CHIP_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE +#define CHIP_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE 0 +#endif // CHIP_CONFIG_ALWAYS_USE_LEGACY_ADD_NETWORK_MESSAGE /** - * @def WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN + * @def CHIP_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN * * @brief Enable the Service Provisioning profile message * for notification of successful in-field joining of the - * Weave fabric. + * chip fabric. */ -#ifndef WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN -#define WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN 0 -#endif // WEAVE_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN +#ifndef CHIP_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN +#define CHIP_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN 0 +#endif // CHIP_CONFIG_ENABLE_IFJ_SERVICE_FABRIC_JOIN /** - * @def WEAVE_NON_PRODUCTION_MARKER + * @def CHIP_NON_PRODUCTION_MARKER * - * @brief Defines the name of a mark symbol whose presence signals that the Weave code + * @brief Defines the name of a mark symbol whose presence signals that the chip code * includes development/testing features that should never be used in production contexts. */ -#ifndef WEAVE_NON_PRODUCTION_MARKER -#if (WEAVE_CONFIG_SECURITY_TEST_MODE || \ - WEAVE_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY || \ - WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY || \ - (!WEAVE_CONFIG_REQUIRE_AUTH) || \ - WEAVE_FUZZING_ENABLED) -#define WEAVE_NON_PRODUCTION_MARKER WARNING__DO_NOT_SHIP__CONTAINS_NON_PRODUCTION_WEAVE_CODE +#ifndef CHIP_NON_PRODUCTION_MARKER +#if (CHIP_CONFIG_SECURITY_TEST_MODE || \ + CHIP_CONFIG_SUPPORT_PASE_CONFIG0_TEST_ONLY || \ + CHIP_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY || \ + (!CHIP_CONFIG_REQUIRE_AUTH) || \ + CHIP_FUZZING_ENABLED) +#define CHIP_NON_PRODUCTION_MARKER WARNING__DO_NOT_SHIP__CONTAINS_NON_PRODUCTION_CHIP_CODE #endif #endif -#ifdef WEAVE_NON_PRODUCTION_MARKER -extern const char WEAVE_NON_PRODUCTION_MARKER[]; +#ifdef CHIP_NON_PRODUCTION_MARKER +extern const char CHIP_NON_PRODUCTION_MARKER[]; #endif // clang-format on -#endif /* WEAVE_CONFIG_H_ */ +#endif /* CHIP_CONFIG_H_ */ diff --git a/src/lib/core/CHIPCore.h b/src/lib/core/CHIPCore.h index 2297a0cb343c4f..49b982c4e8f664 100644 --- a/src/lib/core/CHIPCore.h +++ b/src/lib/core/CHIPCore.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2013-2017 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. @@ -19,14 +18,14 @@ /** * @file * This file is the master "umbrella" include file for the core - * Weave library. + * chip library. * */ -#ifndef WEAVECORE_H_ -#define WEAVECORE_H_ +#ifndef CHIPCORE_H_ +#define CHIPCORE_H_ -#include +#include "core/CHIPConfig.h" #include @@ -37,28 +36,26 @@ #include //Currently only used on Sapphire -#define NL_WEAVE_CORE_IDENTITY "weave-core" -#define NL_WEAVE_CORE_PREFIX NL_WEAVE_CORE_IDENTITY ": " +#define CHIP_CORE_IDENTITY "chip-core" +#define CHIP_CORE_PREFIX CHIP_CORE_IDENTITY ": " -namespace nl { -namespace Weave { +namespace chip { #if CONFIG_NETWORK_LAYER_BLE -using namespace ::nl::Ble; +using namespace ::Ble; #endif // CONFIG_NETWORK_LAYER_BLE -using namespace ::nl::Inet; +using namespace ::Inet; -} } -#include -#include -#include -#include -#include -#include -#include -#include +#include "core/CHIPError.h" +#include "core/CHIPKeyIds.h" +#include "core/CHIPFabricState.h" +#include "core/CHIPMessageLayer.h" +#include "core/CHIPBinding.h" +#include "core/CHIPExchangeMgr.h" +#include "core/CHIPSecurityMgr.h" +#include "core/CHIPGlobals.h" -#endif /* WEAVECORE_H_ */ +#endif /* CHIPCORE_H_ */ diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index b5237d047fcc7c..e4762ba8a42ec7 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Google LLC. - * 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. @@ -18,16 +17,15 @@ /** * @file - * This file contains functions for working with Weave errors. + * This file contains functions for working with CHIP errors. */ -#include +#include "core/CHIPCore.h" -namespace nl { -namespace Weave { +namespace chip { /** - * Given a Weave error, returns a human-readable NULL-terminated C string + * Given a CHIP error, returns a human-readable NULL-terminated C string * describing the error. * * @param[in] buf Buffer into which the error string will be placed. @@ -35,206 +33,205 @@ namespace Weave { * @param[in] err The error to be described. * * @return true If a description string was written into the supplied buffer. - * @return false If the supplied error was not a Weave error. + * @return false If the supplied error was not a CHIP error. * */ -bool FormatWeaveError(char * buf, uint16_t bufSize, int32_t err) +bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) { const char * desc = NULL; - if (err < WEAVE_ERROR_MIN || err > WEAVE_ERROR_MAX) + if (err < CHIP_ERROR_MIN || err > CHIP_ERROR_MAX) { return false; } -#if !WEAVE_CONFIG_SHORT_ERROR_STR +#if !CHIP_CONFIG_SHORT_ERROR_STR switch (err) { - case WEAVE_ERROR_TOO_MANY_CONNECTIONS : desc = "Too many connections"; break; - case WEAVE_ERROR_SENDING_BLOCKED : desc = "Sending blocked"; break; - case WEAVE_ERROR_CONNECTION_ABORTED : desc = "Connection aborted"; break; - case WEAVE_ERROR_INCORRECT_STATE : desc = "Incorrect state"; break; - case WEAVE_ERROR_MESSAGE_TOO_LONG : desc = "Message too long"; break; - case WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION : desc = "Unsupported exchange version"; break; - case WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS : desc = "Too many unsolicited message handlers"; break; - case WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER : desc = "No unsolicited message handler"; break; - case WEAVE_ERROR_NO_CONNECTION_HANDLER : desc = "No connection handler"; break; - case WEAVE_ERROR_TOO_MANY_PEER_NODES : desc = "Too many peer nodes"; break; - case WEAVE_ERROR_NO_MEMORY : desc = "No memory"; break; - case WEAVE_ERROR_NO_MESSAGE_HANDLER : desc = "No message handler"; break; - case WEAVE_ERROR_MESSAGE_INCOMPLETE : desc = "Message incomplete"; break; - case WEAVE_ERROR_DATA_NOT_ALIGNED : desc = "Data not aligned"; break; - case WEAVE_ERROR_UNKNOWN_KEY_TYPE : desc = "Unknown key type"; break; - case WEAVE_ERROR_KEY_NOT_FOUND : desc = "Key not found"; break; - case WEAVE_ERROR_WRONG_ENCRYPTION_TYPE : desc = "Wrong encryption type"; break; - case WEAVE_ERROR_TOO_MANY_KEYS : desc = "Too many keys"; break; - case WEAVE_ERROR_INTEGRITY_CHECK_FAILED : desc = "Integrity check failed"; break; - case WEAVE_ERROR_INVALID_SIGNATURE : desc = "Invalid signature"; break; - case WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION : desc = "Unsupported message version"; break; - case WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE : desc = "Unsupported encryption type"; break; - case WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE : desc = "Unsupported signature type"; break; - case WEAVE_ERROR_INVALID_MESSAGE_LENGTH : desc = "Invalid message length"; break; - case WEAVE_ERROR_BUFFER_TOO_SMALL : desc = "Buffer too small"; break; - case WEAVE_ERROR_DUPLICATE_KEY_ID : desc = "Duplicate key id"; break; - case WEAVE_ERROR_WRONG_KEY_TYPE : desc = "Wrong key type"; break; - case WEAVE_ERROR_WELL_UNINITIALIZED : desc = "Well uninitialized"; break; - case WEAVE_ERROR_WELL_EMPTY : desc = "Well empty"; break; - case WEAVE_ERROR_INVALID_STRING_LENGTH : desc = "Invalid string length"; break; - case WEAVE_ERROR_INVALID_LIST_LENGTH : desc = "invalid list length"; break; - case WEAVE_ERROR_INVALID_INTEGRITY_TYPE : desc = "Invalid integrity type"; break; - case WEAVE_END_OF_TLV : desc = "End of TLV"; break; - case WEAVE_ERROR_TLV_UNDERRUN : desc = "TLV underrun"; break; - case WEAVE_ERROR_INVALID_TLV_ELEMENT : desc = "Invalid TLV element"; break; - case WEAVE_ERROR_INVALID_TLV_TAG : desc = "Invalid TLV tag"; break; - case WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG : desc = "Unknown implicit TLV tag"; break; - case WEAVE_ERROR_WRONG_TLV_TYPE : desc = "Wrong TLV type"; break; - case WEAVE_ERROR_TLV_CONTAINER_OPEN : desc = "TLV container open"; break; - case WEAVE_ERROR_INVALID_TRANSFER_MODE : desc = "Invalid transfer mode"; break; - case WEAVE_ERROR_INVALID_PROFILE_ID : desc = "Invalid profile id"; break; - case WEAVE_ERROR_INVALID_MESSAGE_TYPE : desc = "Invalid message type"; break; - case WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT : desc = "Unexpected TLV element"; break; - case WEAVE_ERROR_STATUS_REPORT_RECEIVED : desc = "Status Report received from peer"; break; - case WEAVE_ERROR_NOT_IMPLEMENTED : desc = "Not Implemented"; break; - case WEAVE_ERROR_INVALID_ADDRESS : desc = "Invalid address"; break; - case WEAVE_ERROR_INVALID_ARGUMENT : desc = "Invalid argument"; break; - case WEAVE_ERROR_TLV_TAG_NOT_FOUND : desc = "TLV tag not found"; break; + case CHIP_ERROR_TOO_MANY_CONNECTIONS : desc = "Too many connections"; break; + case CHIP_ERROR_SENDING_BLOCKED : desc = "Sending blocked"; break; + case CHIP_ERROR_CONNECTION_ABORTED : desc = "Connection aborted"; break; + case CHIP_ERROR_INCORRECT_STATE : desc = "Incorrect state"; break; + case CHIP_ERROR_MESSAGE_TOO_LONG : desc = "Message too long"; break; + case CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION : desc = "Unsupported exchange version"; break; + case CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS : desc = "Too many unsolicited message handlers"; break; + case CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER : desc = "No unsolicited message handler"; break; + case CHIP_ERROR_NO_CONNECTION_HANDLER : desc = "No connection handler"; break; + case CHIP_ERROR_TOO_MANY_PEER_NODES : desc = "Too many peer nodes"; break; + case CHIP_ERROR_NO_MEMORY : desc = "No memory"; break; + case CHIP_ERROR_NO_MESSAGE_HANDLER : desc = "No message handler"; break; + case CHIP_ERROR_MESSAGE_INCOMPLETE : desc = "Message incomplete"; break; + case CHIP_ERROR_DATA_NOT_ALIGNED : desc = "Data not aligned"; break; + case CHIP_ERROR_UNKNOWN_KEY_TYPE : desc = "Unknown key type"; break; + case CHIP_ERROR_KEY_NOT_FOUND : desc = "Key not found"; break; + case CHIP_ERROR_WRONG_ENCRYPTION_TYPE : desc = "Wrong encryption type"; break; + case CHIP_ERROR_TOO_MANY_KEYS : desc = "Too many keys"; break; + case CHIP_ERROR_INTEGRITY_CHECK_FAILED : desc = "Integrity check failed"; break; + case CHIP_ERROR_INVALID_SIGNATURE : desc = "Invalid signature"; break; + case CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION : desc = "Unsupported message version"; break; + case CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE : desc = "Unsupported encryption type"; break; + case CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE : desc = "Unsupported signature type"; break; + case CHIP_ERROR_INVALID_MESSAGE_LENGTH : desc = "Invalid message length"; break; + case CHIP_ERROR_BUFFER_TOO_SMALL : desc = "Buffer too small"; break; + case CHIP_ERROR_DUPLICATE_KEY_ID : desc = "Duplicate key id"; break; + case CHIP_ERROR_WRONG_KEY_TYPE : desc = "Wrong key type"; break; + case CHIP_ERROR_WELL_UNINITIALIZED : desc = "Well uninitialized"; break; + case CHIP_ERROR_WELL_EMPTY : desc = "Well empty"; break; + case CHIP_ERROR_INVALID_STRING_LENGTH : desc = "Invalid string length"; break; + case CHIP_ERROR_INVALID_LIST_LENGTH : desc = "invalid list length"; break; + case CHIP_ERROR_INVALID_INTEGRITY_TYPE : desc = "Invalid integrity type"; break; + case CHIP_END_OF_TLV : desc = "End of TLV"; break; + case CHIP_ERROR_TLV_UNDERRUN : desc = "TLV underrun"; break; + case CHIP_ERROR_INVALID_TLV_ELEMENT : desc = "Invalid TLV element"; break; + case CHIP_ERROR_INVALID_TLV_TAG : desc = "Invalid TLV tag"; break; + case CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG : desc = "Unknown implicit TLV tag"; break; + case CHIP_ERROR_WRONG_TLV_TYPE : desc = "Wrong TLV type"; break; + case CHIP_ERROR_TLV_CONTAINER_OPEN : desc = "TLV container open"; break; + case CHIP_ERROR_INVALID_TRANSFER_MODE : desc = "Invalid transfer mode"; break; + case CHIP_ERROR_INVALID_PROFILE_ID : desc = "Invalid profile id"; break; + case CHIP_ERROR_INVALID_MESSAGE_TYPE : desc = "Invalid message type"; break; + case CHIP_ERROR_UNEXPECTED_TLV_ELEMENT : desc = "Unexpected TLV element"; break; + case CHIP_ERROR_STATUS_REPORT_RECEIVED : desc = "Status Report received from peer"; break; + case CHIP_ERROR_NOT_IMPLEMENTED : desc = "Not Implemented"; break; + case CHIP_ERROR_INVALID_ADDRESS : desc = "Invalid address"; break; + case CHIP_ERROR_INVALID_ARGUMENT : desc = "Invalid argument"; break; + case CHIP_ERROR_TLV_TAG_NOT_FOUND : desc = "TLV tag not found"; break; - case WEAVE_ERROR_INVALID_PATH_LIST : desc = "Invalid TLV path list"; break; - case WEAVE_ERROR_INVALID_DATA_LIST : desc = "Invalid TLV data list"; break; - case WEAVE_ERROR_TRANSACTION_CANCELED : desc = "Transaction canceled"; break; - case WEAVE_ERROR_LISTENER_ALREADY_STARTED : desc = "Listener already started"; break; - case WEAVE_ERROR_LISTENER_ALREADY_STOPPED : desc = "Listener already stopped"; break; - case WEAVE_ERROR_UNKNOWN_TOPIC : desc = "Unknown Topic"; break; + case CHIP_ERROR_INVALID_PATH_LIST : desc = "Invalid TLV path list"; break; + case CHIP_ERROR_INVALID_DATA_LIST : desc = "Invalid TLV data list"; break; + case CHIP_ERROR_TRANSACTION_CANCELED : desc = "Transaction canceled"; break; + case CHIP_ERROR_LISTENER_ALREADY_STARTED : desc = "Listener already started"; break; + case CHIP_ERROR_LISTENER_ALREADY_STOPPED : desc = "Listener already stopped"; break; + case CHIP_ERROR_UNKNOWN_TOPIC : desc = "Unknown Topic"; break; - case WEAVE_ERROR_TIMEOUT : desc = "Timeout"; break; - case WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR : desc = "Invalid device descriptor"; break; - case WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION : desc = "Unsupported device descriptor version"; break; - case WEAVE_END_OF_INPUT : desc = "End of input"; break; - case WEAVE_ERROR_RATE_LIMIT_EXCEEDED : desc = "Rate limit exceeded"; break; - case WEAVE_ERROR_SECURITY_MANAGER_BUSY : desc = "Security manager busy"; break; - case WEAVE_ERROR_INVALID_PASE_PARAMETER : desc = "Invalid PASE parameter"; break; - case WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 : desc = "PASE supports only Config1"; break; - case WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS : desc = "No supported PASE configurations in common"; break; - case WEAVE_ERROR_INVALID_PASE_CONFIGURATION : desc = "Invalid PASE configuration"; break; - case WEAVE_ERROR_KEY_CONFIRMATION_FAILED : desc = "Key confirmation failed"; break; - case WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY : desc = "Invalid use of session key"; break; - case WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY : desc = "Connection closed unexpectedly"; break; - case WEAVE_ERROR_MISSING_TLV_ELEMENT : desc = "Missing TLV element"; break; - case WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE : desc = "Random data unavailable"; break; - case WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT : desc = "Unsupported type in host/port list"; break; - case WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX : desc = "Invalid suffix index in host/port list"; break; - case WEAVE_ERROR_HOST_PORT_LIST_EMPTY : desc = "Host/port empty"; break; - case WEAVE_ERROR_UNSUPPORTED_AUTH_MODE : desc = "Unsupported authentication mode"; break; + case CHIP_ERROR_TIMEOUT : desc = "Timeout"; break; + case CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR : desc = "Invalid device descriptor"; break; + case CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION : desc = "Unsupported device descriptor version"; break; + case CHIP_END_OF_INPUT : desc = "End of input"; break; + case CHIP_ERROR_RATE_LIMIT_EXCEEDED : desc = "Rate limit exceeded"; break; + case CHIP_ERROR_SECURITY_MANAGER_BUSY : desc = "Security manager busy"; break; + case CHIP_ERROR_INVALID_PASE_PARAMETER : desc = "Invalid PASE parameter"; break; + case CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 : desc = "PASE supports only Config1"; break; + case CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS : desc = "No supported PASE configurations in common"; break; + case CHIP_ERROR_INVALID_PASE_CONFIGURATION : desc = "Invalid PASE configuration"; break; + case CHIP_ERROR_KEY_CONFIRMATION_FAILED : desc = "Key confirmation failed"; break; + case CHIP_ERROR_INVALID_USE_OF_SESSION_KEY : desc = "Invalid use of session key"; break; + case CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY : desc = "Connection closed unexpectedly"; break; + case CHIP_ERROR_MISSING_TLV_ELEMENT : desc = "Missing TLV element"; break; + case CHIP_ERROR_RANDOM_DATA_UNAVAILABLE : desc = "Random data unavailable"; break; + case CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT : desc = "Unsupported type in host/port list"; break; + case CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX : desc = "Invalid suffix index in host/port list"; break; + case CHIP_ERROR_HOST_PORT_LIST_EMPTY : desc = "Host/port empty"; break; + case CHIP_ERROR_UNSUPPORTED_AUTH_MODE : desc = "Unsupported authentication mode"; break; - case WEAVE_ERROR_INVALID_SERVICE_EP : desc = "Invalid service endpoint"; break; - case WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE : desc = "Invalid directory entry type"; break; - case WEAVE_ERROR_FORCED_RESET : desc = "Service manager forced reset"; break; - case WEAVE_ERROR_NO_ENDPOINT : desc = "No endpoint was available to send the message"; break; - case WEAVE_ERROR_INVALID_DESTINATION_NODE_ID : desc = "Invalid destination node id"; break; - case WEAVE_ERROR_NOT_CONNECTED : desc = "Not connected"; break; - case WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE : desc = "No SW update available"; break; + case CHIP_ERROR_INVALID_SERVICE_EP : desc = "Invalid service endpoint"; break; + case CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE : desc = "Invalid directory entry type"; break; + case CHIP_ERROR_FORCED_RESET : desc = "Service manager forced reset"; break; + case CHIP_ERROR_NO_ENDPOINT : desc = "No endpoint was available to send the message"; break; + case CHIP_ERROR_INVALID_DESTINATION_NODE_ID : desc = "Invalid destination node id"; break; + case CHIP_ERROR_NOT_CONNECTED : desc = "Not connected"; break; + case CHIP_ERROR_NO_SW_UPDATE_AVAILABLE : desc = "No SW update available"; break; - case WEAVE_ERROR_CA_CERT_NOT_FOUND : desc = "CA certificate not found"; break; - case WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED : desc = "Certificate path length constraint exceeded"; break; - case WEAVE_ERROR_CERT_PATH_TOO_LONG : desc = "Certificate path too long"; break; - case WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED : desc = "Requested certificate usage is not allowed"; break; - case WEAVE_ERROR_CERT_EXPIRED : desc = "Certificate expired"; break; - case WEAVE_ERROR_CERT_NOT_VALID_YET : desc = "Certificate not yet valid"; break; - case WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT : desc = "Unsupported certificate format"; break; - case WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE : desc = "Unsupported elliptic curve"; break; - case WEAVE_CERT_NOT_USED : desc = "Certificate was not used in chain validation"; break; - case WEAVE_ERROR_CERT_NOT_FOUND : desc = "Certificate not found"; break; - case WEAVE_ERROR_INVALID_CASE_PARAMETER : desc = "Invalid CASE parameter"; break; - case WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION : desc = "Unsupported CASE configuration"; break; - case WEAVE_ERROR_CERT_LOAD_FAIL : desc = "Unable to load certificate"; break; - case WEAVE_ERROR_CERT_NOT_TRUSTED : desc = "Certificate not trusted"; break; - case WEAVE_ERROR_INVALID_ACCESS_TOKEN : desc = "Invalid access token"; break; - case WEAVE_ERROR_WRONG_CERT_SUBJECT : desc = "Wrong certificate subject"; break; - case WEAVE_ERROR_WRONG_NODE_ID : desc = "Wrong node ID"; break; - case WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT : desc = "Connection accepted on wrong port"; break; - case WEAVE_ERROR_CALLBACK_REPLACED : desc = "Application callback replaced"; break; - case WEAVE_ERROR_NO_CASE_AUTH_DELEGATE : desc = "No CASE auth delegate set"; break; - case WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT : desc = "Timeout attempting to locate device"; break; - case WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT : desc = "Timeout connecting to device"; break; - case WEAVE_ERROR_DEVICE_AUTH_TIMEOUT : desc = "Timeout authenticating device"; break; - case WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED : desc = "Message not acknowledged after max retries"; break; - case WEAVE_ERROR_RETRANS_TABLE_FULL : desc = "Retransmit Table is already full"; break; - case WEAVE_ERROR_INVALID_ACK_ID : desc = "Invalid Acknowledgment Id"; break; - case WEAVE_ERROR_SEND_THROTTLED : desc = "Sending to peer is throttled on this Exchange"; break; - case WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE : desc = "Message version not supported by current exchange context"; break; - case WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE : desc = "Required feature not supported by this configuration"; break; - case WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR : desc = "Unsolicited msg with originator bit clear"; break; - case WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION : desc = "Unsupported Tunnel version"; break; - case WEAVE_ERROR_INVALID_FABRIC_ID : desc = "Invalid Fabric Id"; break; - case WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL : desc = "Local tunnel nexthop table full"; break; - case WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL : desc = "Service queue full"; break; - case WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND : desc = "Shortcut Tunnel peer entry not found"; break; - case WEAVE_ERROR_TUNNEL_FORCE_ABORT : desc = "Forced Tunnel Abort."; break; - case WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED : desc = "DRBG entropy source failed to generate entropy data"; break; - case WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE : desc = "No TAKE auth delegate set"; break; - case WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED : desc = "TAKE requires a reconfigure"; break; - case WEAVE_ERROR_TAKE_REAUTH_POSSIBLE : desc = "TAKE can do a reauthentication"; break; - case WEAVE_ERROR_INVALID_TAKE_PARAMETER : desc = "TAKE received an invalid parameter"; break; - case WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION : desc = "TAKE Unsupported configuration"; break; - case WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED : desc = "TAKE token identification failed"; break; - case WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE : desc = "Invalid Token Pairing Bundle"; break; - case WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION : desc = "Unsupported Token Pairing Bundle version"; break; - case WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER : desc = "Key not found error code received from peer"; break; - case WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER : desc = "Wrong encryption type error code received from peer"; break; - case WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER : desc = "Unknown key type error code received from peer"; break; - case WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER : desc = "Invalid use of session key error code received from peer"; break; - case WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER : desc = "Unsupported encryption type error code received from peer"; break; - case WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER : desc = "Internal key error code received from peer"; break; - case WEAVE_ERROR_INVALID_KEY_ID : desc = "Invalid key identifier"; break; - case WEAVE_ERROR_INVALID_TIME : desc = "Valid time value is not available"; break; - case WEAVE_ERROR_LOCKING_FAILURE : desc = "Failure to lock/unlock OS-provided lock"; break; - case WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG : desc = "Unsupported passcode encryption configuration."; break; - case WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED : desc = "Passcode authentication failed."; break; - case WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED : desc = "Passcode fingerprint failed."; break; - case WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL : desc = "Element requested is null."; break; - case WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM : desc = "Certificate not signed with required signature algorithm"; break; - case WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM : desc = "Weave signature not signed with required signature algorithm"; break; - case WEAVE_ERROR_WDM_SCHEMA_MISMATCH : desc = "Schema mismatch in WDM."; break; - case WEAVE_ERROR_INVALID_INTEGER_VALUE : desc = "Invalid integer value."; break; - case WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS : desc = "Too many CASE reconfigurations were received."; break; - case WEAVE_ERROR_INVALID_MESSAGE_FLAG : desc = "Invalid message flag."; break; - case WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED : desc = "Key export protocol required to reconfigure."; break; - case WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS : desc = "No supported key export protocol configurations in common"; break; - case WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION : desc = "Invalid key export protocol configuration"; break; - case WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE : desc = "No key export protocol delegate set"; break; - case WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST : desc = "Unauthorized key export request"; break; - case WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE : desc = "Unauthorized key export response"; break; - case WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED : desc = "Exported key authentication failed"; break; - case WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES : desc = "Too many shared session end nodes"; break; - case WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT : desc = "Malformed WDM DataElement"; break; - case WEAVE_ERROR_WRONG_CERT_TYPE : desc = "Wrong certificate type"; break; - case WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED : desc = "Default event handler not called"; break; - case WEAVE_ERROR_PERSISTED_STORAGE_FAIL : desc = "Persisted storage failed"; break; - case WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND : desc = "Value not found in the persisted storage"; break; - case WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED : desc = "String context already registered"; break; - case WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED : desc = "String context not registered"; break; - case WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION : desc = "Incompatible data schema version"; break; - case WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED : desc = "Restricted Routing: Border Routing disabled"; break; - case WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED : desc = "The Reset reconnect timer is already armed"; break; - case WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION : desc = "Update Required Version mismatch"; break; - case WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT : desc = "Status Element in WDM update is malformed"; break; - case WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL : desc = "The WDM Subscriptionless Notify is partial"; break; - case WEAVE_ERROR_ACCESS_DENIED : desc = "The Weave message is not granted access"; break; - case WEAVE_ERROR_UNKNOWN_RESOURCE_ID : desc = "Unknown resource ID"; break; - case WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE : desc = "Malformed WDM Update response"; break; - case WEAVE_ERROR_WDM_VERSION_MISMATCH : desc = "The conditional update of a WDM path failed for a version mismatch"; break; - case WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS : desc = "A potential data loss was detected in a WDM Trait Instance"; break; - case WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE : desc = "Nest Legacy device doesn't support standalone Thread network creation"; break; - case WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY : desc = "The Trait Instance is already being updated with a different conditionality"; break; - case WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT : desc = "The local data does not match any known version of the Trait Instance"; break; - case WEAVE_ERROR_WDM_PATH_STORE_FULL : desc = "A WDM TraitPath store is full"; break; + case CHIP_ERROR_CA_CERT_NOT_FOUND : desc = "CA certificate not found"; break; + case CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED : desc = "Certificate path length constraint exceeded"; break; + case CHIP_ERROR_CERT_PATH_TOO_LONG : desc = "Certificate path too long"; break; + case CHIP_ERROR_CERT_USAGE_NOT_ALLOWED : desc = "Requested certificate usage is not allowed"; break; + case CHIP_ERROR_CERT_EXPIRED : desc = "Certificate expired"; break; + case CHIP_ERROR_CERT_NOT_VALID_YET : desc = "Certificate not yet valid"; break; + case CHIP_ERROR_UNSUPPORTED_CERT_FORMAT : desc = "Unsupported certificate format"; break; + case CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE : desc = "Unsupported elliptic curve"; break; + case CHIP_CERT_NOT_USED : desc = "Certificate was not used in chain validation"; break; + case CHIP_ERROR_CERT_NOT_FOUND : desc = "Certificate not found"; break; + case CHIP_ERROR_INVALID_CASE_PARAMETER : desc = "Invalid CASE parameter"; break; + case CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION : desc = "Unsupported CASE configuration"; break; + case CHIP_ERROR_CERT_LOAD_FAIL : desc = "Unable to load certificate"; break; + case CHIP_ERROR_CERT_NOT_TRUSTED : desc = "Certificate not trusted"; break; + case CHIP_ERROR_INVALID_ACCESS_TOKEN : desc = "Invalid access token"; break; + case CHIP_ERROR_WRONG_CERT_SUBJECT : desc = "Wrong certificate subject"; break; + case CHIP_ERROR_WRONG_NODE_ID : desc = "Wrong node ID"; break; + case CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT : desc = "Connection accepted on wrong port"; break; + case CHIP_ERROR_CALLBACK_REPLACED : desc = "Application callback replaced"; break; + case CHIP_ERROR_NO_CASE_AUTH_DELEGATE : desc = "No CASE auth delegate set"; break; + case CHIP_ERROR_DEVICE_LOCATE_TIMEOUT : desc = "Timeout attempting to locate device"; break; + case CHIP_ERROR_DEVICE_CONNECT_TIMEOUT : desc = "Timeout connecting to device"; break; + case CHIP_ERROR_DEVICE_AUTH_TIMEOUT : desc = "Timeout authenticating device"; break; + case CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED : desc = "Message not acknowledged after max retries"; break; + case CHIP_ERROR_RETRANS_TABLE_FULL : desc = "Retransmit Table is already full"; break; + case CHIP_ERROR_INVALID_ACK_ID : desc = "Invalid Acknowledgment Id"; break; + case CHIP_ERROR_SEND_THROTTLED : desc = "Sending to peer is throttled on this Exchange"; break; + case CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE : desc = "Message version not supported by current exchange context"; break; + case CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE : desc = "Required feature not supported by this configuration"; break; + case CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR : desc = "Unsolicited msg with originator bit clear"; break; + case CHIP_ERROR_UNSUPPORTED_TUNNEL_VERSION : desc = "Unsupported Tunnel version"; break; + case CHIP_ERROR_INVALID_FABRIC_ID : desc = "Invalid Fabric Id"; break; + case CHIP_ERROR_TUNNEL_NEXTHOP_TABLE_FULL : desc = "Local tunnel nexthop table full"; break; + case CHIP_ERROR_TUNNEL_SERVICE_QUEUE_FULL : desc = "Service queue full"; break; + case CHIP_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND : desc = "Shortcut Tunnel peer entry not found"; break; + case CHIP_ERROR_TUNNEL_FORCE_ABORT : desc = "Forced Tunnel Abort."; break; + case CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED : desc = "DRBG entropy source failed to generate entropy data"; break; + case CHIP_ERROR_NO_TAKE_AUTH_DELEGATE : desc = "No TAKE auth delegate set"; break; + case CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED : desc = "TAKE requires a reconfigure"; break; + case CHIP_ERROR_TAKE_REAUTH_POSSIBLE : desc = "TAKE can do a reauthentication"; break; + case CHIP_ERROR_INVALID_TAKE_PARAMETER : desc = "TAKE received an invalid parameter"; break; + case CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION : desc = "TAKE Unsupported configuration"; break; + case CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED : desc = "TAKE token identification failed"; break; + case CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE : desc = "Invalid Token Pairing Bundle"; break; + case CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION : desc = "Unsupported Token Pairing Bundle version"; break; + case CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER : desc = "Key not found error code received from peer"; break; + case CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER : desc = "Wrong encryption type error code received from peer"; break; + case CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER : desc = "Unknown key type error code received from peer"; break; + case CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER : desc = "Invalid use of session key error code received from peer"; break; + case CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER : desc = "Unsupported encryption type error code received from peer"; break; + case CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER : desc = "Internal key error code received from peer"; break; + case CHIP_ERROR_INVALID_KEY_ID : desc = "Invalid key identifier"; break; + case CHIP_ERROR_INVALID_TIME : desc = "Valid time value is not available"; break; + case CHIP_ERROR_LOCKING_FAILURE : desc = "Failure to lock/unlock OS-provided lock"; break; + case CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG : desc = "Unsupported passcode encryption configuration."; break; + case CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED : desc = "Passcode authentication failed."; break; + case CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED : desc = "Passcode fingerprint failed."; break; + case CHIP_ERROR_SERIALIZATION_ELEMENT_NULL : desc = "Element requested is null."; break; + case CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM : desc = "Certificate not signed with required signature algorithm"; break; + case CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM : desc = "CHIP signature not signed with required signature algorithm"; break; + case CHIP_ERROR_WDM_SCHEMA_MISMATCH : desc = "Schema mismatch in WDM."; break; + case CHIP_ERROR_INVALID_INTEGER_VALUE : desc = "Invalid integer value."; break; + case CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS : desc = "Too many CASE reconfigurations were received."; break; + case CHIP_ERROR_INVALID_MESSAGE_FLAG : desc = "Invalid message flag."; break; + case CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED : desc = "Key export protocol required to reconfigure."; break; + case CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS : desc = "No supported key export protocol configurations in common"; break; + case CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION : desc = "Invalid key export protocol configuration"; break; + case CHIP_ERROR_NO_KEY_EXPORT_DELEGATE : desc = "No key export protocol delegate set"; break; + case CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST : desc = "Unauthorized key export request"; break; + case CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE : desc = "Unauthorized key export response"; break; + case CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED : desc = "Exported key authentication failed"; break; + case CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES : desc = "Too many shared session end nodes"; break; + case CHIP_ERROR_WDM_MALFORMED_DATA_ELEMENT : desc = "Malformed WDM DataElement"; break; + case CHIP_ERROR_WRONG_CERT_TYPE : desc = "Wrong certificate type"; break; + case CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED : desc = "Default event handler not called"; break; + case CHIP_ERROR_PERSISTED_STORAGE_FAIL : desc = "Persisted storage failed"; break; + case CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND : desc = "Value not found in the persisted storage"; break; + case CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED : desc = "String context already registered"; break; + case CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED : desc = "String context not registered"; break; + case CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION : desc = "Incompatible data schema version"; break; + case CHIP_ERROR_TUNNEL_ROUTING_RESTRICTED : desc = "Restricted Routing: Border Routing disabled"; break; + case CHIP_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED : desc = "The Reset reconnect timer is already armed"; break; + case CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION : desc = "Update Required Version mismatch"; break; + case CHIP_ERROR_WDM_MALFORMED_STATUS_ELEMENT : desc = "Status Element in WDM update is malformed"; break; + case CHIP_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL : desc = "The WDM Subscriptionless Notify is partial"; break; + case CHIP_ERROR_ACCESS_DENIED : desc = "The CHIP message is not granted access"; break; + case CHIP_ERROR_UNKNOWN_RESOURCE_ID : desc = "Unknown resource ID"; break; + case CHIP_ERROR_WDM_MALFORMED_UPDATE_RESPONSE : desc = "Malformed WDM Update response"; break; + case CHIP_ERROR_WDM_VERSION_MISMATCH : desc = "The conditional update of a WDM path failed for a version mismatch"; break; + case CHIP_ERROR_WDM_POTENTIAL_DATA_LOSS : desc = "A potential data loss was detected in a WDM Trait Instance"; break; + case CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE : desc = "Legacy device doesn't support standalone Thread network creation"; break; + case CHIP_ERROR_WDM_INCONSISTENT_CONDITIONALITY : desc = "The Trait Instance is already being updated with a different conditionality"; break; + case CHIP_ERROR_WDM_LOCAL_DATA_INCONSISTENT : desc = "The local data does not match any known version of the Trait Instance"; break; + case CHIP_ERROR_WDM_PATH_STORE_FULL : desc = "A WDM TraitPath store is full"; break; } -#endif // !WEAVE_CONFIG_SHORT_ERROR_STR +#endif // !CHIP_CONFIG_SHORT_ERROR_STR - FormatError(buf, bufSize, "Weave", err, desc); + FormatError(buf, bufSize, "CHIP", err, desc); return true; } -} // namespace Weave -} // namespace nl +} // namespace chip diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 35f99827f59a1c..9a87b2bd3c0f1c 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2013-2017 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. @@ -18,77 +17,77 @@ /** * @file - * This file defines error constants for the Nest Weave core + * This file defines error constants for the CHIP core * subsystem. * * Error types, ranges, and mappings overrides may be made by - * defining the appropriate WEAVE_CONFIG_* or _WEAVE_CONFIG_* + * defining the appropriate CHIP_CONFIG_* or _CHIP_CONFIG_* * macros. * * NOTE WELL: On some platforms, this header is included by C-language programs. * */ -#ifndef WEAVE_ERROR_H -#define WEAVE_ERROR_H +#ifndef CHIP_ERROR_H +#define CHIP_ERROR_H -#include "WeaveConfig.h" +#include "CHIPConfig.h" // clang-format off /** - * @def WEAVE_NO_ERROR + * @def CHIP_NO_ERROR * * @brief - * This defines the Weave error code for success or no error. - * This value may be configured via #WEAVE_CONFIG_NO_ERROR." + * This defines the CHIP error code for success or no error. + * This value may be configured via #CHIP_CONFIG_NO_ERROR." * */ -#define WEAVE_NO_ERROR WEAVE_CONFIG_NO_ERROR +#define CHIP_NO_ERROR CHIP_CONFIG_NO_ERROR /** - * @def WEAVE_ERROR_MIN + * @def CHIP_ERROR_MIN * * @brief - * This defines the bottom or minimum Weave error number range. - * This value may be configured via #WEAVE_CONFIG_ERROR_MIN. + * This defines the bottom or minimum CHIP error number range. + * This value may be configured via #CHIP_CONFIG_ERROR_MIN. * */ -#define WEAVE_ERROR_MIN WEAVE_CONFIG_ERROR_MIN +#define CHIP_ERROR_MIN CHIP_CONFIG_ERROR_MIN /** - * @def WEAVE_ERROR_MAX + * @def CHIP_ERROR_MAX * * @brief - * This defines the top or maximum Weave error number range. - * This value may be configured via #WEAVE_CONFIG_ERROR_MAX. + * This defines the top or maximum CHIP error number range. + * This value may be configured via #CHIP_CONFIG_ERROR_MAX. * */ -#define WEAVE_ERROR_MAX WEAVE_CONFIG_ERROR_MAX +#define CHIP_ERROR_MAX CHIP_CONFIG_ERROR_MAX /** - * @def _WEAVE_ERROR(e) + * @def _CHIP_ERROR(e) * * @brief - * This defines a mapping function for Weave errors that allows + * This defines a mapping function for CHIP errors that allows * mapping such errors into a platform- or system-specific range. - * This function may be configured via #_WEAVE_CONFIG_ERROR(e). + * This function may be configured via #_CHIP_CONFIG_ERROR(e). * - * @param[in] e The Weave error to map. + * @param[in] e The CHIP error to map. * - * @return The mapped Weave error. + * @return The mapped CHIP error. * * */ -#define _WEAVE_ERROR(e) _WEAVE_CONFIG_ERROR(e) +#define _CHIP_ERROR(e) _CHIP_CONFIG_ERROR(e) /** - * The basic type for all Weave errors. + * The basic type for all CHIP errors. * * @brief * This is defined to a platform- or system-specific type. * */ -typedef WEAVE_CONFIG_ERROR_TYPE WEAVE_ERROR; +typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; /** * @name Error Definitions @@ -97,1603 +96,1603 @@ typedef WEAVE_CONFIG_ERROR_TYPE WEAVE_ERROR; */ /** - * @def WEAVE_ERROR_TOO_MANY_CONNECTIONS + * @def CHIP_ERROR_TOO_MANY_CONNECTIONS * * @brief * The attempt to allocate a connection object failed because too many * connections exist. * */ -#define WEAVE_ERROR_TOO_MANY_CONNECTIONS _WEAVE_ERROR(0) +#define CHIP_ERROR_TOO_MANY_CONNECTIONS _CHIP_ERROR(0) /** - * @def WEAVE_ERROR_SENDING_BLOCKED + * @def CHIP_ERROR_SENDING_BLOCKED * * @brief * A message exceeds the sent limit. * */ -#define WEAVE_ERROR_SENDING_BLOCKED _WEAVE_ERROR(1) +#define CHIP_ERROR_SENDING_BLOCKED _CHIP_ERROR(1) /** - * @def WEAVE_ERROR_CONNECTION_ABORTED + * @def CHIP_ERROR_CONNECTION_ABORTED * * @brief * A connection has been aborted. * */ -#define WEAVE_ERROR_CONNECTION_ABORTED _WEAVE_ERROR(2) +#define CHIP_ERROR_CONNECTION_ABORTED _CHIP_ERROR(2) /** - * @def WEAVE_ERROR_INCORRECT_STATE + * @def CHIP_ERROR_INCORRECT_STATE * * @brief * An unexpected state was encountered. * */ -#define WEAVE_ERROR_INCORRECT_STATE _WEAVE_ERROR(3) +#define CHIP_ERROR_INCORRECT_STATE _CHIP_ERROR(3) /** - * @def WEAVE_ERROR_MESSAGE_TOO_LONG + * @def CHIP_ERROR_MESSAGE_TOO_LONG * * @brief * A message is too long. * */ -#define WEAVE_ERROR_MESSAGE_TOO_LONG _WEAVE_ERROR(4) +#define CHIP_ERROR_MESSAGE_TOO_LONG _CHIP_ERROR(4) /** - * @def WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION + * @def CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION * * @brief * An exchange version is not supported. * */ -#define WEAVE_ERROR_UNSUPPORTED_EXCHANGE_VERSION _WEAVE_ERROR(5) +#define CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION _CHIP_ERROR(5) /** - * @def WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS + * @def CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS * * @brief * The attempt to register an unsolicited message handler failed because the * unsolicited message handler pool is full. * */ -#define WEAVE_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS _WEAVE_ERROR(6) +#define CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS _CHIP_ERROR(6) /** - * @def WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER + * @def CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER * * @brief * The attempt to unregister an unsolicited message handler failed because * the target handler was not found in the unsolicited message handler pool. * */ -#define WEAVE_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER _WEAVE_ERROR(7) +#define CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER _CHIP_ERROR(7) /** - * @def WEAVE_ERROR_NO_CONNECTION_HANDLER + * @def CHIP_ERROR_NO_CONNECTION_HANDLER * * @brief * No callback has been registered for handling a connection. * */ -#define WEAVE_ERROR_NO_CONNECTION_HANDLER _WEAVE_ERROR(8) +#define CHIP_ERROR_NO_CONNECTION_HANDLER _CHIP_ERROR(8) /** - * @def WEAVE_ERROR_TOO_MANY_PEER_NODES + * @def CHIP_ERROR_TOO_MANY_PEER_NODES * * @brief * The number of peer nodes exceeds the maximum limit of a local node. * */ -#define WEAVE_ERROR_TOO_MANY_PEER_NODES _WEAVE_ERROR(9) +#define CHIP_ERROR_TOO_MANY_PEER_NODES _CHIP_ERROR(9) /** - * @def WEAVE_ERROR_NO_MEMORY + * @def CHIP_ERROR_NO_MEMORY * * @brief * The attempt to allocate a buffer or object failed due to a lack of memory. * */ -#define WEAVE_ERROR_NO_MEMORY _WEAVE_ERROR(11) +#define CHIP_ERROR_NO_MEMORY _CHIP_ERROR(11) /** - * @def WEAVE_ERROR_NO_MESSAGE_HANDLER + * @def CHIP_ERROR_NO_MESSAGE_HANDLER * * @brief * No callback has been registered for handling a message. * */ -#define WEAVE_ERROR_NO_MESSAGE_HANDLER _WEAVE_ERROR(12) +#define CHIP_ERROR_NO_MESSAGE_HANDLER _CHIP_ERROR(12) /** - * @def WEAVE_ERROR_MESSAGE_INCOMPLETE + * @def CHIP_ERROR_MESSAGE_INCOMPLETE * * @brief * A message is incomplete. * */ -#define WEAVE_ERROR_MESSAGE_INCOMPLETE _WEAVE_ERROR(13) +#define CHIP_ERROR_MESSAGE_INCOMPLETE _CHIP_ERROR(13) /** - * @def WEAVE_ERROR_DATA_NOT_ALIGNED + * @def CHIP_ERROR_DATA_NOT_ALIGNED * * @brief * The data is not aligned. * */ -#define WEAVE_ERROR_DATA_NOT_ALIGNED _WEAVE_ERROR(14) +#define CHIP_ERROR_DATA_NOT_ALIGNED _CHIP_ERROR(14) /** - * @def WEAVE_ERROR_UNKNOWN_KEY_TYPE + * @def CHIP_ERROR_UNKNOWN_KEY_TYPE * * @brief * The encryption key type is unknown. * */ -#define WEAVE_ERROR_UNKNOWN_KEY_TYPE _WEAVE_ERROR(15) +#define CHIP_ERROR_UNKNOWN_KEY_TYPE _CHIP_ERROR(15) /** - * @def WEAVE_ERROR_KEY_NOT_FOUND + * @def CHIP_ERROR_KEY_NOT_FOUND * * @brief * The encryption key is not found. * */ -#define WEAVE_ERROR_KEY_NOT_FOUND _WEAVE_ERROR(16) +#define CHIP_ERROR_KEY_NOT_FOUND _CHIP_ERROR(16) /** - * @def WEAVE_ERROR_WRONG_ENCRYPTION_TYPE + * @def CHIP_ERROR_WRONG_ENCRYPTION_TYPE * * @brief * The encryption type is incorrect for the specified key. * */ -#define WEAVE_ERROR_WRONG_ENCRYPTION_TYPE _WEAVE_ERROR(17) +#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE _CHIP_ERROR(17) /** - * @def WEAVE_ERROR_TOO_MANY_KEYS + * @def CHIP_ERROR_TOO_MANY_KEYS * * @brief * The attempt to allocate a key failed because the number of active keys * exceeds the maximum limit. * */ -#define WEAVE_ERROR_TOO_MANY_KEYS _WEAVE_ERROR(18) +#define CHIP_ERROR_TOO_MANY_KEYS _CHIP_ERROR(18) /** - * @def WEAVE_ERROR_INTEGRITY_CHECK_FAILED + * @def CHIP_ERROR_INTEGRITY_CHECK_FAILED * * @brief * The integrity check in the message does not match the expected integrity * check. * */ -#define WEAVE_ERROR_INTEGRITY_CHECK_FAILED _WEAVE_ERROR(19) +#define CHIP_ERROR_INTEGRITY_CHECK_FAILED _CHIP_ERROR(19) /** - * @def WEAVE_ERROR_INVALID_SIGNATURE + * @def CHIP_ERROR_INVALID_SIGNATURE * * @brief * Invalid signature. * */ -#define WEAVE_ERROR_INVALID_SIGNATURE _WEAVE_ERROR(20) +#define CHIP_ERROR_INVALID_SIGNATURE _CHIP_ERROR(20) /** - * @def WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION + * @def CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION * * @brief * A message version is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_MESSAGE_VERSION _WEAVE_ERROR(21) +#define CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION _CHIP_ERROR(21) /** - * @def WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE + * @def CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE * * @brief * An encryption type is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE _WEAVE_ERROR(22) +#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE _CHIP_ERROR(22) /** - * @def WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE + * @def CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE * * @brief * A signature type is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_SIGNATURE_TYPE _WEAVE_ERROR(23) +#define CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE _CHIP_ERROR(23) /** - * @def WEAVE_ERROR_INVALID_MESSAGE_LENGTH + * @def CHIP_ERROR_INVALID_MESSAGE_LENGTH * * @brief * A message length is invalid. * */ -#define WEAVE_ERROR_INVALID_MESSAGE_LENGTH _WEAVE_ERROR(24) +#define CHIP_ERROR_INVALID_MESSAGE_LENGTH _CHIP_ERROR(24) /** - * @def WEAVE_ERROR_BUFFER_TOO_SMALL + * @def CHIP_ERROR_BUFFER_TOO_SMALL * * @brief * A buffer is too small. * */ -#define WEAVE_ERROR_BUFFER_TOO_SMALL _WEAVE_ERROR(25) +#define CHIP_ERROR_BUFFER_TOO_SMALL _CHIP_ERROR(25) /** - * @def WEAVE_ERROR_DUPLICATE_KEY_ID + * @def CHIP_ERROR_DUPLICATE_KEY_ID * * @brief * A key id is duplicate. * */ -#define WEAVE_ERROR_DUPLICATE_KEY_ID _WEAVE_ERROR(26) +#define CHIP_ERROR_DUPLICATE_KEY_ID _CHIP_ERROR(26) /** - * @def WEAVE_ERROR_WRONG_KEY_TYPE + * @def CHIP_ERROR_WRONG_KEY_TYPE * * @brief * A key type does not match the expected key type. * */ -#define WEAVE_ERROR_WRONG_KEY_TYPE _WEAVE_ERROR(27) +#define CHIP_ERROR_WRONG_KEY_TYPE _CHIP_ERROR(27) /** - * @def WEAVE_ERROR_WELL_UNINITIALIZED + * @def CHIP_ERROR_WELL_UNINITIALIZED * * @brief * A requested object is uninitialized. * */ -#define WEAVE_ERROR_WELL_UNINITIALIZED _WEAVE_ERROR(28) +#define CHIP_ERROR_WELL_UNINITIALIZED _CHIP_ERROR(28) /** - * @def WEAVE_ERROR_WELL_EMPTY + * @def CHIP_ERROR_WELL_EMPTY * * @brief * A requested object is empty. * */ -#define WEAVE_ERROR_WELL_EMPTY _WEAVE_ERROR(29) +#define CHIP_ERROR_WELL_EMPTY _CHIP_ERROR(29) /** - * @def WEAVE_ERROR_INVALID_STRING_LENGTH + * @def CHIP_ERROR_INVALID_STRING_LENGTH * * @brief * A string length is invalid. * */ -#define WEAVE_ERROR_INVALID_STRING_LENGTH _WEAVE_ERROR(30) +#define CHIP_ERROR_INVALID_STRING_LENGTH _CHIP_ERROR(30) /** - * @def WEAVE_ERROR_INVALID_LIST_LENGTH + * @def CHIP_ERROR_INVALID_LIST_LENGTH * * @brief * A list length is invalid. * */ -#define WEAVE_ERROR_INVALID_LIST_LENGTH _WEAVE_ERROR(31) +#define CHIP_ERROR_INVALID_LIST_LENGTH _CHIP_ERROR(31) /** - * @def WEAVE_ERROR_INVALID_INTEGRITY_TYPE + * @def CHIP_ERROR_INVALID_INTEGRITY_TYPE * * @brief * An integrity type is invalid. * */ -#define WEAVE_ERROR_INVALID_INTEGRITY_TYPE _WEAVE_ERROR(32) +#define CHIP_ERROR_INVALID_INTEGRITY_TYPE _CHIP_ERROR(32) /** - * @def WEAVE_END_OF_TLV + * @def CHIP_END_OF_TLV * * @brief * The end of a TLV encoding, * or the end of a TLV container element has been reached. * */ -#define WEAVE_END_OF_TLV _WEAVE_ERROR(33) +#define CHIP_END_OF_TLV _CHIP_ERROR(33) /** - * @def WEAVE_ERROR_TLV_UNDERRUN + * @def CHIP_ERROR_TLV_UNDERRUN * * @brief * The TLV encoding ended prematurely. * */ -#define WEAVE_ERROR_TLV_UNDERRUN _WEAVE_ERROR(34) +#define CHIP_ERROR_TLV_UNDERRUN _CHIP_ERROR(34) /** - * @def WEAVE_ERROR_INVALID_TLV_ELEMENT + * @def CHIP_ERROR_INVALID_TLV_ELEMENT * * @brief * A TLV element is invalid. * */ -#define WEAVE_ERROR_INVALID_TLV_ELEMENT _WEAVE_ERROR(35) +#define CHIP_ERROR_INVALID_TLV_ELEMENT _CHIP_ERROR(35) /** - * @def WEAVE_ERROR_INVALID_TLV_TAG + * @def CHIP_ERROR_INVALID_TLV_TAG * * @brief * A TLV tag is invalid. * */ -#define WEAVE_ERROR_INVALID_TLV_TAG _WEAVE_ERROR(36) +#define CHIP_ERROR_INVALID_TLV_TAG _CHIP_ERROR(36) /** - * @def WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG + * @def CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG * * @brief * An implicitly encoded TLV tag was encountered, * but an implicit profile id has not been defined. * */ -#define WEAVE_ERROR_UNKNOWN_IMPLICIT_TLV_TAG _WEAVE_ERROR(37) +#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG _CHIP_ERROR(37) /** - * @def WEAVE_ERROR_WRONG_TLV_TYPE + * @def CHIP_ERROR_WRONG_TLV_TYPE * * @brief * A TLV type is wrong. * */ -#define WEAVE_ERROR_WRONG_TLV_TYPE _WEAVE_ERROR(38) +#define CHIP_ERROR_WRONG_TLV_TYPE _CHIP_ERROR(38) /** - * @def WEAVE_ERROR_TLV_CONTAINER_OPEN + * @def CHIP_ERROR_TLV_CONTAINER_OPEN * * @brief * A TLV container is unexpectedly open. * */ -#define WEAVE_ERROR_TLV_CONTAINER_OPEN _WEAVE_ERROR(39) +#define CHIP_ERROR_TLV_CONTAINER_OPEN _CHIP_ERROR(39) /** - * @def WEAVE_ERROR_INVALID_TRANSFER_MODE + * @def CHIP_ERROR_INVALID_TRANSFER_MODE * * @brief * A transfer mode is invalid. * */ -#define WEAVE_ERROR_INVALID_TRANSFER_MODE _WEAVE_ERROR(40) +#define CHIP_ERROR_INVALID_TRANSFER_MODE _CHIP_ERROR(40) /** - * @def WEAVE_ERROR_INVALID_PROFILE_ID + * @def CHIP_ERROR_INVALID_PROFILE_ID * * @brief * A profile id is invalid. * */ -#define WEAVE_ERROR_INVALID_PROFILE_ID _WEAVE_ERROR(41) +#define CHIP_ERROR_INVALID_PROFILE_ID _CHIP_ERROR(41) /** - * @def WEAVE_ERROR_INVALID_MESSAGE_TYPE + * @def CHIP_ERROR_INVALID_MESSAGE_TYPE * * @brief * A message type is invalid. * */ -#define WEAVE_ERROR_INVALID_MESSAGE_TYPE _WEAVE_ERROR(42) +#define CHIP_ERROR_INVALID_MESSAGE_TYPE _CHIP_ERROR(42) /** - * @def WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT + * @def CHIP_ERROR_UNEXPECTED_TLV_ELEMENT * * @brief * An unexpected TLV element was encountered. * */ -#define WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT _WEAVE_ERROR(43) +#define CHIP_ERROR_UNEXPECTED_TLV_ELEMENT _CHIP_ERROR(43) /** - * @def WEAVE_ERROR_STATUS_REPORT_RECEIVED + * @def CHIP_ERROR_STATUS_REPORT_RECEIVED * * @brief * A status report is received from a peer node. * */ -#define WEAVE_ERROR_STATUS_REPORT_RECEIVED _WEAVE_ERROR(44) +#define CHIP_ERROR_STATUS_REPORT_RECEIVED _CHIP_ERROR(44) /** - * @def WEAVE_ERROR_NOT_IMPLEMENTED + * @def CHIP_ERROR_NOT_IMPLEMENTED * * @brief * A requested function or feature is not implemented. * */ -#define WEAVE_ERROR_NOT_IMPLEMENTED _WEAVE_ERROR(45) +#define CHIP_ERROR_NOT_IMPLEMENTED _CHIP_ERROR(45) /** - * @def WEAVE_ERROR_INVALID_ADDRESS + * @def CHIP_ERROR_INVALID_ADDRESS * * @brief * An address is invalid. * */ -#define WEAVE_ERROR_INVALID_ADDRESS _WEAVE_ERROR(46) +#define CHIP_ERROR_INVALID_ADDRESS _CHIP_ERROR(46) /** - * @def WEAVE_ERROR_INVALID_ARGUMENT + * @def CHIP_ERROR_INVALID_ARGUMENT * * @brief * An argument is invalid. * */ -#define WEAVE_ERROR_INVALID_ARGUMENT _WEAVE_ERROR(47) +#define CHIP_ERROR_INVALID_ARGUMENT _CHIP_ERROR(47) /** - * @def WEAVE_ERROR_INVALID_PATH_LIST + * @def CHIP_ERROR_INVALID_PATH_LIST * * @brief * A TLV path list is invalid. * */ -#define WEAVE_ERROR_INVALID_PATH_LIST _WEAVE_ERROR(48) +#define CHIP_ERROR_INVALID_PATH_LIST _CHIP_ERROR(48) /** - * @def WEAVE_ERROR_INVALID_DATA_LIST + * @def CHIP_ERROR_INVALID_DATA_LIST * * @brief * A TLV data list is invalid. * */ -#define WEAVE_ERROR_INVALID_DATA_LIST _WEAVE_ERROR(49) +#define CHIP_ERROR_INVALID_DATA_LIST _CHIP_ERROR(49) /** - * @def WEAVE_ERROR_TIMEOUT + * @def CHIP_ERROR_TIMEOUT * * @brief * A request timed out. * */ -#define WEAVE_ERROR_TIMEOUT _WEAVE_ERROR(50) +#define CHIP_ERROR_TIMEOUT _CHIP_ERROR(50) /** - * @def WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR + * @def CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR * * @brief * A device descriptor is invalid. * */ -#define WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR _WEAVE_ERROR(51) +#define CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR _CHIP_ERROR(51) /** - * @def WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION + * @def CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION * * @brief * A device descriptor version is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION _WEAVE_ERROR(52) +#define CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION _CHIP_ERROR(52) /** - * @def WEAVE_END_OF_INPUT + * @def CHIP_END_OF_INPUT * * @brief * An input ended. * */ -#define WEAVE_END_OF_INPUT _WEAVE_ERROR(53) +#define CHIP_END_OF_INPUT _CHIP_ERROR(53) /** - * @def WEAVE_ERROR_RATE_LIMIT_EXCEEDED + * @def CHIP_ERROR_RATE_LIMIT_EXCEEDED * * @brief * A rate limit is exceeded. * */ -#define WEAVE_ERROR_RATE_LIMIT_EXCEEDED _WEAVE_ERROR(54) +#define CHIP_ERROR_RATE_LIMIT_EXCEEDED _CHIP_ERROR(54) /** - * @def WEAVE_ERROR_SECURITY_MANAGER_BUSY + * @def CHIP_ERROR_SECURITY_MANAGER_BUSY * * @brief * A security manager is busy. * */ -#define WEAVE_ERROR_SECURITY_MANAGER_BUSY _WEAVE_ERROR(55) +#define CHIP_ERROR_SECURITY_MANAGER_BUSY _CHIP_ERROR(55) /** - * @def WEAVE_ERROR_INVALID_PASE_PARAMETER + * @def CHIP_ERROR_INVALID_PASE_PARAMETER * * @brief * A PASE parameter is invalid. * */ -#define WEAVE_ERROR_INVALID_PASE_PARAMETER _WEAVE_ERROR(56) +#define CHIP_ERROR_INVALID_PASE_PARAMETER _CHIP_ERROR(56) /** - * @def WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 + * @def CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 * * @brief * PASE supports only config1. * */ -#define WEAVE_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 _WEAVE_ERROR(57) +#define CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 _CHIP_ERROR(57) /** - * @def WEAVE_ERROR_KEY_CONFIRMATION_FAILED + * @def CHIP_ERROR_KEY_CONFIRMATION_FAILED * * @brief * A key confirmation failed. * */ -#define WEAVE_ERROR_KEY_CONFIRMATION_FAILED _WEAVE_ERROR(58) +#define CHIP_ERROR_KEY_CONFIRMATION_FAILED _CHIP_ERROR(58) /** - * @def WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY + * @def CHIP_ERROR_INVALID_USE_OF_SESSION_KEY * * @brief * A use of session key is invalid. * */ -#define WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY _WEAVE_ERROR(59) +#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY _CHIP_ERROR(59) /** - * @def WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY + * @def CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY * * @brief * A connection is closed unexpectedly. * */ -#define WEAVE_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY _WEAVE_ERROR(60) +#define CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY _CHIP_ERROR(60) /** - * @def WEAVE_ERROR_MISSING_TLV_ELEMENT + * @def CHIP_ERROR_MISSING_TLV_ELEMENT * * @brief * A TLV element is missing. * */ -#define WEAVE_ERROR_MISSING_TLV_ELEMENT _WEAVE_ERROR(61) +#define CHIP_ERROR_MISSING_TLV_ELEMENT _CHIP_ERROR(61) /** - * @def WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE + * @def CHIP_ERROR_RANDOM_DATA_UNAVAILABLE * * @brief * Secure random data is not available. * */ -#define WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE _WEAVE_ERROR(62) +#define CHIP_ERROR_RANDOM_DATA_UNAVAILABLE _CHIP_ERROR(62) /** - * @def WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT + * @def CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT * * @brief * A type in host/port list is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT _WEAVE_ERROR(63) +#define CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT _CHIP_ERROR(63) /** - * @def WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX + * @def CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX * * @brief * A suffix index in host/port list is invalid. * */ -#define WEAVE_ERROR_INVALID_HOST_SUFFIX_INDEX _WEAVE_ERROR(64) +#define CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX _CHIP_ERROR(64) /** - * @def WEAVE_ERROR_HOST_PORT_LIST_EMPTY + * @def CHIP_ERROR_HOST_PORT_LIST_EMPTY * * @brief * A host/port list is empty. * */ -#define WEAVE_ERROR_HOST_PORT_LIST_EMPTY _WEAVE_ERROR(65) +#define CHIP_ERROR_HOST_PORT_LIST_EMPTY _CHIP_ERROR(65) /** - * @def WEAVE_ERROR_UNSUPPORTED_AUTH_MODE + * @def CHIP_ERROR_UNSUPPORTED_AUTH_MODE * * @brief * An authentication mode is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_AUTH_MODE _WEAVE_ERROR(66) +#define CHIP_ERROR_UNSUPPORTED_AUTH_MODE _CHIP_ERROR(66) /** - * @def WEAVE_ERROR_INVALID_SERVICE_EP + * @def CHIP_ERROR_INVALID_SERVICE_EP * * @brief * A service endpoint is invalid. * */ -#define WEAVE_ERROR_INVALID_SERVICE_EP _WEAVE_ERROR(67) +#define CHIP_ERROR_INVALID_SERVICE_EP _CHIP_ERROR(67) /** - * @def WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE + * @def CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE * * @brief * A directory entry type is unknown. * */ -#define WEAVE_ERROR_INVALID_DIRECTORY_ENTRY_TYPE _WEAVE_ERROR(68) +#define CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE _CHIP_ERROR(68) /** - * @def WEAVE_ERROR_FORCED_RESET + * @def CHIP_ERROR_FORCED_RESET * * @brief * A service manager is forced to reset. * */ -#define WEAVE_ERROR_FORCED_RESET _WEAVE_ERROR(69) +#define CHIP_ERROR_FORCED_RESET _CHIP_ERROR(69) /** - * @def WEAVE_ERROR_NO_ENDPOINT + * @def CHIP_ERROR_NO_ENDPOINT * * @brief * No endpoint is available. * */ -#define WEAVE_ERROR_NO_ENDPOINT _WEAVE_ERROR(70) +#define CHIP_ERROR_NO_ENDPOINT _CHIP_ERROR(70) /** - * @def WEAVE_ERROR_INVALID_DESTINATION_NODE_ID + * @def CHIP_ERROR_INVALID_DESTINATION_NODE_ID * * @brief * A destination node id is invalid. * */ -#define WEAVE_ERROR_INVALID_DESTINATION_NODE_ID _WEAVE_ERROR(71) +#define CHIP_ERROR_INVALID_DESTINATION_NODE_ID _CHIP_ERROR(71) /** - * @def WEAVE_ERROR_NOT_CONNECTED + * @def CHIP_ERROR_NOT_CONNECTED * * @brief * The operation cannot be performed because the underlying object is not * connected. * */ -#define WEAVE_ERROR_NOT_CONNECTED _WEAVE_ERROR(72) +#define CHIP_ERROR_NOT_CONNECTED _CHIP_ERROR(72) /** - * @def WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE + * @def CHIP_ERROR_NO_SW_UPDATE_AVAILABLE * * @brief * No software update is available. * */ -#define WEAVE_ERROR_NO_SW_UPDATE_AVAILABLE _WEAVE_ERROR(73) +#define CHIP_ERROR_NO_SW_UPDATE_AVAILABLE _CHIP_ERROR(73) /** - * @def WEAVE_ERROR_CA_CERT_NOT_FOUND + * @def CHIP_ERROR_CA_CERT_NOT_FOUND * * @brief * CA certificate is not found. * */ -#define WEAVE_ERROR_CA_CERT_NOT_FOUND _WEAVE_ERROR(74) +#define CHIP_ERROR_CA_CERT_NOT_FOUND _CHIP_ERROR(74) /** - * @def WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED + * @def CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED * * @brief * A certificate path length exceeds the constraint. * */ -#define WEAVE_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED _WEAVE_ERROR(75) +#define CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED _CHIP_ERROR(75) /** - * @def WEAVE_ERROR_CERT_PATH_TOO_LONG + * @def CHIP_ERROR_CERT_PATH_TOO_LONG * * @brief * A certificate path is too long. * */ -#define WEAVE_ERROR_CERT_PATH_TOO_LONG _WEAVE_ERROR(76) +#define CHIP_ERROR_CERT_PATH_TOO_LONG _CHIP_ERROR(76) /** - * @def WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED + * @def CHIP_ERROR_CERT_USAGE_NOT_ALLOWED * * @brief * A requested certificate usage is not allowed. * */ -#define WEAVE_ERROR_CERT_USAGE_NOT_ALLOWED _WEAVE_ERROR(77) +#define CHIP_ERROR_CERT_USAGE_NOT_ALLOWED _CHIP_ERROR(77) /** - * @def WEAVE_ERROR_CERT_EXPIRED + * @def CHIP_ERROR_CERT_EXPIRED * * @brief * A certificate expired. * */ -#define WEAVE_ERROR_CERT_EXPIRED _WEAVE_ERROR(78) +#define CHIP_ERROR_CERT_EXPIRED _CHIP_ERROR(78) /** - * @def WEAVE_ERROR_CERT_NOT_VALID_YET + * @def CHIP_ERROR_CERT_NOT_VALID_YET * * @brief * A certificate is not valid yet. * */ -#define WEAVE_ERROR_CERT_NOT_VALID_YET _WEAVE_ERROR(79) +#define CHIP_ERROR_CERT_NOT_VALID_YET _CHIP_ERROR(79) /** - * @def WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT + * @def CHIP_ERROR_UNSUPPORTED_CERT_FORMAT * * @brief * A certificate format is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_CERT_FORMAT _WEAVE_ERROR(80) +#define CHIP_ERROR_UNSUPPORTED_CERT_FORMAT _CHIP_ERROR(80) /** - * @def WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE + * @def CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE * * @brief * An elliptic curve is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_ELLIPTIC_CURVE _WEAVE_ERROR(81) +#define CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE _CHIP_ERROR(81) /** - * @def WEAVE_CERT_NOT_USED + * @def CHIP_CERT_NOT_USED * * @brief * A certificate was not used during the chain validation. * */ -#define WEAVE_CERT_NOT_USED _WEAVE_ERROR(82) +#define CHIP_CERT_NOT_USED _CHIP_ERROR(82) /** - * @def WEAVE_ERROR_CERT_NOT_FOUND + * @def CHIP_ERROR_CERT_NOT_FOUND * * @brief * A certificate is not found. * */ -#define WEAVE_ERROR_CERT_NOT_FOUND _WEAVE_ERROR(83) +#define CHIP_ERROR_CERT_NOT_FOUND _CHIP_ERROR(83) /** - * @def WEAVE_ERROR_INVALID_CASE_PARAMETER + * @def CHIP_ERROR_INVALID_CASE_PARAMETER * * @brief * A CASE parameter is invalid. * */ -#define WEAVE_ERROR_INVALID_CASE_PARAMETER _WEAVE_ERROR(84) +#define CHIP_ERROR_INVALID_CASE_PARAMETER _CHIP_ERROR(84) /** - * @def WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION + * @def CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION * * @brief * A CASE configuration is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_CASE_CONFIGURATION _WEAVE_ERROR(85) +#define CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION _CHIP_ERROR(85) /** - * @def WEAVE_ERROR_CERT_LOAD_FAIL + * @def CHIP_ERROR_CERT_LOAD_FAIL * * @brief * A certificate load failed. * */ -#define WEAVE_ERROR_CERT_LOAD_FAIL _WEAVE_ERROR(86) +#define CHIP_ERROR_CERT_LOAD_FAIL _CHIP_ERROR(86) /** - * @def WEAVE_ERROR_CERT_NOT_TRUSTED + * @def CHIP_ERROR_CERT_NOT_TRUSTED * * @brief * A certificate is not trusted. * */ -#define WEAVE_ERROR_CERT_NOT_TRUSTED _WEAVE_ERROR(87) +#define CHIP_ERROR_CERT_NOT_TRUSTED _CHIP_ERROR(87) /** - * @def WEAVE_ERROR_INVALID_ACCESS_TOKEN + * @def CHIP_ERROR_INVALID_ACCESS_TOKEN * * @brief * An access token is invalid. * */ -#define WEAVE_ERROR_INVALID_ACCESS_TOKEN _WEAVE_ERROR(88) +#define CHIP_ERROR_INVALID_ACCESS_TOKEN _CHIP_ERROR(88) /** - * @def WEAVE_ERROR_WRONG_CERT_SUBJECT + * @def CHIP_ERROR_WRONG_CERT_SUBJECT * * @brief * A certificate subject is wrong. * */ -#define WEAVE_ERROR_WRONG_CERT_SUBJECT _WEAVE_ERROR(89) +#define CHIP_ERROR_WRONG_CERT_SUBJECT _CHIP_ERROR(89) // deprecated alias -#define WEAVE_ERROR_WRONG_CERTIFICATE_SUBJECT WEAVE_ERROR_WRONG_CERT_SUBJECT +#define CHIP_ERROR_WRONG_CERTIFICATE_SUBJECT CHIP_ERROR_WRONG_CERT_SUBJECT /** - * @def WEAVE_ERROR_INVALID_PROVISIONING_BUNDLE + * @def CHIP_ERROR_INVALID_PROVISIONING_BUNDLE * * @brief * A provisioning bundle is invalid. * */ -#define WEAVE_ERROR_INVALID_PROVISIONING_BUNDLE _WEAVE_ERROR(90) +#define CHIP_ERROR_INVALID_PROVISIONING_BUNDLE _CHIP_ERROR(90) /** - * @def WEAVE_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR + * @def CHIP_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR * * @brief * A provision bundle encountered a decryption error. * */ -#define WEAVE_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR _WEAVE_ERROR(91) +#define CHIP_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR _CHIP_ERROR(91) /** - * @def WEAVE_ERROR_WRONG_NODE_ID + * @def CHIP_ERROR_WRONG_NODE_ID * * @brief * A node id is wrong. * */ -#define WEAVE_ERROR_WRONG_NODE_ID _WEAVE_ERROR(92) +#define CHIP_ERROR_WRONG_NODE_ID _CHIP_ERROR(92) /** - * @def WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT + * @def CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT * * @brief * A connection is accepted on a wrong port. * */ -#define WEAVE_ERROR_CONN_ACCEPTED_ON_WRONG_PORT _WEAVE_ERROR(93) +#define CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT _CHIP_ERROR(93) /** - * @def WEAVE_ERROR_CALLBACK_REPLACED + * @def CHIP_ERROR_CALLBACK_REPLACED * * @brief * An application callback has been replaced. * */ -#define WEAVE_ERROR_CALLBACK_REPLACED _WEAVE_ERROR(94) +#define CHIP_ERROR_CALLBACK_REPLACED _CHIP_ERROR(94) /** - * @def WEAVE_ERROR_NO_CASE_AUTH_DELEGATE + * @def CHIP_ERROR_NO_CASE_AUTH_DELEGATE * * @brief * No CASE authentication delegate is set. * */ -#define WEAVE_ERROR_NO_CASE_AUTH_DELEGATE _WEAVE_ERROR(95) +#define CHIP_ERROR_NO_CASE_AUTH_DELEGATE _CHIP_ERROR(95) /** - * @def WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT + * @def CHIP_ERROR_DEVICE_LOCATE_TIMEOUT * * @brief * The attempt to locate device timed out. * */ -#define WEAVE_ERROR_DEVICE_LOCATE_TIMEOUT _WEAVE_ERROR(96) +#define CHIP_ERROR_DEVICE_LOCATE_TIMEOUT _CHIP_ERROR(96) /** - * @def WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT + * @def CHIP_ERROR_DEVICE_CONNECT_TIMEOUT * * @brief * The attempt to connect device timed out. * */ -#define WEAVE_ERROR_DEVICE_CONNECT_TIMEOUT _WEAVE_ERROR(97) +#define CHIP_ERROR_DEVICE_CONNECT_TIMEOUT _CHIP_ERROR(97) /** - * @def WEAVE_ERROR_DEVICE_AUTH_TIMEOUT + * @def CHIP_ERROR_DEVICE_AUTH_TIMEOUT * * @brief * The attempt to authenticate device timed out. * */ -#define WEAVE_ERROR_DEVICE_AUTH_TIMEOUT _WEAVE_ERROR(98) +#define CHIP_ERROR_DEVICE_AUTH_TIMEOUT _CHIP_ERROR(98) /** - * @def WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED + * @def CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED * * @brief * A message is not acknowledged after max retries. * */ -#define WEAVE_ERROR_MESSAGE_NOT_ACKNOWLEDGED _WEAVE_ERROR(99) +#define CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED _CHIP_ERROR(99) /** - * @def WEAVE_ERROR_RETRANS_TABLE_FULL + * @def CHIP_ERROR_RETRANS_TABLE_FULL * * @brief * A retransmission table is already full. * */ -#define WEAVE_ERROR_RETRANS_TABLE_FULL _WEAVE_ERROR(100) +#define CHIP_ERROR_RETRANS_TABLE_FULL _CHIP_ERROR(100) /** - * @def WEAVE_ERROR_INVALID_ACK_ID + * @def CHIP_ERROR_INVALID_ACK_ID * * @brief * An acknowledgment id is invalid. * */ -#define WEAVE_ERROR_INVALID_ACK_ID _WEAVE_ERROR(101) +#define CHIP_ERROR_INVALID_ACK_ID _CHIP_ERROR(101) /** - * @def WEAVE_ERROR_SEND_THROTTLED + * @def CHIP_ERROR_SEND_THROTTLED * * @brief * A send is throttled. * */ -#define WEAVE_ERROR_SEND_THROTTLED _WEAVE_ERROR(102) +#define CHIP_ERROR_SEND_THROTTLED _CHIP_ERROR(102) /** - * @def WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE + * @def CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE * * @brief * A message version is not supported by the current exchange context. * */ -#define WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE _WEAVE_ERROR(103) +#define CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE _CHIP_ERROR(103) /** - * @def WEAVE_ERROR_TRANSACTION_CANCELED + * @def CHIP_ERROR_TRANSACTION_CANCELED * * @brief * A transaction is cancelled. * */ -#define WEAVE_ERROR_TRANSACTION_CANCELED _WEAVE_ERROR(104) +#define CHIP_ERROR_TRANSACTION_CANCELED _CHIP_ERROR(104) /** - * @def WEAVE_ERROR_LISTENER_ALREADY_STARTED + * @def CHIP_ERROR_LISTENER_ALREADY_STARTED * * @brief * A listener has already started. * */ -#define WEAVE_ERROR_LISTENER_ALREADY_STARTED _WEAVE_ERROR(105) +#define CHIP_ERROR_LISTENER_ALREADY_STARTED _CHIP_ERROR(105) /** - * @def WEAVE_ERROR_LISTENER_ALREADY_STOPPED + * @def CHIP_ERROR_LISTENER_ALREADY_STOPPED * * @brief * A listener has already stopped. * */ -#define WEAVE_ERROR_LISTENER_ALREADY_STOPPED _WEAVE_ERROR(106) +#define CHIP_ERROR_LISTENER_ALREADY_STOPPED _CHIP_ERROR(106) /** - * @def WEAVE_ERROR_UNKNOWN_TOPIC + * @def CHIP_ERROR_UNKNOWN_TOPIC * * @brief * A topic ID was unknown to the recipient. * */ -#define WEAVE_ERROR_UNKNOWN_TOPIC _WEAVE_ERROR(107) +#define CHIP_ERROR_UNKNOWN_TOPIC _CHIP_ERROR(107) /** - * @def WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE + * @def CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE * * @brief - * A Weave feature is unsupported. + * A CHIP feature is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE _WEAVE_ERROR(108) +#define CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE _CHIP_ERROR(108) /** - * @def WEAVE_ERROR_PASE_RECONFIGURE_REQUIRED + * @def CHIP_ERROR_PASE_RECONFIGURE_REQUIRED * * @brief * PASE is required to reconfigure. * */ -#define WEAVE_ERROR_PASE_RECONFIGURE_REQUIRED _WEAVE_ERROR(109) +#define CHIP_ERROR_PASE_RECONFIGURE_REQUIRED _CHIP_ERROR(109) /** - * @def WEAVE_ERROR_INVALID_PASE_CONFIGURATION + * @def CHIP_ERROR_INVALID_PASE_CONFIGURATION * * @brief * A PASE configuration is invalid. * */ -#define WEAVE_ERROR_INVALID_PASE_CONFIGURATION _WEAVE_ERROR(110) +#define CHIP_ERROR_INVALID_PASE_CONFIGURATION _CHIP_ERROR(110) /** - * @def WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS + * @def CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS * * @brief * No PASE configuration is in common. * */ -#define WEAVE_ERROR_NO_COMMON_PASE_CONFIGURATIONS _WEAVE_ERROR(111) +#define CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS _CHIP_ERROR(111) /** - * @def WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR + * @def CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR * * @brief * An unsolicited message with the originator bit clear. * */ -#define WEAVE_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR _WEAVE_ERROR(112) +#define CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR _CHIP_ERROR(112) /** - * @def WEAVE_ERROR_INVALID_FABRIC_ID + * @def CHIP_ERROR_INVALID_FABRIC_ID * * @brief * A fabric id is invalid. * */ -#define WEAVE_ERROR_INVALID_FABRIC_ID _WEAVE_ERROR(113) +#define CHIP_ERROR_INVALID_FABRIC_ID _CHIP_ERROR(113) /** - * @def WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION + * @def CHIP_ERROR_UNSUPPORTED_TUNNEL_VERSION * * @brief * A tunnel version is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_TUNNEL_VERSION _WEAVE_ERROR(114) +#define CHIP_ERROR_UNSUPPORTED_TUNNEL_VERSION _CHIP_ERROR(114) /** - * @def WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL + * @def CHIP_ERROR_TUNNEL_NEXTHOP_TABLE_FULL * * @brief * A tunnel nexthop table is full. * */ -#define WEAVE_ERROR_TUNNEL_NEXTHOP_TABLE_FULL _WEAVE_ERROR(115) +#define CHIP_ERROR_TUNNEL_NEXTHOP_TABLE_FULL _CHIP_ERROR(115) /** - * @def WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL + * @def CHIP_ERROR_TUNNEL_SERVICE_QUEUE_FULL * * @brief * A tunnel service queue is full. * */ -#define WEAVE_ERROR_TUNNEL_SERVICE_QUEUE_FULL _WEAVE_ERROR(116) +#define CHIP_ERROR_TUNNEL_SERVICE_QUEUE_FULL _CHIP_ERROR(116) /** - * @def WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED + * @def CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED * * @brief * DRBG entropy source failed to generate entropy data. * */ -#define WEAVE_ERROR_DRBG_ENTROPY_SOURCE_FAILED _WEAVE_ERROR(117) +#define CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED _CHIP_ERROR(117) /** - * @def WEAVE_ERROR_TLV_TAG_NOT_FOUND + * @def CHIP_ERROR_TLV_TAG_NOT_FOUND * * @brief * A specified TLV tag was not found. * */ -#define WEAVE_ERROR_TLV_TAG_NOT_FOUND _WEAVE_ERROR(118) +#define CHIP_ERROR_TLV_TAG_NOT_FOUND _CHIP_ERROR(118) /** - * @def WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE + * @def CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE * * @brief * A token pairing bundle is invalid. * */ -#define WEAVE_ERROR_INVALID_TOKENPAIRINGBUNDLE _WEAVE_ERROR(119) +#define CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE _CHIP_ERROR(119) /** - * @def WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION + * @def CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION * * @brief * A token pairing bundle is invalid. * */ -#define WEAVE_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION _WEAVE_ERROR(120) +#define CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION _CHIP_ERROR(120) /** - * @def WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE + * @def CHIP_ERROR_NO_TAKE_AUTH_DELEGATE * * @brief * No TAKE authentication delegate is set. * */ -#define WEAVE_ERROR_NO_TAKE_AUTH_DELEGATE _WEAVE_ERROR(121) +#define CHIP_ERROR_NO_TAKE_AUTH_DELEGATE _CHIP_ERROR(121) /** - * @def WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED + * @def CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED * * @brief * TAKE requires a reconfigure. * */ -#define WEAVE_ERROR_TAKE_RECONFIGURE_REQUIRED _WEAVE_ERROR(122) +#define CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED _CHIP_ERROR(122) /** - * @def WEAVE_ERROR_TAKE_REAUTH_POSSIBLE + * @def CHIP_ERROR_TAKE_REAUTH_POSSIBLE * * @brief * TAKE can do a reauthentication. * */ -#define WEAVE_ERROR_TAKE_REAUTH_POSSIBLE _WEAVE_ERROR(123) +#define CHIP_ERROR_TAKE_REAUTH_POSSIBLE _CHIP_ERROR(123) /** - * @def WEAVE_ERROR_INVALID_TAKE_PARAMETER + * @def CHIP_ERROR_INVALID_TAKE_PARAMETER * * @brief * Received an invalid TAKE paramter. * */ -#define WEAVE_ERROR_INVALID_TAKE_PARAMETER _WEAVE_ERROR(124) +#define CHIP_ERROR_INVALID_TAKE_PARAMETER _CHIP_ERROR(124) /** - * @def WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION + * @def CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION * * @brief * This configuration is not supported by TAKE. * */ -#define WEAVE_ERROR_UNSUPPORTED_TAKE_CONFIGURATION _WEAVE_ERROR(125) +#define CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION _CHIP_ERROR(125) /** - * @def WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED + * @def CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED * * @brief * The TAKE Token Identification failed. * */ -#define WEAVE_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED _WEAVE_ERROR(126) +#define CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED _CHIP_ERROR(126) /** - * @def WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER + * @def CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER * * @brief * The encryption key is not found error received from a peer node. * */ -#define WEAVE_ERROR_KEY_NOT_FOUND_FROM_PEER _WEAVE_ERROR(127) +#define CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER _CHIP_ERROR(127) /** - * @def WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER + * @def CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER * * @brief * The wrong encryption type error received from a peer node. * */ -#define WEAVE_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER _WEAVE_ERROR(128) +#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER _CHIP_ERROR(128) /** - * @def WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER + * @def CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER * * @brief * The unknown key type error received from a peer node. * */ -#define WEAVE_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER _WEAVE_ERROR(129) +#define CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER _CHIP_ERROR(129) /** - * @def WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER + * @def CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER * * @brief * The invalid use of session key error received from a peer node. * */ -#define WEAVE_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER _WEAVE_ERROR(130) +#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER _CHIP_ERROR(130) /** - * @def WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER + * @def CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER * * @brief * An unsupported encryption type error received from a peer node. * */ -#define WEAVE_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER _WEAVE_ERROR(131) +#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER _CHIP_ERROR(131) /** - * @def WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER + * @def CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER * * @brief * The internal key error received from a peer node. * */ -#define WEAVE_ERROR_INTERNAL_KEY_ERROR_FROM_PEER _WEAVE_ERROR(132) +#define CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER _CHIP_ERROR(132) /** - * @def WEAVE_ERROR_INVALID_KEY_ID + * @def CHIP_ERROR_INVALID_KEY_ID * * @brief * A key id is invalid. * */ -#define WEAVE_ERROR_INVALID_KEY_ID _WEAVE_ERROR(133) +#define CHIP_ERROR_INVALID_KEY_ID _CHIP_ERROR(133) /** - * @def WEAVE_ERROR_INVALID_TIME + * @def CHIP_ERROR_INVALID_TIME * * @brief * Time has invalid value. * */ -#define WEAVE_ERROR_INVALID_TIME _WEAVE_ERROR(134) +#define CHIP_ERROR_INVALID_TIME _CHIP_ERROR(134) /** - * @def WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND + * @def CHIP_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND * * @brief * A tunnel shortcut peer entry not found in the cache. * */ -#define WEAVE_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND _WEAVE_ERROR(135) +#define CHIP_ERROR_TUNNEL_PEER_ENTRY_NOT_FOUND _CHIP_ERROR(135) /** - * @def WEAVE_ERROR_LOCKING_FAILURE + * @def CHIP_ERROR_LOCKING_FAILURE * * @brief * Failure to acquire or release an OS provided mutex. * */ -#define WEAVE_ERROR_LOCKING_FAILURE _WEAVE_ERROR(136) +#define CHIP_ERROR_LOCKING_FAILURE _CHIP_ERROR(136) /** - * @def WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG + * @def CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG * * @brief * A passcode encryption configuration is unsupported. * */ -#define WEAVE_ERROR_UNSUPPORTED_PASSCODE_CONFIG _WEAVE_ERROR(137) +#define CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG _CHIP_ERROR(137) /** - * @def WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED + * @def CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED * * @brief - * The Weave passcode authentication failed. + * The CHIP passcode authentication failed. * */ -#define WEAVE_ERROR_PASSCODE_AUTHENTICATION_FAILED _WEAVE_ERROR(138) +#define CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED _CHIP_ERROR(138) /** - * @def WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED + * @def CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED * * @brief - * The Weave passcode fingerprint failed. + * The CHIP passcode fingerprint failed. * */ -#define WEAVE_ERROR_PASSCODE_FINGERPRINT_FAILED _WEAVE_ERROR(139) +#define CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED _CHIP_ERROR(139) /** - * @def WEAVE_ERROR_TUNNEL_FORCE_ABORT + * @def CHIP_ERROR_TUNNEL_FORCE_ABORT * * @brief - * The Weave error code to be used with the API for stopping + * The CHIP error code to be used with the API for stopping * the tunnel to enforce it to abort its TCP connection and return * synchronously to the caller. * */ -#define WEAVE_ERROR_TUNNEL_FORCE_ABORT _WEAVE_ERROR(140) +#define CHIP_ERROR_TUNNEL_FORCE_ABORT _CHIP_ERROR(140) /** - * @def WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL + * @def CHIP_ERROR_SERIALIZATION_ELEMENT_NULL * * @brief * The element of the struct is null. * */ -#define WEAVE_ERROR_SERIALIZATION_ELEMENT_NULL _WEAVE_ERROR(141) +#define CHIP_ERROR_SERIALIZATION_ELEMENT_NULL _CHIP_ERROR(141) /** - * @def WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM + * @def CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM * * @brief * The certificate was not signed using the required signature algorithm. * */ -#define WEAVE_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM _WEAVE_ERROR(142) +#define CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM _CHIP_ERROR(142) /** - * @def WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM + * @def CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM * * @brief - * The Weave signature was not signed using the required signature algorithm. + * The CHIP signature was not signed using the required signature algorithm. * */ -#define WEAVE_ERROR_WRONG_WEAVE_SIGNATURE_ALGORITHM _WEAVE_ERROR(143) +#define CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM _CHIP_ERROR(143) /** - * @def WEAVE_ERROR_WDM_SCHEMA_MISMATCH + * @def CHIP_ERROR_WDM_SCHEMA_MISMATCH * * @brief * A mismatch in schema was encountered. * */ -#define WEAVE_ERROR_WDM_SCHEMA_MISMATCH _WEAVE_ERROR(144) +#define CHIP_ERROR_WDM_SCHEMA_MISMATCH _CHIP_ERROR(144) /** - * @def WEAVE_ERROR_INVALID_INTEGER_VALUE + * @def CHIP_ERROR_INVALID_INTEGER_VALUE * * @brief * An integer does not have the kind of value we expect. * */ -#define WEAVE_ERROR_INVALID_INTEGER_VALUE _WEAVE_ERROR(145) +#define CHIP_ERROR_INVALID_INTEGER_VALUE _CHIP_ERROR(145) /** - * @def WEAVE_ERROR_CASE_RECONFIG_REQUIRED + * @def CHIP_ERROR_CASE_RECONFIG_REQUIRED * * @brief * CASE is required to reconfigure. * */ -#define WEAVE_ERROR_CASE_RECONFIG_REQUIRED _WEAVE_ERROR(146) +#define CHIP_ERROR_CASE_RECONFIG_REQUIRED _CHIP_ERROR(146) /** - * @def WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS + * @def CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS * * @brief * Too many CASE reconfigurations were received. * */ -#define WEAVE_ERROR_TOO_MANY_CASE_RECONFIGURATIONS _WEAVE_ERROR(147) +#define CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS _CHIP_ERROR(147) /** - * @def WEAVE_ERROR_BAD_REQUEST + * @def CHIP_ERROR_BAD_REQUEST * * @brief * The request cannot be processed or fulfilled * */ -#define WEAVE_ERROR_BAD_REQUEST _WEAVE_ERROR(148) +#define CHIP_ERROR_BAD_REQUEST _CHIP_ERROR(148) /** - * @def WEAVE_ERROR_INVALID_MESSAGE_FLAG + * @def CHIP_ERROR_INVALID_MESSAGE_FLAG * * @brief * One or more message flags have invalid value. * */ -#define WEAVE_ERROR_INVALID_MESSAGE_FLAG _WEAVE_ERROR(149) +#define CHIP_ERROR_INVALID_MESSAGE_FLAG _CHIP_ERROR(149) /** - * @def WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED + * @def CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED * * @brief * Key export protocol required to reconfigure. * */ -#define WEAVE_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED _WEAVE_ERROR(150) +#define CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED _CHIP_ERROR(150) /** - * @def WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION + * @def CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION * * @brief * A key export protocol configuration is invalid. * */ -#define WEAVE_ERROR_INVALID_KEY_EXPORT_CONFIGURATION _WEAVE_ERROR(151) +#define CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION _CHIP_ERROR(151) /** - * @def WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS + * @def CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS * * @brief * No key export protocol configuration is in common. * */ -#define WEAVE_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS _WEAVE_ERROR(152) +#define CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS _CHIP_ERROR(152) /** - * @def WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE + * @def CHIP_ERROR_NO_KEY_EXPORT_DELEGATE * * @brief * No key export delegate is set. * */ -#define WEAVE_ERROR_NO_KEY_EXPORT_DELEGATE _WEAVE_ERROR(153) +#define CHIP_ERROR_NO_KEY_EXPORT_DELEGATE _CHIP_ERROR(153) /** - * @def WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST + * @def CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST * * @brief * Unauthorized key export request. * */ -#define WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST _WEAVE_ERROR(154) +#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST _CHIP_ERROR(154) /** - * @def WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE + * @def CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE * * @brief * Unauthorized key export response. * */ -#define WEAVE_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE _WEAVE_ERROR(155) +#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE _CHIP_ERROR(155) /** - * @def WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED + * @def CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED * * @brief - * The Weave exported encrypted key authentication failed. + * The CHIP exported encrypted key authentication failed. * */ -#define WEAVE_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED _WEAVE_ERROR(156) +#define CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED _CHIP_ERROR(156) /** - * @def WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES + * @def CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES * * @brief * The number of shared secure sessions end nodes exceeds * the maximum limit. * */ -#define WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES _WEAVE_ERROR(157) +#define CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES _CHIP_ERROR(157) /** - * @def WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT + * @def CHIP_ERROR_WDM_MALFORMED_DATA_ELEMENT * * @brief * The WDM DataElement is malformed: it either does not contain * the required elements, or it contais both the MergeData element * and DeletedDictionaryKeyList. */ -#define WEAVE_ERROR_WDM_MALFORMED_DATA_ELEMENT _WEAVE_ERROR(158) +#define CHIP_ERROR_WDM_MALFORMED_DATA_ELEMENT _CHIP_ERROR(158) /** - * @def WEAVE_ERROR_WRONG_CERT_TYPE + * @def CHIP_ERROR_WRONG_CERT_TYPE * * @brief * The presented certificate was of the wrong type. */ -#define WEAVE_ERROR_WRONG_CERT_TYPE _WEAVE_ERROR(159) +#define CHIP_ERROR_WRONG_CERT_TYPE _CHIP_ERROR(159) /** - * @def WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED + * @def CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED * * @brief * The application's event handler failed to call the default event handler function * when presented with an unknown event. */ -#define WEAVE_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED _WEAVE_ERROR(162) +#define CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED _CHIP_ERROR(162) /** - * @def WEAVE_ERROR_PERSISTED_STORAGE_FAIL + * @def CHIP_ERROR_PERSISTED_STORAGE_FAIL * * @brief * Persisted storage memory read/write failure. * */ -#define WEAVE_ERROR_PERSISTED_STORAGE_FAIL _WEAVE_ERROR(163) +#define CHIP_ERROR_PERSISTED_STORAGE_FAIL _CHIP_ERROR(163) /** - * @def WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND + * @def CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND * * @brief * The specific value is not found in the persisted storage. * */ -#define WEAVE_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND _WEAVE_ERROR(164) +#define CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND _CHIP_ERROR(164) /** - * @def WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED + * @def CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED * * @brief * The specified profile string support context is already registered. * */ -#define WEAVE_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED _WEAVE_ERROR(165) +#define CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED _CHIP_ERROR(165) /** - * @def WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED + * @def CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED * * @brief * The specified profile string support context is not registered. * */ -#define WEAVE_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED _WEAVE_ERROR(166) +#define CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED _CHIP_ERROR(166) /** - * @def WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION + * @def CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION * * @brief * Encountered a mismatch in compatibility w.r.t to IDL schema version */ -#define WEAVE_ERROR_INCOMPATIBLE_SCHEMA_VERSION _WEAVE_ERROR(167) +#define CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION _CHIP_ERROR(167) /** - * @def WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED + * @def CHIP_ERROR_TUNNEL_ROUTING_RESTRICTED * * @brief * Indicates that the Tunnel can only be used by the border gateway * for itself and, it cannot forward packets for any other device. * */ -#define WEAVE_ERROR_TUNNEL_ROUTING_RESTRICTED _WEAVE_ERROR(168) +#define CHIP_ERROR_TUNNEL_ROUTING_RESTRICTED _CHIP_ERROR(168) /** - * @def WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED + * @def CHIP_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED * * @brief * The Tunnel reset reconnect timer is already armed */ -#define WEAVE_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED _WEAVE_ERROR(169) +#define CHIP_ERROR_TUNNEL_RESET_RECONNECT_ALREADY_ARMED _CHIP_ERROR(169) /** - * @def WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION + * @def CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION * * @brief * Encountered a mismatch between wdm update required version and current version */ -#define WEAVE_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION _WEAVE_ERROR(170) +#define CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION _CHIP_ERROR(170) /** - * @def WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT + * @def CHIP_ERROR_WDM_MALFORMED_STATUS_ELEMENT * * @brief * The WDM StatusElement is malformed: it does not contain * either the profile id or the status code. */ -#define WEAVE_ERROR_WDM_MALFORMED_STATUS_ELEMENT _WEAVE_ERROR(171) +#define CHIP_ERROR_WDM_MALFORMED_STATUS_ELEMENT _CHIP_ERROR(171) /** - * @def WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL + * @def CHIP_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL * * @brief * The WDM Subscriptionless Notify is partial. */ -#define WEAVE_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL _WEAVE_ERROR(172) +#define CHIP_ERROR_WDM_SUBSCRIPTIONLESS_NOTIFY_PARTIAL _CHIP_ERROR(172) /** - * @def WEAVE_ERROR_ACCESS_DENIED + * @def CHIP_ERROR_ACCESS_DENIED * * @brief - * The Weave message is not granted access for further processing. + * The CHIP message is not granted access for further processing. */ -#define WEAVE_ERROR_ACCESS_DENIED _WEAVE_ERROR(173) +#define CHIP_ERROR_ACCESS_DENIED _CHIP_ERROR(173) /** - * @def WEAVE_ERROR_UNKNOWN_RESOURCE_ID + * @def CHIP_ERROR_UNKNOWN_RESOURCE_ID * * @brief * Unknown resource ID * */ -#define WEAVE_ERROR_UNKNOWN_RESOURCE_ID _WEAVE_ERROR(174) +#define CHIP_ERROR_UNKNOWN_RESOURCE_ID _CHIP_ERROR(174) /** - * @def WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE + * @def CHIP_ERROR_WDM_MALFORMED_UPDATE_RESPONSE * * @brief * The WDM UpdateResponse payload is malformed: it does not contain * either the StatusList or the VersionList. */ -#define WEAVE_ERROR_WDM_MALFORMED_UPDATE_RESPONSE _WEAVE_ERROR(175) +#define CHIP_ERROR_WDM_MALFORMED_UPDATE_RESPONSE _CHIP_ERROR(175) /** - * @def WEAVE_ERROR_WDM_VERSION_MISMATCH + * @def CHIP_ERROR_WDM_VERSION_MISMATCH * * @brief * The conditional update of a trait instance path has failed * because the local changes are based on an obsolete version of the * data. */ -#define WEAVE_ERROR_WDM_VERSION_MISMATCH _WEAVE_ERROR(176) +#define CHIP_ERROR_WDM_VERSION_MISMATCH _CHIP_ERROR(176) /** - * @def WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS + * @def CHIP_ERROR_WDM_POTENTIAL_DATA_LOSS * * @brief * A potential data loss was detected for a Trait Instance. */ -#define WEAVE_ERROR_WDM_POTENTIAL_DATA_LOSS _WEAVE_ERROR(177) +#define CHIP_ERROR_WDM_POTENTIAL_DATA_LOSS _CHIP_ERROR(177) /** - * @def WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE + * @def CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE * * @brief * Device doesn't support standalone Thread network creation. - * On some legacy Nest devices new Thread network can only be created - * together with Weave Fabric using CrateFabric() message. + * On some legacy devices new Thread network can only be created + * together with CHIP Fabric using CrateFabric() message. * */ -#define WEAVE_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE _WEAVE_ERROR(178) +#define CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE _CHIP_ERROR(178) /** - * @def WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY + * @def CHIP_ERROR_WDM_INCONSISTENT_CONDITIONALITY * * @brief * A TraitPath was declared updated with a conditionality that @@ -1701,50 +1700,48 @@ typedef WEAVE_CONFIG_ERROR_TYPE WEAVE_ERROR; * same Trait Instance. * */ -#define WEAVE_ERROR_WDM_INCONSISTENT_CONDITIONALITY _WEAVE_ERROR(179) +#define CHIP_ERROR_WDM_INCONSISTENT_CONDITIONALITY _CHIP_ERROR(179) /** - * @def WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT + * @def CHIP_ERROR_WDM_LOCAL_DATA_INCONSISTENT * * @brief * The local data does not match any known version of the * Trait Instance and cannot support the operation requested. * */ -#define WEAVE_ERROR_WDM_LOCAL_DATA_INCONSISTENT _WEAVE_ERROR(180) +#define CHIP_ERROR_WDM_LOCAL_DATA_INCONSISTENT _CHIP_ERROR(180) /** - * @def WEAVE_ERROR_WDM_PATH_STORE_FULL + * @def CHIP_ERROR_WDM_PATH_STORE_FULL * * @brief * WDM cannot store a TraitPath for lack of memory. * */ -#define WEAVE_ERROR_WDM_PATH_STORE_FULL _WEAVE_ERROR(181) +#define CHIP_ERROR_WDM_PATH_STORE_FULL _CHIP_ERROR(181) /** - * @def WEAVE_EVENT_ID_FOUND + * @def CHIP_EVENT_ID_FOUND * * @brief * Event ID matching the criteria was found */ -#define WEAVE_EVENT_ID_FOUND _WEAVE_ERROR(182) +#define CHIP_EVENT_ID_FOUND _CHIP_ERROR(182) /** * @} */ -// !!!!! IMPORTANT !!!!! If you add new Weave errors, please update the translation -// of error codes to strings in WeaveError.cpp, and add them to unittest +// !!!!! IMPORTANT !!!!! If you add new CHIP errors, please update the translation +// of error codes to strings in CHIPError.cpp, and add them to unittest // in test-apps/TestErrorStr.cpp // clang-format on -namespace nl { -namespace Weave { +namespace chip { -extern bool FormatWeaveError(char * buf, uint16_t bufSize, int32_t err); +extern bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err); -} // namespace Weave -} // namespace nl +} // namespace chip -#endif // WEAVE_ERROR_H +#endif // CHIP_ERROR_H diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h index b6c5d69ee36ec4..005dc052fdc1d1 100644 --- a/src/lib/support/CodeUtils.h +++ b/src/lib/support/CodeUtils.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2013-2017 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. @@ -27,47 +26,47 @@ #ifndef CODEUTILS_H_ #define CODEUTILS_H_ -#include -#include -#include +#include "core/CHIPError.h" +#include "support/ErrorStr.h" +#include "support/logging/CHIPLogging.h" /** - * @name Weave-specific nlassert.h Overrides + * @name chip-specific nlassert.h Overrides * * @{ * */ /** - * @def NL_ASSERT_ABORT() + * @def CHIP_ASSERT_ABORT() * * @brief - * This implements a Weave-specific override for #NL_ASSERT_ABORT * + * This implements a chip-specific override for #CHIP_ASSERT_ABORT * * from nlassert.h. * */ -#if !defined(NL_ASSERT_ABORT) -#define NL_ASSERT_ABORT() \ - WeaveDie() +#if !defined(CHIP_ASSERT_ABORT) +#define CHIP_ASSERT_ABORT() \ + chipDie() #endif /** - * @def NL_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) + * @def CHIP_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) * * @brief - * This implements a Weave-specific override for \c NL_ASSERT_LOG + * This implements a chip-specific override for \c CHIP_ASSERT_LOG * from nlassert.h. * * @param[in] aPrefix A pointer to a NULL-terminated C string printed * at the beginning of the logged assertion * message. Typically this is and should be - * \c NL_ASSERT_PREFIX_STRING. + * \c CHIP_ASSERT_PREFIX_STRING. * @param[in] aName A pointer to a NULL-terminated C string printed * following @a aPrefix that indicates what * module, program, application or subsystem * the assertion occurred in Typically this * is and should be - * \c NL_ASSERT_COMPONENT_STRING. + * \c CHIP_ASSERT_COMPONENT_STRING. * @param[in] aCondition A pointer to a NULL-terminated C string indicating * the expression that evaluated to false in * the assertion. Typically this is a @@ -91,12 +90,12 @@ * further describing the assertion failure. * */ -#if !defined(NL_ASSERT_LOG) -#define NL_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) \ +#if !defined(CHIP_ASSERT_LOG) +#define CHIP_ASSERT_LOG(aPrefix, aName, aCondition, aLabel, aFile, aLine, aMessage) \ do \ { \ - WeaveLogError(NotSpecified, \ - NL_ASSERT_LOG_FORMAT_DEFAULT, \ + chipLogError(NotSpecified, \ + CHIP_ASSERT_LOG_FORMAT_DEFAULT, \ aPrefix, \ (((aName) == 0) || (*(aName) == '\0')) ? "" : aName, \ (((aName) == 0) || (*(aName) == '\0')) ? "" : ": ", \ @@ -109,14 +108,13 @@ #endif /** - * @} Weave-specific nlassert.h Overrides + * @} chip-specific nlassert.h Overrides * */ #include -namespace nl { -namespace Weave { +namespace chip { // Generic min() and max() functions // @@ -140,8 +138,7 @@ max(const _T &a, const _T &b) return a; } -} // namespace Weave -} // namespace nl +} // namespace chip /** * @def IgnoreUnusedVariable(aVariable) @@ -166,15 +163,15 @@ max(const _T &a, const _T &b) * * @brief * This checks for the specified status, which is expected to - * commonly be successful (WEAVE_NO_ERROR), and branches to + * commonly be successful (CHIP_NO_ERROR), and branches to * the local label 'exit' if the status is unsuccessful. * * Example Usage: * * @code - * WEAVE_ERROR TryHard() + * CHIP_ERROR TryHard() * { - * WEAVE_ERROR err; + * CHIP_ERROR err; * * err = TrySomething(); * SuccessOrExit(err); @@ -191,7 +188,7 @@ max(const _T &a, const _T &b) * */ #define SuccessOrExit(aStatus) \ - nlEXPECT((aStatus) == WEAVE_NO_ERROR, exit) + nlEXPECT((aStatus) == CHIP_NO_ERROR, exit) /** * @def VerifyOrExit(aCondition, anAction) @@ -204,12 +201,12 @@ max(const _T &a, const _T &b) * Example Usage: * * @code - * WEAVE_ERROR MakeBuffer(const uint8_t *& buf) + * CHIP_ERROR MakeBuffer(const uint8_t *& buf) * { - * WEAVE_ERROR err = WEAVE_NO_ERROR; + * CHIP_ERROR err = CHIP_NO_ERROR; * * buf = (uint8_t *)malloc(1024); - * VerifyOrExit(buf != NULL, err = WEAVE_ERROR_NO_MEMORY); + * VerifyOrExit(buf != NULL, err = CHIP_ERROR_NO_MEMORY); * * memset(buf, 0, 1024); * @@ -240,15 +237,15 @@ max(const _T &a, const _T &b) * Example Usage: * * @code - * WEAVE_ERROR ReadAll(Reader& reader) + * CHIP_ERROR ReadAll(Reader& reader) * { - * WEAVE_ERROR err; + * CHIP_ERROR err; * * while (true) * { * err = reader.ReadNext(); - * if (err == WEAVE_ERROR_AT_END) - * ExitNow(err = WEAVE_NO_ERROR); + * if (err == CHIP_ERROR_AT_END) + * ExitNow(err = CHIP_NO_ERROR); * SuccessOrExit(err); * DoSomething(); * } @@ -273,30 +270,30 @@ max(const _T &a, const _T &b) * This is invoked when a #VerifyOrDie or #VerifyOrDieWithMsg * assertion expression evaluates to false. * - * Developers may override and customize this by defining #WeaveDie + * Developers may override and customize this by defining #chipDie * before CodeUtils.h is included by the preprocessor. * * Example Usage: * * @code - * WeaveDie(); + * chipDie(); * @endcode * */ -#ifndef WeaveDie -extern "C" void WeaveDie(void) __attribute((noreturn)); +#ifndef chipDie +extern "C" void chipDie(void) __attribute((noreturn)); -inline void WeaveDie(void) +inline void chipDie(void) { - WeaveLogError(NotSpecified, "WeaveDie WeaveDie WeaveDie"); + chipLogError(NotSpecified, "chipDie chipDie chipDie"); while (true) { - // NL_ASSERT_ABORT is redefined to be WeaveDie, so not useful here. + // CHIP_ASSERT_ABORT is redefined to be chipDie, so not useful here. abort(); } } -#endif // WeaveDie +#endif // chipDie /** * @def VerifyOrDie(aCondition) @@ -319,7 +316,7 @@ inline void WeaveDie(void) * @param[in] aCondition A Boolean expression to be evaluated. * * @sa #VerifyOrDieWithMsg - * @sa #WeaveDie + * @sa #chipDie * */ #define VerifyOrDie(aCondition) \ @@ -344,7 +341,7 @@ inline void WeaveDie(void) * @endcode * * @param[in] aCondition A Boolean expression to be evaluated. - * @param[in] aModule A Weave LogModule short-hand mnemonic identifing + * @param[in] aModule A chip LogModule short-hand mnemonic identifing * the logical section of code that is a * source the logged message. * @param[in] aMessage A pointer to a NULL-terminated C string with @@ -356,11 +353,11 @@ inline void WeaveDie(void) * aMessage. * * @sa #VerifyOrDie - * @sa #WeaveDie + * @sa #chipDie * */ #define VerifyOrDieWithMsg(aCondition, aModule, aMessage, ...) \ - nlABORT_ACTION(aCondition, WeaveLogDetail(aModule, aMessage, ## __VA_ARGS__)) + nlABORT_ACTION(aCondition, chipLogDetail(aModule, aMessage, ## __VA_ARGS__)) /** * @def ArraySize(aArray) diff --git a/src/lib/support/logging/CHIPLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp index bfb4a8f47e8416..5f589d94d6f732 100644 --- a/src/lib/support/logging/CHIPLogging.cpp +++ b/src/lib/support/logging/CHIPLogging.cpp @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2013-2017 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. @@ -19,7 +18,7 @@ /** * @file * This file implements macros, constants, and interfaces for a - * platform-independent logging interface for the Weave SDK. + * platform-independent logging interface for the chip SDK. * */ @@ -27,32 +26,31 @@ #include #include -#include -#include -#include -#include "WeaveLogging.h" +#include "Support/DLLUtil.h" +#include "core/CHIPCore.h" +#include "support/CodeUtils.h" +#include "CHIPLogging.h" -#if WEAVE_LOGGING_STYLE_ANDROID && defined(__ANDROID__) +#if CHIP_LOGGING_STYLE_ANDROID && defined(__ANDROID__) #include #endif -#if HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#if HAVE_SYS_TIME_H && CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS #include -#endif // HAVE_SYS_TIME_H && WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#endif // HAVE_SYS_TIME_H && CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS -namespace nl { -namespace Weave { +namespace chip { namespace Logging { -#if _WEAVE_USE_LOGGING +#if _CHIP_USE_LOGGING /* - * Array of strings containing the names for each of the Weave log + * Array of strings containing the names for each of the chip log * modules. * * NOTE: The names must be in the order defined in the LogModule * enumeration. Each name must be a fixed number of characters - * long (nlWeaveLoggingModuleNameLen) padded with nulls as + * long (chipLoggingModuleNameLen) padded with nulls as * necessary. * */ @@ -81,41 +79,41 @@ static const char ModuleNames[] = "TP\0" // TokenPairing "HL\0" // HeatLink "TS\0" // TimeServices - "WT\0" // WeaveTunnel + "WT\0" // chipTunnel "HB\0" // Heartbeat - "WSL" // WeaveSystemLayer + "WSL" // chipSystemLayer "DLP" // DropcamLegacyPairing "EVL" // Event Logging "SPT" // Support ; -#define ModuleNamesCount ((sizeof(ModuleNames) - 1) / nlWeaveLoggingModuleNameLen) +#define ModuleNamesCount ((sizeof(ModuleNames) - 1) / chipLoggingModuleNameLen) -#define WeavePrefix "WEAVE:" -#define WeavePrefixSeparator ": " -#define WeaveMessageTrailer "\n" +#define chipPrefix "CHIP:" +#define chipPrefixSeparator ": " +#define chipMessageTrailer "\n" void GetModuleName(char *buf, uint8_t module) { - const char *moduleNamePtr = ModuleNames + ((module < ModuleNamesCount) ? module * nlWeaveLoggingModuleNameLen : 0); - memcpy(buf, moduleNamePtr, nlWeaveLoggingModuleNameLen); - buf[nlWeaveLoggingModuleNameLen] = 0; + const char *moduleNamePtr = ModuleNames + ((module < ModuleNamesCount) ? module * chipLoggingModuleNameLen : 0); + memcpy(buf, moduleNamePtr, chipLoggingModuleNameLen); + buf[chipLoggingModuleNameLen] = 0; } void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg) { - char moduleName[nlWeaveLoggingModuleNameLen + 1]; + char moduleName[chipLoggingModuleNameLen + 1]; GetModuleName(moduleName, module); - snprintf(buf, bufSize, WeavePrefix "%s" WeavePrefixSeparator "%s" WeaveMessageTrailer, moduleName, msg); + snprintf(buf, bufSize, chipPrefix "%s" chipPrefixSeparator "%s" chipMessageTrailer, moduleName, msg); } void PrintMessagePrefix(uint8_t module) { - char moduleName[nlWeaveLoggingModuleNameLen + 1]; + char moduleName[chipLoggingModuleNameLen + 1]; GetModuleName(moduleName, module); -#if WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#if CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS struct timeval tv; struct tm* time_ptr; char detailed_time[30]; @@ -132,35 +130,35 @@ void PrintMessagePrefix(uint8_t module) VerifyOrExit(status >= 0, perror("strftime")); milliseconds = tv.tv_usec / 1000; - printf("%s.%03ld " WeavePrefix "%s: ", detailed_time, milliseconds, moduleName); + printf("%s.%03ld " chipPrefix "%s: ", detailed_time, milliseconds, moduleName); exit: if (status < 0) { - printf("\?\?\?\?-\?\?-\?\? \?\?:\?\?:\?\?.\?\?\?+\?\?\?\?" WeavePrefix "%s: ", moduleName); + printf("\?\?\?\?-\?\?-\?\? \?\?:\?\?:\?\?.\?\?\?+\?\?\?\?" chipPrefix "%s: ", moduleName); } -#else // !WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#else // !CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS - printf(WeavePrefix "%s: ", moduleName); + printf(chipPrefix "%s: ", moduleName); -#endif // WEAVE_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS +#endif // CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS } -#if WEAVE_LOG_FILTERING +#if CHIP_LOG_FILTERING uint8_t gLogFilter = kLogCategory_Max; -#endif // WEAVE_LOG_FILTERING +#endif // CHIP_LOG_FILTERING -#if !WEAVE_LOGGING_STYLE_EXTERNAL +#if !CHIP_LOGGING_STYLE_EXTERNAL /* * Only enable an in-package implementation of the logging interface * if external logging was not requested. Within that, the package * supports either Android-style or C Standard I/O-style logging. * * In the event a "weak" variant is specified, i.e - * WEAVE_LOGGING_STYLE_STDIO_WEAK, the in-package implementation will + * CHIP_LOGGING_STYLE_STDIO_WEAK, the in-package implementation will * be provided but with "weak" linkage */ @@ -170,14 +168,14 @@ uint8_t gLogFilter = kLogCategory_Max; * provided category, @a category. * * @param[in] module A LogModule enumeration indicating the - * source of the Weave package module that + * source of the chip package module that * generated the log message. This must be * translated within the function to a module * name for inclusion in the log message. * @param[in] category A LogCategory enumeration indicating the * category of the log message. The category * may be filtered in or out if - * WEAVE_LOG_FILTERING was asserted. + * CHIP_LOG_FILTERING was asserted. * @param[in] msg A pointer to a NULL-terminated C string with * C Standard Library-style format specifiers * containing the log message to be formatted and @@ -187,13 +185,13 @@ uint8_t gLogFilter = kLogCategory_Max; * */ -#if WEAVE_LOGGING_STYLE_STDIO_WEAK -#define __WEAVE_LOGGING_LINK_ATTRIBUTE __attribute__((weak)) +#if CHIP_LOGGING_STYLE_STDIO_WEAK +#define __CHIP_LOGGING_LINK_ATTRIBUTE __attribute__((weak)) #else -#define __WEAVE_LOGGING_LINK_ATTRIBUTE +#define __CHIP_LOGGING_LINK_ATTRIBUTE #endif -NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...) +CHIP_DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...) { va_list v; @@ -202,16 +200,16 @@ NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t ca if (IsCategoryEnabled(category)) { -#if WEAVE_LOGGING_STYLE_ANDROID +#if CHIP_LOGGING_STYLE_ANDROID - char moduleName[nlWeaveLoggingModuleNameLen + 1]; + char moduleName[chipLoggingModuleNameLen + 1]; GetModuleName(moduleName, module); int priority = (category == kLogCategory_Error) ? ANDROID_LOG_ERROR : ANDROID_LOG_DEBUG; __android_log_vprint(priority, moduleName, msg, v); -#elif WEAVE_LOGGING_STYLE_STDIO || WEAVE_LOGGING_STYLE_STDIO_WEAK +#elif CHIP_LOGGING_STYLE_STDIO || CHIP_LOGGING_STYLE_STDIO_WEAK PrintMessagePrefix(module); vprintf(msg, v); @@ -219,34 +217,33 @@ NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t ca #else -#error "Undefined platform-specific implementation for non-externnal Weave logging style!" +#error "Undefined platform-specific implementation for non-externnal chip logging style!" -#endif /* WEAVE_LOGGING_STYLE_ANDROID */ +#endif /* CHIP_LOGGING_STYLE_ANDROID */ } va_end(v); } -#endif /* !WEAVE_LOGGING_STYLE_EXTERNAL */ +#endif /* !CHIP_LOGGING_STYLE_EXTERNAL */ -NL_DLL_EXPORT uint8_t GetLogFilter() +CHIP_DLL_EXPORT uint8_t GetLogFilter() { -#if WEAVE_LOG_FILTERING +#if CHIP_LOG_FILTERING return gLogFilter; #else return kLogCategory_Max; #endif } -NL_DLL_EXPORT void SetLogFilter(uint8_t category) +CHIP_DLL_EXPORT void SetLogFilter(uint8_t category) { -#if WEAVE_LOG_FILTERING +#if CHIP_LOG_FILTERING gLogFilter = category; #endif } -#endif /* _WEAVE_USE_LOGGING */ +#endif /* _CHIP_USE_LOGGING */ } // namespace Logging -} // namespace Weave -} // namespace nl +} // namespace chip diff --git a/src/lib/support/logging/CHIPLogging.h b/src/lib/support/logging/CHIPLogging.h index 8f8495543ed0b1..8948ab903173f0 100644 --- a/src/lib/support/logging/CHIPLogging.h +++ b/src/lib/support/logging/CHIPLogging.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2013-2017 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. @@ -19,49 +18,48 @@ /** * @file * This file defines macros, constants, and interfaces for a - * platform-independent logging interface for the Weave SDK. + * platform-independent logging interface for the chip SDK. * - * Weave SDK clients may choose, at compile time, among Android, + * chip SDK clients may choose, at compile time, among Android, * C Standard I/O, or external (platform- and integrator-defined) * logging style implementations that will be invoked when any of * the following preprocessor symbols are asserted: * - * - #WEAVE_ERROR_LOGGING - * - #WEAVE_PROGRESS_LOGGING - * - #WEAVE_DETAIL_LOGGING + * - #CHIP_ERROR_LOGGING + * - #CHIP_PROGRESS_LOGGING + * - #CHIP_DETAIL_LOGGING * */ -#ifndef WEAVELOGGING_H_ -#define WEAVELOGGING_H_ +#ifndef CHIPLOGGING_H_ +#define CHIPLOGGING_H_ #include -#include +#include "core/CHIPConfig.h" /** - * @namespace nl::Weave::Logging + * @namespace chip::Logging * * @brief - * This namespace includes all interfaces within Weave for shared + * This namespace includes all interfaces within chip for shared * logging support. * * The interfaces include macros, constants, and functions for a - * platform-independent logging interface for the Weave SDK. + * platform-independent logging interface for the chip SDK. * - * Weave SDK clients may choose, at compile time, among Android, + * chip SDK clients may choose, at compile time, among Android, * C Standard I/O, or external (platform- and integrator-defined) * logging style implementations that will be invoked when any of * the following preprocessor symbols are asserted: * - * - #WEAVE_ERROR_LOGGING - * - #WEAVE_PROGRESS_LOGGING - * - #WEAVE_DETAIL_LOGGING + * - #CHIP_ERROR_LOGGING + * - #CHIP_PROGRESS_LOGGING + * - #CHIP_DETAIL_LOGGING * */ -namespace nl { -namespace Weave { +namespace chip { namespace Logging { /** @@ -72,7 +70,7 @@ namespace Logging { * messages. * * @note If you add modules or rearrange this list you must update the - * ModuleNames tables in WeaveLogging.cpp. + * ModuleNames tables in chipLogging.cpp. * */ enum LogModule @@ -102,9 +100,9 @@ enum LogModule kLogModule_TokenPairing, kLogModule_HeatLink, kLogModule_TimeService, - kLogModule_WeaveTunnel, + kLogModule_chipTunnel, kLogModule_Heartbeat, - kLogModule_WeaveSystemLayer, + kLogModule_chipSystemLayer, kLogModule_DropcamLegacyPairing, kLogModule_EventLogging, kLogModule_Support, @@ -190,116 +188,116 @@ extern void Log(uint8_t module, uint8_t category, const char *msg, ...); extern uint8_t GetLogFilter(void); extern void SetLogFilter(uint8_t category); -#ifndef WEAVE_ERROR_LOGGING -#define WEAVE_ERROR_LOGGING 1 +#ifndef CHIP_ERROR_LOGGING +#define CHIP_ERROR_LOGGING 1 #endif -#ifndef WEAVE_LOG_FILTERING -#define WEAVE_LOG_FILTERING 1 +#ifndef CHIP_LOG_FILTERING +#define CHIP_LOG_FILTERING 1 #endif -#if WEAVE_ERROR_LOGGING +#if CHIP_ERROR_LOGGING /** - * @def WeaveLogError(MOD, MSG, ...) + * @def chipLogError(MOD, MSG, ...) * * @brief - * Log a Weave message for the specified module in the 'Error' + * Log a chip message for the specified module in the 'Error' * category. * */ -#ifndef WeaveLogError -#define WeaveLogError(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Error, MSG, ## __VA_ARGS__) +#ifndef chipLogError +#define chipLogError(MOD, MSG, ...) chip::Logging::Log( chip::Logging::kLogModule_##MOD , chip::Logging::kLogCategory_Error, MSG, ## __VA_ARGS__) #endif #else -#define WeaveLogError(MOD, MSG, ...) +#define chipLogError(MOD, MSG, ...) #endif -#ifndef WEAVE_PROGRESS_LOGGING -#define WEAVE_PROGRESS_LOGGING 1 +#ifndef CHIP_PROGRESS_LOGGING +#define CHIP_PROGRESS_LOGGING 1 #endif -#if WEAVE_PROGRESS_LOGGING +#if CHIP_PROGRESS_LOGGING /** - * @def WeaveLogProgress(MOD, MSG, ...) + * @def chipLogProgress(MOD, MSG, ...) * * @brief - * Log a Weave message for the specified module in the 'Progress' + * Log a chip message for the specified module in the 'Progress' * category. * */ -#ifndef WeaveLogProgress -#define WeaveLogProgress(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Progress, MSG, ## __VA_ARGS__) +#ifndef chipLogProgress +#define chipLogProgress(MOD, MSG, ...) chip::Logging::Log( chip::Logging::kLogModule_##MOD , chip::Logging::kLogCategory_Progress, MSG, ## __VA_ARGS__) #endif #else -#define WeaveLogProgress(MOD, MSG, ...) +#define chipLogProgress(MOD, MSG, ...) #endif -#ifndef WEAVE_DETAIL_LOGGING -#define WEAVE_DETAIL_LOGGING 1 +#ifndef CHIP_DETAIL_LOGGING +#define CHIP_DETAIL_LOGGING 1 #endif -#if WEAVE_DETAIL_LOGGING +#if CHIP_DETAIL_LOGGING /** - * @def WeaveLogDetail(MOD, MSG, ...) + * @def chipLogDetail(MOD, MSG, ...) * * @brief - * Log a Weave message for the specified module in the 'Detail' + * Log a chip message for the specified module in the 'Detail' * category. * */ -#ifndef WeaveLogDetail -#define WeaveLogDetail(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Detail, MSG, ## __VA_ARGS__) +#ifndef chipLogDetail +#define chipLogDetail(MOD, MSG, ...) chip::Logging::Log( chip::Logging::kLogModule_##MOD , chip::Logging::kLogCategory_Detail, MSG, ## __VA_ARGS__) #endif #else -#define WeaveLogDetail(MOD, MSG, ...) +#define chipLogDetail(MOD, MSG, ...) #endif -#ifndef WEAVE_RETAIN_LOGGING -#define WEAVE_RETAIN_LOGGING WEAVE_PROGRESS_LOGGING -#define WeaveLogRetain(MOD, MSG, ...) WeaveLogProgress(MOD, MSG, ## __VA_ARGS__) +#ifndef CHIP_RETAIN_LOGGING +#define CHIP_RETAIN_LOGGING CHIP_PROGRESS_LOGGING +#define chipLogRetain(MOD, MSG, ...) chipLogProgress(MOD, MSG, ## __VA_ARGS__) #endif -#if WEAVE_RETAIN_LOGGING +#if CHIP_RETAIN_LOGGING /** - * @def WeaveLogRetain(MOD, MSG, ...) + * @def chipLogRetain(MOD, MSG, ...) * * @brief - * Log a Weave message for the specified module in the 'Retain' + * Log a chip message for the specified module in the 'Retain' * category. This is used for IE testing. - * If the product has not defined WEAVE_RETAIN_LOGGING, it defaults to the same as WeaveLogProgress + * If the product has not defined CHIP_RETAIN_LOGGING, it defaults to the same as chipLogProgress * */ -#ifndef WeaveLogRetain -#define WeaveLogRetain(MOD, MSG, ...) nl::Weave::Logging::Log( nl::Weave::Logging::kLogModule_##MOD , nl::Weave::Logging::kLogCategory_Retain, MSG, ## __VA_ARGS__) +#ifndef chipLogRetain +#define chipLogRetain(MOD, MSG, ...) chip::Logging::Log( chip::Logging::kLogModule_##MOD , chip::Logging::kLogCategory_Retain, MSG, ## __VA_ARGS__) #endif -#else // #if WEAVE_RETAIN_LOGGING -#ifdef WeaveLogRetain -// This is to ensure that WeaveLogRetain is null if -// the product has defined WEAVE_RETAIN_LOGGING to 0 itself -#undef WeaveLogRetain +#else // #if CHIP_RETAIN_LOGGING +#ifdef chipLogRetain +// This is to ensure that chipLogRetain is null if +// the product has defined CHIP_RETAIN_LOGGING to 0 itself +#undef chipLogRetain #endif -#define WeaveLogRetain(MOD, MSG, ...) -#endif // #if WEAVE_RETAIN_LOGGING +#define chipLogRetain(MOD, MSG, ...) +#endif // #if CHIP_RETAIN_LOGGING -#if WEAVE_ERROR_LOGGING || WEAVE_PROGRESS_LOGGING || WEAVE_DETAIL_LOGGING || WEAVE_RETAIN_LOGGING -#define _WEAVE_USE_LOGGING 1 +#if CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING || CHIP_RETAIN_LOGGING +#define _CHIP_USE_LOGGING 1 #else -#define _WEAVE_USE_LOGGING 0 -#endif /* WEAVE_ERROR_LOGGING || WEAVE_PROGRESS_LOGGING || WEAVE_DETAIL_LOGGING || WEAVE_RETAIN_LOGGING */ +#define _CHIP_USE_LOGGING 0 +#endif /* CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING || CHIP_RETAIN_LOGGING */ -#if _WEAVE_USE_LOGGING +#if _CHIP_USE_LOGGING -#define nlWeaveLoggingWeavePrefixLen 6 -#define nlWeaveLoggingModuleNameLen 3 -#define nlWeaveLoggingMessageSeparatorLen 2 -#define nlWeaveLoggingMessageTrailerLen 2 -#define nlWeaveLoggingTotalMessagePadding (nlWeaveLoggingWeavePrefixLen + \ - nlWeaveLoggingModuleNameLen + \ - nlWeaveLoggingMessageSeparatorLen + \ - nlWeaveLoggingMessageTrailerLen) +#define chipLoggingchipPrefixLen 6 +#define chipLoggingModuleNameLen 3 +#define chipLoggingMessageSeparatorLen 2 +#define chipLoggingMessageTrailerLen 2 +#define chipLoggingTotalMessagePadding (chipLoggingchipPrefixLen + \ + chipLoggingModuleNameLen + \ + chipLoggingMessageSeparatorLen + \ + chipLoggingMessageTrailerLen) extern void GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg); extern void GetModuleName(char *buf, uint8_t module); @@ -317,24 +315,24 @@ static inline void GetModuleName(char *buf, uint8_t module) return; } -#endif // _WEAVE_USE_LOGGING +#endif // _CHIP_USE_LOGGING -#if WEAVE_LOG_FILTERING +#if CHIP_LOG_FILTERING extern uint8_t gLogFilter; #define IsCategoryEnabled(CAT) ((CAT) <= gLogFilter) -#else // WEAVE_LOG_FILTERING +#else // CHIP_LOG_FILTERING #define IsCategoryEnabled(CAT) (true) -#endif // WEAVE_LOG_FILTERING +#endif // CHIP_LOG_FILTERING /** - * @def WeaveLogIfFalse(aCondition) + * @def chipLogIfFalse(aCondition) * * @brief * This checks for the specified condition, which is expected to @@ -343,119 +341,118 @@ extern uint8_t gLogFilter; * * @note * Evaluation of @a aCondition is always done, but logging is only enabled when - * #WEAVE_CONFIG_ENABLE_CONDITION_LOGGING is enabled. This can be turned on or + * #CHIP_CONFIG_ENABLE_CONDITION_LOGGING is enabled. This can be turned on or * off for each compilation unit by enabling or disabling, as desired, - * #WEAVE_CONFIG_ENABLE_CONDITION_LOGGING before WeaveLogging.h is included by + * #CHIP_CONFIG_ENABLE_CONDITION_LOGGING before chipLogging.h is included by * the preprocessor. * * Example Usage: * * @code - * #define WEAVE_CONFIG_ENABLE_CONDITION_LOGGING 1 + * #define CHIP_CONFIG_ENABLE_CONDITION_LOGGING 1 * - * #include + * #include * * ... * * void foo(void) * { - * WEAVE_ERROR err = WEAVE_NO_ERROR; + * CHIP_ERROR err = CHIP_NO_ERROR; * * ... * * exit: - * WeaveLogIfFalse(WEAVE_END_OF_TLV == err); + * chipLogIfFalse(CHIP_END_OF_TLV == err); * } * @endcode * * @param[in] aCondition A Boolean expression to be evaluated. * - * @sa WEAVE_CONFIG_ENABLE_TRACE_ON_CHECK_FAILURE + * @sa CHIP_CONFIG_ENABLE_TRACE_ON_CHECK_FAILURE * */ -#if WEAVE_CONFIG_ENABLE_CONDITION_LOGGING && !defined(WeaveLogIfFalse) +#if CHIP_CONFIG_ENABLE_CONDITION_LOGGING && !defined(chipLogIfFalse) -#define WeaveLogIfFalse(aCondition) \ +#define chipLogIfFalse(aCondition) \ do \ { \ if (!(aCondition)) \ { \ - WeaveLogError(NotSpecified, "Condition Failed (%s) at %s:%d", \ + chipLogError(NotSpecified, "Condition Failed (%s) at %s:%d", \ #aCondition, __FILE__, __LINE__); \ } \ } while (0) -#else // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING +#else // CHIP_CONFIG_ENABLE_CONDITION_LOGGING -#define WeaveLogIfFalse(aCondition) \ +#define chipLogIfFalse(aCondition) \ IgnoreUnusedVariable(aCondition) -#endif // WEAVE_CONFIG_ENABLE_CONDITION_LOGGING +#endif // CHIP_CONFIG_ENABLE_CONDITION_LOGGING /** - * @def WeaveLogFunctError(aErr) + * @def chipLogFunctError(aErr) * * @brief - * If the given error value (@a aErr) is not successful (!= WEAVE_NO_ERROR), + * If the given error value (@a aErr) is not successful (!= CHIP_NO_ERROR), * the method logs the file name, line number, and the error code. * * @note * Evaluation of @a aErr is always done, but logging is only enabled when - * #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING is enabled. This can be turned + * #CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING is enabled. This can be turned * on or off for each compilation unit by enabling or disabling, as desired, - * #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING before WeaveLogging.h is included + * #CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING before chipLogging.h is included * by the preprocessor. * * Example Usage: * * @code - * #define WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 1 + * #define CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 1 * - * #include + * #include * * ... * * void foo(void) * { - * WEAVE_ERROR err = WEAVE_NO_ERROR; + * CHIP_ERROR err = CHIP_NO_ERROR; * * ... * * exit: - * WeaveLogFunctError(err); + * chipLogFunctError(err); * } * @endcode * - * @param[in] aErr A scalar status to be evaluated against WEAVE_NO_ERROR. + * @param[in] aErr A scalar status to be evaluated against CHIP_NO_ERROR. * - * @sa #WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING + * @sa #CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING * */ -#if WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING && !defined(WeaveLogFunctError) +#if CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING && !defined(chipLogFunctError) -#define WeaveLogFunctError(aErr) \ +#define chipLogFunctError(aErr) \ do \ { \ - if ((aErr) != WEAVE_NO_ERROR) \ + if ((aErr) != CHIP_NO_ERROR) \ { \ - WeaveLogError(NotSpecified, "%s at %s:%d", nl::ErrorStr(aErr), __FILE__, __LINE__);\ + chipLogError(NotSpecified, "%s at %s:%d", ErrorStr(aErr), __FILE__, __LINE__);\ } \ } while (0) -#else // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING +#else // CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING -#define WeaveLogFunctError(aErr) \ +#define chipLogFunctError(aErr) \ IgnoreUnusedVariable(aErr) -#endif // WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING +#endif // CHIP_CONFIG_ENABLE_FUNCT_ERROR_LOGGING } // namespace Logging -} // namespace Weave -} // namespace nl +} // namespace chip -#endif /* WEAVELOGGING_H_ */ +#endif /* CHIPLOGGING_H_ */ From 99376f215992797ffffc5188692e7f83692a4794 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 12:50:46 -0700 Subject: [PATCH 5/7] Makefiles to build support and core --- src/Makefile | 2 +- src/lib/core/CHIPConfig.h | 10 ++++----- src/lib/core/CHIPCore.h | 11 +++++----- src/lib/core/CHIPError.cpp | 3 +++ src/lib/core/Makefile | 26 ++++++++++++++++++++++++ src/lib/support/Makefile | 27 +++++++++++++++++++++++++ src/lib/support/logging/CHIPLogging.cpp | 8 ++++---- 7 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 src/lib/core/Makefile create mode 100644 src/lib/support/Makefile diff --git a/src/Makefile b/src/Makefile index 779c80ef5ff576..d822552004f3ab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ TOPTARGETS := all clean run_tests -SUBDIRS = lwip system +SUBDIRS = lwip system lib/core lib/support $(TOPTARGETS): $(SUBDIRS) $(SUBDIRS): diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index c0b2cd715eb1af..b5e3b8b4dad184 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -37,12 +37,12 @@ #include "SystemConfig.h" /* COMING SOON: making the INET Layer optional entails making this inclusion optional. */ -#include "InetConfig.h" - +//#include "InetConfig.h" +/* #if INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 #error "chip SDK requires INET_TCP_IDLE_CHECK_INTERVAL > 0" #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT && INET_TCP_IDLE_CHECK_INTERVAL <= 0 - +*/ /* Include a project-specific configuration file, if defined. * * An application or module that incorporates chip can define a project configuration @@ -81,7 +81,7 @@ #endif // CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES // Profile-specific Configuration Headers - +/* #include "CHIPBDXConfig.h" #include "CHIPDMConfig.h" @@ -93,7 +93,7 @@ #include "CHIPEventLoggingConfig.h" #include "CHIPWRMPConfig.h" - +*/ /** * @def CHIP_CONFIG_ERROR_TYPE * diff --git a/src/lib/core/CHIPCore.h b/src/lib/core/CHIPCore.h index 49b982c4e8f664..a86e98988d96cf 100644 --- a/src/lib/core/CHIPCore.h +++ b/src/lib/core/CHIPCore.h @@ -26,7 +26,7 @@ #define CHIPCORE_H_ #include "core/CHIPConfig.h" - +/* #include #if CONFIG_NETWORK_LAYER_BLE @@ -34,22 +34,23 @@ #endif // CONFIG_NETWORK_LAYER_BLE #include - +*/ //Currently only used on Sapphire #define CHIP_CORE_IDENTITY "chip-core" #define CHIP_CORE_PREFIX CHIP_CORE_IDENTITY ": " namespace chip { - +/* #if CONFIG_NETWORK_LAYER_BLE using namespace ::Ble; #endif // CONFIG_NETWORK_LAYER_BLE using namespace ::Inet; - +*/ } #include "core/CHIPError.h" +/* #include "core/CHIPKeyIds.h" #include "core/CHIPFabricState.h" #include "core/CHIPMessageLayer.h" @@ -57,5 +58,5 @@ using namespace ::Inet; #include "core/CHIPExchangeMgr.h" #include "core/CHIPSecurityMgr.h" #include "core/CHIPGlobals.h" - +*/ #endif /* CHIPCORE_H_ */ diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index e4762ba8a42ec7..1fb66a24e4e2c0 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -20,7 +20,10 @@ * This file contains functions for working with CHIP errors. */ +#include + #include "core/CHIPCore.h" +#include "support/ErrorStr.h" namespace chip { diff --git a/src/lib/core/Makefile b/src/lib/core/Makefile new file mode 100644 index 00000000000000..82b1f618acfb8e --- /dev/null +++ b/src/lib/core/Makefile @@ -0,0 +1,26 @@ +TOP_DIR = ../../.. +Test_Dir = tests + +.PHONY: all clean run_tests + +all: libcore.a run_tests + +include $(TOP_DIR)/.yams/cpp_rules.min + +Module_Includes = \ + -I. \ + -I$(TOP_DIR)/src/include \ + -I$(TOP_DIR)/src/lib/ \ + -I$(TOP_DIR)/src/system \ + -I$(TOP_DIR)/build/config/standalone/ + +Module_Test_Includes = $(Module_Includes) + +CPP_Files = CHIPError.cpp + +libcore.a: $(CPP_Objects) + ar rvs $@ $^ + @echo "LINK => $@" + +clean: my_clean + @rm -f libcore.a *.gcda *.gcno *.gcov diff --git a/src/lib/support/Makefile b/src/lib/support/Makefile new file mode 100644 index 00000000000000..acbbdfc9f5c981 --- /dev/null +++ b/src/lib/support/Makefile @@ -0,0 +1,27 @@ +TOP_DIR = ../../.. +Test_Dir = tests + +.PHONY: all clean run_tests + +all: libsupport.a run_tests + +include $(TOP_DIR)/.yams/cpp_rules.min + +Module_Includes = \ + -I. \ + -I$(TOP_DIR)/src/include \ + -I$(TOP_DIR)/src/lib/ \ + -I$(TOP_DIR)/src/system \ + -I$(TOP_DIR)/build/config/standalone/ \ + -I$(TOP_DIR)/third_party/nlassert/repo/include + +Module_Test_Includes = $(Module_Includes) + +CPP_Files = logging/CHIPLogging.cpp + +libsupport.a: $(CPP_Objects) + ar rvs $@ $^ + @echo "LINK => $@" + +clean: my_clean + @rm -f libsupport.a *.gcda *.gcno *.gcov diff --git a/src/lib/support/logging/CHIPLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp index 5f589d94d6f732..36824dceea7fb9 100644 --- a/src/lib/support/logging/CHIPLogging.cpp +++ b/src/lib/support/logging/CHIPLogging.cpp @@ -26,7 +26,7 @@ #include #include -#include "Support/DLLUtil.h" +#include "support/DLLUtil.h" #include "core/CHIPCore.h" #include "support/CodeUtils.h" #include "CHIPLogging.h" @@ -191,7 +191,7 @@ uint8_t gLogFilter = kLogCategory_Max; #define __CHIP_LOGGING_LINK_ATTRIBUTE #endif -CHIP_DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...) +DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t category, const char *msg, ...) { va_list v; @@ -227,7 +227,7 @@ CHIP_DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void Log(uint8_t module, uint8_t c } #endif /* !CHIP_LOGGING_STYLE_EXTERNAL */ -CHIP_DLL_EXPORT uint8_t GetLogFilter() +DLL_EXPORT uint8_t GetLogFilter() { #if CHIP_LOG_FILTERING return gLogFilter; @@ -236,7 +236,7 @@ CHIP_DLL_EXPORT uint8_t GetLogFilter() #endif } -CHIP_DLL_EXPORT void SetLogFilter(uint8_t category) +DLL_EXPORT void SetLogFilter(uint8_t category) { #if CHIP_LOG_FILTERING gLogFilter = category; From 8b997b114b51d76bbe140a2add1eef35c1427dc1 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 15:50:56 -0700 Subject: [PATCH 6/7] Address review comments --- src/lib/core/CHIPConfig.h | 2 +- src/lib/core/CHIPCore.h | 5 ++--- src/lib/core/CHIPError.cpp | 4 ++-- src/lib/core/CHIPError.h | 2 +- src/lib/support/CodeUtils.h | 4 ++-- src/lib/support/logging/CHIPLogging.cpp | 4 +--- src/lib/support/logging/CHIPLogging.h | 4 +--- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index b5e3b8b4dad184..cc585ac287fba9 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -34,7 +34,7 @@ #ifndef CHIP_CONFIG_H_ #define CHIP_CONFIG_H_ -#include "SystemConfig.h" +#include /* COMING SOON: making the INET Layer optional entails making this inclusion optional. */ //#include "InetConfig.h" diff --git a/src/lib/core/CHIPCore.h b/src/lib/core/CHIPCore.h index a86e98988d96cf..9e5cd4c90e5783 100644 --- a/src/lib/core/CHIPCore.h +++ b/src/lib/core/CHIPCore.h @@ -25,7 +25,7 @@ #ifndef CHIPCORE_H_ #define CHIPCORE_H_ -#include "core/CHIPConfig.h" +#include /* #include @@ -35,7 +35,6 @@ #include */ -//Currently only used on Sapphire #define CHIP_CORE_IDENTITY "chip-core" #define CHIP_CORE_PREFIX CHIP_CORE_IDENTITY ": " @@ -49,7 +48,7 @@ using namespace ::Inet; */ } -#include "core/CHIPError.h" +#include /* #include "core/CHIPKeyIds.h" #include "core/CHIPFabricState.h" diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index 1fb66a24e4e2c0..7e9dba528648df 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -22,8 +22,8 @@ #include -#include "core/CHIPCore.h" -#include "support/ErrorStr.h" +#include +#include namespace chip { diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 9a87b2bd3c0f1c..a25f2f87b98ddf 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -31,7 +31,7 @@ #ifndef CHIP_ERROR_H #define CHIP_ERROR_H -#include "CHIPConfig.h" +#include // clang-format off /** diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h index 005dc052fdc1d1..1b6989cd29931f 100644 --- a/src/lib/support/CodeUtils.h +++ b/src/lib/support/CodeUtils.h @@ -26,8 +26,8 @@ #ifndef CODEUTILS_H_ #define CODEUTILS_H_ -#include "core/CHIPError.h" -#include "support/ErrorStr.h" +#include +#include #include "support/logging/CHIPLogging.h" /** diff --git a/src/lib/support/logging/CHIPLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp index 36824dceea7fb9..61f6cd35b51fd9 100644 --- a/src/lib/support/logging/CHIPLogging.cpp +++ b/src/lib/support/logging/CHIPLogging.cpp @@ -27,7 +27,7 @@ #include #include "support/DLLUtil.h" -#include "core/CHIPCore.h" +#include #include "support/CodeUtils.h" #include "CHIPLogging.h" @@ -77,12 +77,10 @@ static const char ModuleNames[] = "SP\0" // ServiceProvisioning "SWU" // SoftwareUpdate "TP\0" // TokenPairing - "HL\0" // HeatLink "TS\0" // TimeServices "WT\0" // chipTunnel "HB\0" // Heartbeat "WSL" // chipSystemLayer - "DLP" // DropcamLegacyPairing "EVL" // Event Logging "SPT" // Support ; diff --git a/src/lib/support/logging/CHIPLogging.h b/src/lib/support/logging/CHIPLogging.h index 8948ab903173f0..e0a386f5d294e5 100644 --- a/src/lib/support/logging/CHIPLogging.h +++ b/src/lib/support/logging/CHIPLogging.h @@ -36,7 +36,7 @@ #include -#include "core/CHIPConfig.h" +#include /** * @namespace chip::Logging @@ -98,12 +98,10 @@ enum LogModule kLogModule_ServiceProvisioning, kLogModule_SoftwareUpdate, kLogModule_TokenPairing, - kLogModule_HeatLink, kLogModule_TimeService, kLogModule_chipTunnel, kLogModule_Heartbeat, kLogModule_chipSystemLayer, - kLogModule_DropcamLegacyPairing, kLogModule_EventLogging, kLogModule_Support, From f414878fbb62bd4f48630a9aaa291806bbc7c231 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Mon, 9 Mar 2020 15:52:37 -0700 Subject: [PATCH 7/7] Fix makefile --- src/lib/support/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/support/Makefile b/src/lib/support/Makefile index acbbdfc9f5c981..5c65357727eaee 100644 --- a/src/lib/support/Makefile +++ b/src/lib/support/Makefile @@ -10,7 +10,8 @@ include $(TOP_DIR)/.yams/cpp_rules.min Module_Includes = \ -I. \ -I$(TOP_DIR)/src/include \ - -I$(TOP_DIR)/src/lib/ \ + -I$(TOP_DIR)/src/lib \ + -I$(TOP_DIR)/src/lib/core \ -I$(TOP_DIR)/src/system \ -I$(TOP_DIR)/build/config/standalone/ \ -I$(TOP_DIR)/third_party/nlassert/repo/include