From 46838433090d6c57cc3c7516a874ea813ecea79d Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Fri, 15 Sep 2023 19:32:28 -0700 Subject: [PATCH] [Android]Enable OTA Provider in Android controller (#28316) * move MTRIMDispatch.mm and MTRControllerAccessControl * Add dynamic dispatcher and access control for Android controller * Fix spelling of "controller". * Make Matter.framework work with the new setup. * address comment * Restyled by gn --------- Co-authored-by: Boris Zbarsky Co-authored-by: Restyled.io --- examples/java-matter-controller/args.gni | 1 + src/app/BUILD.gn | 18 +- src/app/common_flags.gni | 1 + .../dynamic_server/AccessControl.cpp} | 42 +- .../dynamic_server/AccessControl.h} | 26 +- src/app/dynamic_server/DynamicDispatcher.cpp | 390 ++++++++++++++++++ .../java/AndroidCommissioningWindowOpener.cpp | 1 - src/controller/java/BUILD.gn | 6 + .../java/CHIPDeviceController-JNI.cpp | 8 + src/darwin/Framework/CHIP/BUILD.gn | 1 - .../CHIP/MTRDeviceControllerFactory.mm | 4 +- src/darwin/Framework/CHIP/MTRIMDispatch.mm | 352 ---------------- .../Matter.xcodeproj/project.pbxproj | 26 -- .../Framework/chip_xcode_build_connector.sh | 1 + 14 files changed, 457 insertions(+), 420 deletions(-) rename src/{darwin/Framework/CHIP/MTRControllerAccessControl.mm => app/dynamic_server/AccessControl.cpp} (76%) rename src/{darwin/Framework/CHIP/MTRControllerAccessControl.h => app/dynamic_server/AccessControl.h} (66%) create mode 100644 src/app/dynamic_server/DynamicDispatcher.cpp delete mode 100644 src/darwin/Framework/CHIP/MTRIMDispatch.mm diff --git a/examples/java-matter-controller/args.gni b/examples/java-matter-controller/args.gni index 5d279bfa552053..af9681d8d85eef 100644 --- a/examples/java-matter-controller/args.gni +++ b/examples/java-matter-controller/args.gni @@ -24,3 +24,4 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/java-matter-controller/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] chip_stack_lock_tracking = "fatal" +chip_build_controller_dynamic_server = true diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index a4028a7a7449ef..5f3c1b5a320710 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -14,9 +14,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/nlio.gni") -import("${chip_root}/src/platform/device.gni") - import("${chip_root}/build/chip/buildconfig_header.gni") +import("${chip_root}/src/platform/device.gni") import("common_flags.gni") import("icd/icd.gni") @@ -209,6 +208,21 @@ static_library("app") { ] } + if (chip_build_controller_dynamic_server) { + defines = [ + "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", + "CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=1", + ] + sources += [ + "clusters/ota-provider/ota-provider.cpp", + "dynamic_server/AccessControl.cpp", + "dynamic_server/AccessControl.h", + "dynamic_server/DynamicDispatcher.cpp", + "util/privilege-storage.cpp", + "util/privilege-storage.h", + ] + } + if (chip_enable_read_client) { sources += [ "BufferedReadCallback.cpp", diff --git a/src/app/common_flags.gni b/src/app/common_flags.gni index 5e5a82afd7d5e1..7565bfd223ff45 100644 --- a/src/app/common_flags.gni +++ b/src/app/common_flags.gni @@ -16,4 +16,5 @@ declare_args() { # Temporary flag for interaction model and echo protocols, set it to true to enable chip_app_use_echo = false chip_enable_read_client = true + chip_build_controller_dynamic_server = false } diff --git a/src/darwin/Framework/CHIP/MTRControllerAccessControl.mm b/src/app/dynamic_server/AccessControl.cpp similarity index 76% rename from src/darwin/Framework/CHIP/MTRControllerAccessControl.mm rename to src/app/dynamic_server/AccessControl.cpp index 8ea39e55fb2bec..b7bd76ae1e4d2d 100644 --- a/src/darwin/Framework/CHIP/MTRControllerAccessControl.mm +++ b/src/app/dynamic_server/AccessControl.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2022-2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -#import "MTRControllerAccessControl.h" +#include "AccessControl.h" #include #include @@ -30,10 +30,11 @@ namespace { // TODO: Maybe consider making this configurable? See also -// CHIPIMDispatch.mm. +// DynamicDispatch.cpp. constexpr EndpointId kSupportedEndpoint = 0; -class DeviceTypeResolver : public Access::AccessControl::DeviceTypeResolver { +class DeviceTypeResolver : public Access::AccessControl::DeviceTypeResolver +{ public: bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) override { @@ -42,22 +43,26 @@ bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) overri } gDeviceTypeResolver; // TODO: Make the policy more configurable by consumers. -class AccessControlDelegate : public Access::AccessControl::Delegate { - CHIP_ERROR Check( - const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, Privilege requestPrivilege) override +class AccessControlDelegate : public Access::AccessControl::Delegate +{ + CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, + Privilege requestPrivilege) override { - if (requestPath.endpoint != kSupportedEndpoint || requestPath.cluster != OtaSoftwareUpdateProvider::Id) { + if (requestPath.endpoint != kSupportedEndpoint || requestPath.cluster != OtaSoftwareUpdateProvider::Id) + { // We only allow access to OTA software update provider. return CHIP_ERROR_ACCESS_DENIED; } - if (requestPrivilege != Privilege::kOperate) { + if (requestPrivilege != Privilege::kOperate) + { // The commands on OtaSoftwareUpdateProvider all require // Operate; we should not be asked for anything else. return CHIP_ERROR_ACCESS_DENIED; } - if (subjectDescriptor.authMode != AuthMode::kCase && subjectDescriptor.authMode != AuthMode::kPase) { + if (subjectDescriptor.authMode != AuthMode::kCase && subjectDescriptor.authMode != AuthMode::kPase) + { // No idea who is asking; deny for now. return CHIP_ERROR_ACCESS_DENIED; } @@ -71,14 +76,13 @@ CHIP_ERROR Check( AccessControlDelegate gDelegate; } // anonymous namespace -@implementation MTRControllerAccessControl - -+ (void)init +namespace chip { +namespace app { +namespace dynamic_server { +void InitAccessControl() { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - GetAccessControl().Init(&gDelegate, gDeviceTypeResolver); - }); + GetAccessControl().Init(&gDelegate, gDeviceTypeResolver); } - -@end +} // namespace dynamic_server +} // namespace app +} // namespace chip diff --git a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h b/src/app/dynamic_server/AccessControl.h similarity index 66% rename from src/darwin/Framework/CHIP/MTRControllerAccessControl.h rename to src/app/dynamic_server/AccessControl.h index 81060ddca6d0b4..e5be582797e671 100644 --- a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h +++ b/src/app/dynamic_server/AccessControl.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2022-2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,24 +15,16 @@ */ #pragma once -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -MTR_HIDDEN -@interface MTRControllerAccessControl : NSObject - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; -+ (instancetype)alloc NS_UNAVAILABLE; +// Experimental API for Access Control +namespace chip { +namespace app { +namespace dynamic_server { /** * Initialize the access control module. Must be called on the Matter task * queue. */ -+ (void)init; - -@end - -NS_ASSUME_NONNULL_END +void InitAccessControl(); +} // namespace dynamic_server +} // namespace app +} // namespace chip diff --git a/src/app/dynamic_server/DynamicDispatcher.cpp b/src/app/dynamic_server/DynamicDispatcher.cpp new file mode 100644 index 00000000000000..05521627364d31 --- /dev/null +++ b/src/app/dynamic_server/DynamicDispatcher.cpp @@ -0,0 +1,390 @@ +/* + * + * Copyright (c) 2022-2023 Project CHIP Authors + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * This file defines the APIs needed to handle interaction model dispatch. + * These are the APIs normally defined in + * src/app/util/ember-compatibility-functions.cpp and the generated + * IMClusterCommandHandler.cpp but we want a different implementation of these + * to enable more dynamic behavior, since not all framework consumers will be + * implementing the same server clusters. + */ +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +namespace { + +// TODO: Maybe consider making this configurable? See also +// AccessControl.cpp. +constexpr EndpointId kSupportedEndpoint = 0; + +} // anonymous namespace + +namespace chip { +namespace app { + +using Access::SubjectDescriptor; +using Protocols::InteractionModel::Status; + +namespace { + +bool IsSupportedGlobalAttribute(AttributeId aAttribute) +{ + // We don't have any non-global attributes. + using namespace Globals::Attributes; + + for (auto & attr : GlobalAttributesNotInMetadata) + { + if (attr == aAttribute) + { + return true; + } + } + + switch (aAttribute) + { + case FeatureMap::Id: + FALLTHROUGH; + case ClusterRevision::Id: + return true; + } + + return false; +} + +Status DetermineAttributeStatus(const ConcreteAttributePath & aPath, bool aIsWrite) +{ + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider, though in practice it just affects which + // error is returned. + if (aPath.mEndpointId != kSupportedEndpoint) + { + return Status::UnsupportedEndpoint; + } + + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider, though in practice it just affects which + // error is returned. + if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) + { + return Status::UnsupportedCluster; + } + + if (!IsSupportedGlobalAttribute(aPath.mAttributeId)) + { + return Status::UnsupportedAttribute; + } + + // No permissions for this for read, and none of these are writable for + // write. The writable-or-not check happens before the ACL check. + return aIsWrite ? Status::UnsupportedWrite : Status::UnsupportedAccess; +} + +} // anonymous namespace + +CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeValueEncoder::AttributeEncodeState * aEncoderState) +{ + Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ false); + return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(status)); +} + +bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) +{ + return DetermineAttributeStatus(aPath, /* aIsWrite = */ false) == Status::UnsupportedAccess; +} + +Status ServerClusterCommandExists(const ConcreteCommandPath & aPath) +{ + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider. + using namespace OtaSoftwareUpdateProvider::Commands; + + if (aPath.mEndpointId != kSupportedEndpoint) + { + return Status::UnsupportedEndpoint; + } + + if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) + { + return Status::UnsupportedCluster; + } + + switch (aPath.mCommandId) + { + case QueryImage::Id: + FALLTHROUGH; + case ApplyUpdateRequest::Id: + FALLTHROUGH; + case NotifyUpdateApplied::Id: + return Status::Success; + } + + return Status::UnsupportedCommand; +} + +bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) +{ + // Will never be called anyway; we have no attributes. + return false; +} + +const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) +{ + // Note: This test does not make use of the real attribute metadata. + static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; + return &stub; +} + +bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) +{ + return false; +} + +CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, + TLV::TLVReader & aReader, WriteHandler * aWriteHandler) +{ + Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ true); + return aWriteHandler->AddStatus(aPath, status); +} + +// No attribute access overrides on iOS and Android for now. +// TODO (#16806): This function can be moved to InteractionModelEngine. +AttributeAccessInterface * GetAttributeAccessOverride(EndpointId endpointId, ClusterId clusterId) +{ + return nullptr; +} + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aPath, TLV::TLVReader & aReader, CommandHandler * aCommandObj) +{ + // This command passed ServerClusterCommandExists so we know it's one of our + // supported commands. + using namespace OtaSoftwareUpdateProvider::Commands; + + bool wasHandled = false; + CHIP_ERROR err = CHIP_NO_ERROR; + + switch (aPath.mCommandId) + { + case QueryImage::Id: { + QueryImage::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(aCommandObj, aPath, commandData); + } + break; + } + case ApplyUpdateRequest::Id: { + ApplyUpdateRequest::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(aCommandObj, aPath, commandData); + } + break; + } + case NotifyUpdateApplied::Id: { + NotifyUpdateApplied::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(aCommandObj, aPath, commandData); + } + break; + } + default: + break; + } + + if (CHIP_NO_ERROR != err || !wasHandled) + { + aCommandObj->AddStatus(aPath, Status::InvalidCommand); + } +} + +Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) +{ + return Protocols::InteractionModel::Status::UnsupportedEvent; +} + +} // namespace app +} // namespace chip + +/** + * Called by the OTA provider cluster server to determine an index + * into its array. + */ +uint16_t emberAfGetClusterServerEndpointIndex(EndpointId endpoint, ClusterId cluster, uint16_t fixedClusterServerEndpointCount) +{ + if (endpoint == kSupportedEndpoint && cluster == OtaSoftwareUpdateProvider::Id) + { + return 0; + } + + return UINT16_MAX; +} + +/** + * Methods used by AttributePathExpandIterator, which need to exist + * because it is part of libCHIP. For AttributePathExpandIterator + * purposes, for now, we just pretend like we have just our one + * endpoint, the OTA Provider cluster, and no attributes (because we + * would be erroring out from them anyway). + */ +uint16_t emberAfGetServerAttributeCount(EndpointId endpoint, ClusterId cluster) +{ + return 0; +} + +uint16_t emberAfEndpointCount(void) +{ + return 1; +} + +uint16_t emberAfIndexFromEndpoint(EndpointId endpoint) +{ + if (endpoint == kSupportedEndpoint) + { + return 0; + } + + return UINT16_MAX; +} + +EndpointId emberAfEndpointFromIndex(uint16_t index) +{ + // Index must be valid here, so 0. + return kSupportedEndpoint; +} + +Optional emberAfGetNthClusterId(EndpointId endpoint, uint8_t n, bool server) +{ + if (endpoint == kSupportedEndpoint && n == 0 && server) + { + return MakeOptional(OtaSoftwareUpdateProvider::Id); + } + + return NullOptional; +} + +uint16_t emberAfGetServerAttributeIndexByAttributeId(EndpointId endpoint, ClusterId cluster, AttributeId attributeId) +{ + return UINT16_MAX; +} + +bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) +{ + return false; +} + +uint8_t emberAfClusterCount(EndpointId endpoint, bool server) +{ + if (endpoint == kSupportedEndpoint && server) + { + return 1; + } + + return 0; +} + +Optional emberAfGetServerAttributeIdByIndex(EndpointId endpoint, ClusterId cluster, uint16_t attributeIndex) +{ + return NullOptional; +} + +uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClusterMask mask) +{ + if (endpoint == kSupportedEndpoint && clusterId == OtaSoftwareUpdateProvider::Id && (mask & CLUSTER_MASK_SERVER)) + { + return 0; + } + + return UINT8_MAX; +} + +bool emberAfEndpointIndexIsEnabled(uint16_t index) +{ + return index == 0; +} + +namespace { +const CommandId acceptedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id, kInvalidCommandId }; +const CommandId generatedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id, kInvalidCommandId }; +const EmberAfCluster otaProviderCluster{ + .clusterId = Clusters::OtaSoftwareUpdateProvider::Id, + .attributes = nullptr, + .attributeCount = 0, + .clusterSize = 0, + .mask = CLUSTER_MASK_SERVER, + .functions = nullptr, + .acceptedCommandList = acceptedCommands, + .generatedCommandList = generatedCommands, + .eventList = nullptr, + .eventCount = 0, +}; +const EmberAfEndpointType otaProviderEndpoint{ .cluster = &otaProviderCluster, .clusterCount = 1, .endpointSize = 0 }; +} // namespace + +const EmberAfEndpointType * emberAfFindEndpointType(EndpointId endpoint) +{ + if (endpoint == kSupportedEndpoint) + { + return &otaProviderEndpoint; + } + + return nullptr; +} + +const EmberAfCluster * emberAfFindServerCluster(EndpointId endpoint, ClusterId cluster) +{ + if (endpoint == kSupportedEndpoint && cluster == Clusters::OtaSoftwareUpdateProvider::Id) + { + return &otaProviderCluster; + } + + return nullptr; +} diff --git a/src/controller/java/AndroidCommissioningWindowOpener.cpp b/src/controller/java/AndroidCommissioningWindowOpener.cpp index 6679887444427d..c1a2c5ae09c164 100644 --- a/src/controller/java/AndroidCommissioningWindowOpener.cpp +++ b/src/controller/java/AndroidCommissioningWindowOpener.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace chip::app::Clusters; using namespace chip::System::Clock; diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 2cbb402a512f87..5afa13c7f092a0 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -17,6 +17,8 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/java/config.gni") import("${chip_root}/build/chip/java/rules.gni") import("${chip_root}/build/chip/tests.gni") +import("${chip_root}/src/app/common_flags.gni") +import("${chip_root}/src/platform/device.gni") if (!matter_enable_java_compilation) { import("${build_root}/config/android_abi.gni") @@ -87,6 +89,10 @@ shared_library("jni") { deps += [ "${chip_root}/src/controller/data_model:java-jni-sources" ] } + if (chip_build_controller_dynamic_server) { + defines += [ "CHIP_DEVICE_CONFIG_DYNAMIC_SERVER" ] + } + if (matter_enable_java_compilation) { defines += [ "JAVA_MATTER_CONTROLLER_TEST" ] diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 900440c7ce865c..8bedec602381e0 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -55,6 +55,10 @@ #include #include +#ifdef CHIP_DEVICE_CONFIG_DYNAMIC_SERVER +#include +#endif // CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + #ifdef JAVA_MATTER_CONTROLLER_TEST #include #else @@ -136,6 +140,10 @@ jint JNI_OnLoad(JavaVM * jvm, void * reserved) SuccessOrExit(err); #endif // JAVA_MATTER_CONTROLLER_TEST +#ifdef CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + chip::app::dynamic_server::InitAccessControl(); +#endif // CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + exit: if (err != CHIP_NO_ERROR) { diff --git a/src/darwin/Framework/CHIP/BUILD.gn b/src/darwin/Framework/CHIP/BUILD.gn index c9174dd064f1b0..502e9a26f8322d 100644 --- a/src/darwin/Framework/CHIP/BUILD.gn +++ b/src/darwin/Framework/CHIP/BUILD.gn @@ -27,7 +27,6 @@ static_library("framework") { sources = [ "${chip_root}/src/app/clusters/ota-provider/ota-provider.cpp", "MTRError.mm", - "MTRIMDispatch.mm", ] public_deps = [ diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 21660828e25847..4f73834b261b03 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -26,7 +26,6 @@ #endif // MTR_PER_CONTROLLER_STORAGE_ENABLED #import "MTRCertificates.h" -#import "MTRControllerAccessControl.h" #import "MTRDemuxingStorage.h" #import "MTRDeviceController.h" #import "MTRDeviceControllerStartupParams.h" @@ -45,6 +44,7 @@ #import +#include #include #include #include @@ -405,7 +405,7 @@ - (BOOL)startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParams return; } - [MTRControllerAccessControl init]; + app::dynamic_server::InitAccessControl(); if (startupParams.hasStorage) { _persistentStorageDelegate = new (std::nothrow) MTRPersistentStorageDelegateBridge(startupParams.storage); diff --git a/src/darwin/Framework/CHIP/MTRIMDispatch.mm b/src/darwin/Framework/CHIP/MTRIMDispatch.mm deleted file mode 100644 index 3b9c62c9e503d4..00000000000000 --- a/src/darwin/Framework/CHIP/MTRIMDispatch.mm +++ /dev/null @@ -1,352 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * 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. - */ -#import - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * This file defines the APIs needed to handle interaction model dispatch. - * These are the APIs normally defined in - * src/app/util/ember-compatibility-functions.cpp and the generated - * IMClusterCommandHandler.cpp but we want a different implementation of these - * to enable more dynamic behavior, since not all framework consumers will be - * implementing the same server clusters. - */ -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; - -namespace { - -// TODO: Maybe consider making this configurable? See also -// CHIPControllerAccessControl.mm. -constexpr EndpointId kSupportedEndpoint = 0; - -} // anonymous namespace - -namespace chip { -namespace app { - - using Access::SubjectDescriptor; - using Protocols::InteractionModel::Status; - - namespace { - - bool IsSupportedGlobalAttribute(AttributeId aAttribute) - { - // We don't have any non-global attributes. - using namespace Globals::Attributes; - - for (auto & attr : GlobalAttributesNotInMetadata) { - if (attr == aAttribute) { - return true; - } - } - - switch (aAttribute) { - case FeatureMap::Id: - FALLTHROUGH; - case ClusterRevision::Id: - return true; - } - - return false; - } - - Status DetermineAttributeStatus(const ConcreteAttributePath & aPath, bool aIsWrite) - { - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider, though in practice it just affects which - // error is returned. - if (aPath.mEndpointId != kSupportedEndpoint) { - return Status::UnsupportedEndpoint; - } - - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider, though in practice it just affects which - // error is returned. - if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) { - return Status::UnsupportedCluster; - } - - if (!IsSupportedGlobalAttribute(aPath.mAttributeId)) { - return Status::UnsupportedAttribute; - } - - // No permissions for this for read, and none of these are writable for - // write. The writable-or-not check happens before the ACL check. - return aIsWrite ? Status::UnsupportedWrite : Status::UnsupportedAccess; - } - - } // anonymous namespace - - CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - AttributeValueEncoder::AttributeEncodeState * aEncoderState) - { - Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ false); - return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(status)); - } - - bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) - { - return DetermineAttributeStatus(aPath, /* aIsWrite = */ false) == Status::UnsupportedAccess; - } - - Status ServerClusterCommandExists(const ConcreteCommandPath & aPath) - { - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider. - using namespace OtaSoftwareUpdateProvider::Commands; - - if (aPath.mEndpointId != kSupportedEndpoint) { - return Status::UnsupportedEndpoint; - } - - if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) { - return Status::UnsupportedCluster; - } - - switch (aPath.mCommandId) { - case QueryImage::Id: - FALLTHROUGH; - case ApplyUpdateRequest::Id: - FALLTHROUGH; - case NotifyUpdateApplied::Id: - return Status::Success; - } - - return Status::UnsupportedCommand; - } - - bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) - { - // Will never be called anyway; we have no attributes. - return false; - } - - const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) - { - // Note: This test does not make use of the real attribute metadata. - static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; - return &stub; - } - - bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) { return false; } - - CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, - TLV::TLVReader & aReader, WriteHandler * aWriteHandler) - { - Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ true); - return aWriteHandler->AddStatus(aPath, status); - } - - // No attribute access overrides on iOS for now. - // TODO (#16806): This function can be moved to InteractionModelEngine. - AttributeAccessInterface * GetAttributeAccessOverride(EndpointId endpointId, ClusterId clusterId) { return nullptr; } - - void DispatchSingleClusterCommand(const ConcreteCommandPath & aPath, TLV::TLVReader & aReader, CommandHandler * aCommandObj) - { - // This command passed ServerClusterCommandExists so we know it's one of our - // supported commands. - using namespace OtaSoftwareUpdateProvider::Commands; - - bool wasHandled = false; - CHIP_ERROR err = CHIP_NO_ERROR; - - switch (aPath.mCommandId) { - case QueryImage::Id: { - QueryImage::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(aCommandObj, aPath, commandData); - } - break; - } - case ApplyUpdateRequest::Id: { - ApplyUpdateRequest::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(aCommandObj, aPath, commandData); - } - break; - } - case NotifyUpdateApplied::Id: { - NotifyUpdateApplied::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(aCommandObj, aPath, commandData); - } - break; - } - default: - break; - } - - if (CHIP_NO_ERROR != err || !wasHandled) { - aCommandObj->AddStatus(aPath, Status::InvalidCommand); - } - } - - Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) - { - return Protocols::InteractionModel::Status::UnsupportedEvent; - } - -} // namespace app -} // namespace chip - -/** - * Called by the OTA provider cluster server to determine an index - * into its array. - */ -uint16_t emberAfGetClusterServerEndpointIndex(EndpointId endpoint, ClusterId cluster, uint16_t fixedClusterServerEndpointCount) -{ - if (endpoint == kSupportedEndpoint && cluster == OtaSoftwareUpdateProvider::Id) { - return 0; - } - - return UINT16_MAX; -} - -/** - * Methods used by AttributePathExpandIterator, which need to exist - * because it is part of libCHIP. For AttributePathExpandIterator - * purposes, for now, we just pretend like we have just our one - * endpoint, the OTA Provider cluster, and no attributes (because we - * would be erroring out from them anyway). - */ -uint16_t emberAfGetServerAttributeCount(EndpointId endpoint, ClusterId cluster) { return 0; } - -uint16_t emberAfEndpointCount(void) { return 1; } - -uint16_t emberAfIndexFromEndpoint(EndpointId endpoint) -{ - if (endpoint == kSupportedEndpoint) { - return 0; - } - - return UINT16_MAX; -} - -EndpointId emberAfEndpointFromIndex(uint16_t index) -{ - // Index must be valid here, so 0. - return kSupportedEndpoint; -} - -Optional emberAfGetNthClusterId(EndpointId endpoint, uint8_t n, bool server) -{ - if (endpoint == kSupportedEndpoint && n == 0 && server) { - return MakeOptional(OtaSoftwareUpdateProvider::Id); - } - - return NullOptional; -} - -uint16_t emberAfGetServerAttributeIndexByAttributeId(EndpointId endpoint, ClusterId cluster, AttributeId attributeId) -{ - return UINT16_MAX; -} - -bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) { return false; } - -uint8_t emberAfClusterCount(EndpointId endpoint, bool server) -{ - if (endpoint == kSupportedEndpoint && server) { - return 1; - } - - return 0; -} - -Optional emberAfGetServerAttributeIdByIndex(EndpointId endpoint, ClusterId cluster, uint16_t attributeIndex) -{ - return NullOptional; -} - -uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClusterMask mask) -{ - if (endpoint == kSupportedEndpoint && clusterId == OtaSoftwareUpdateProvider::Id && (mask & CLUSTER_MASK_SERVER)) { - return 0; - } - - return UINT8_MAX; -} - -bool emberAfEndpointIndexIsEnabled(uint16_t index) { return index == 0; } - -namespace { -const CommandId acceptedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id, kInvalidCommandId }; -const CommandId generatedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id, kInvalidCommandId }; -const EmberAfCluster otaProviderCluster { - .clusterId = Clusters::OtaSoftwareUpdateProvider::Id, - .attributes = nullptr, - .attributeCount = 0, - .clusterSize = 0, - .mask = CLUSTER_MASK_SERVER, - .functions = nullptr, - .acceptedCommandList = acceptedCommands, - .generatedCommandList = generatedCommands, - .eventList = nullptr, - .eventCount = 0, -}; -const EmberAfEndpointType otaProviderEndpoint { .cluster = &otaProviderCluster, .clusterCount = 1, .endpointSize = 0 }; -} - -const EmberAfEndpointType * emberAfFindEndpointType(EndpointId endpoint) -{ - if (endpoint == kSupportedEndpoint) { - return &otaProviderEndpoint; - } - - return nullptr; -} - -const EmberAfCluster * emberAfFindServerCluster(EndpointId endpoint, ClusterId cluster) -{ - if (endpoint == kSupportedEndpoint && cluster == Clusters::OtaSoftwareUpdateProvider::Id) { - return &otaProviderCluster; - } - - return nullptr; -} diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 6f901de32ab3d5..3eda4201e349e9 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -72,9 +72,6 @@ 039546BD2991E1CB006D42A8 /* SystemCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 039546B32991E194006D42A8 /* SystemCommands.cpp */; }; 039546BE2991E1CB006D42A8 /* DelayCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 039546AC2991E185006D42A8 /* DelayCommands.cpp */; }; 039547012992D461006D42A8 /* generic-callback-stubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */; }; - 039547022992D952006D42A8 /* privilege-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D84374A29498BAE0070D20A /* privilege-storage.cpp */; }; - 039547032992D991006D42A8 /* MTRIMDispatch.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */; }; - 039547042992D9BF006D42A8 /* ota-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51431AFA27D29CA4008A7943 /* ota-provider.cpp */; }; 0395470F2992DB37006D42A8 /* complete.c in Sources */ = {isa = PBXBuildFile; fileRef = 0395470C2992DB37006D42A8 /* complete.c */; }; 03F430A7299410C000166449 /* ExamplePersistentStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F430A6299410C000166449 /* ExamplePersistentStorage.cpp */; }; 03F430A82994112B00166449 /* editline.c in Sources */ = {isa = PBXBuildFile; fileRef = 0395470B2992DB37006D42A8 /* editline.c */; }; @@ -123,7 +120,6 @@ 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843710294977000070D20A /* NSDataSpanConversion.h */; }; 3D843716294979230070D20A /* MTRCallbackBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843714294979230070D20A /* MTRCallbackBridge.h */; }; 3D843717294979230070D20A /* MTRClusters_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843715294979230070D20A /* MTRClusters_Internal.h */; }; - 3D84374B29498BAE0070D20A /* privilege-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D84374A29498BAE0070D20A /* privilege-storage.cpp */; }; 3D843756294AD25A0070D20A /* MTRCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843754294AD25A0070D20A /* MTRCertificateInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3D843757294AD25A0070D20A /* MTRCertificateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D843755294AD25A0070D20A /* MTRCertificateInfo.mm */; }; 3DECCB6E29347D2D00585AEC /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DECCB6D29347D2C00585AEC /* Security.framework */; }; @@ -150,8 +146,6 @@ 513DDB8A2761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 513DDB892761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm */; }; 5142E39829D377F000A206F0 /* MTROTAProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5142E39729D377F000A206F0 /* MTROTAProviderTests.m */; }; 514304202914CED9004DC7FE /* generic-callback-stubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */; }; - 51431AF927D2973E008A7943 /* MTRIMDispatch.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */; }; - 51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51431AFA27D29CA4008A7943 /* ota-provider.cpp */; }; 5143851E2A65885500EDC8E6 /* MTRSwiftPairingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */; }; 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */; }; 5146544B2A72F9F500904E61 /* MTRDemuxingStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5146544A2A72F9F500904E61 /* MTRDemuxingStorage.h */; }; @@ -183,8 +177,6 @@ 51C8E3F82825CDB600D47D00 /* MTRTestKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C8E3F72825CDB600D47D00 /* MTRTestKeys.m */; }; 51C984622A61CE2A00B0AD9A /* MTRFabricInfoChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */; }; 51D10D2E2808E2CA00E8CA3D /* MTRTestStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */; }; - 51E0310027EA20D20083DC9C /* MTRControllerAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */; }; - 51E0310127EA20D20083DC9C /* MTRControllerAccessControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */; }; 51E24E73274E0DAC007CCF6E /* MTRErrorTestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */; }; 51E4D121291D0EB400C8C535 /* MTRBaseClusterUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */; }; 51E51FBF282AD37A00FC978D /* MTRDeviceControllerStartupParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E51FBC282AD37A00FC978D /* MTRDeviceControllerStartupParams.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -479,7 +471,6 @@ 3D84372D294984AF0070D20A /* decode_value.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = decode_value.zapt; sourceTree = ""; }; 3D84372E294984AF0070D20A /* MTRCallbackBridge.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MTRCallbackBridge.zapt; sourceTree = ""; }; 3D84372F294984AF0070D20A /* command_completion_type.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = command_completion_type.zapt; sourceTree = ""; }; - 3D84374A29498BAE0070D20A /* privilege-storage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "privilege-storage.cpp"; path = "util/privilege-storage.cpp"; sourceTree = ""; }; 3D843754294AD25A0070D20A /* MTRCertificateInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCertificateInfo.h; sourceTree = ""; }; 3D843755294AD25A0070D20A /* MTRCertificateInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCertificateInfo.mm; sourceTree = ""; }; 3DECCB6D29347D2C00585AEC /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; @@ -507,8 +498,6 @@ 513DDB892761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAttributeTLVValueDecoder.mm; sourceTree = ""; }; 5142E39729D377F000A206F0 /* MTROTAProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTROTAProviderTests.m; sourceTree = ""; }; 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "generic-callback-stubs.cpp"; path = "util/generic-callback-stubs.cpp"; sourceTree = ""; }; - 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRIMDispatch.mm; sourceTree = ""; }; - 51431AFA27D29CA4008A7943 /* ota-provider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ota-provider.cpp"; path = "clusters/ota-provider/ota-provider.cpp"; sourceTree = ""; }; 5143851C2A65885400EDC8E6 /* MatterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MatterTests-Bridging-Header.h"; sourceTree = ""; }; 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTRSwiftPairingTests.swift; sourceTree = ""; }; 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDemuxingStorage.mm; sourceTree = ""; }; @@ -544,8 +533,6 @@ 51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRFabricInfoChecker.m; sourceTree = ""; }; 51C984612A61CE2A00B0AD9A /* MTRFabricInfoChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRFabricInfoChecker.h; sourceTree = ""; }; 51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRTestStorage.m; sourceTree = ""; }; - 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRControllerAccessControl.h; sourceTree = ""; }; - 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRControllerAccessControl.mm; sourceTree = ""; }; 51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRErrorTestUtils.mm; sourceTree = ""; }; 51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseClusterUtils.h; sourceTree = ""; }; 51E51FBC282AD37A00FC978D /* MTRDeviceControllerStartupParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerStartupParams.h; sourceTree = ""; }; @@ -965,8 +952,6 @@ isa = PBXGroup; children = ( 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */, - 51431AFA27D29CA4008A7943 /* ota-provider.cpp */, - 3D84374A29498BAE0070D20A /* privilege-storage.cpp */, ); name = app; path = ../../../app; @@ -1137,8 +1122,6 @@ 5A60370727EA1FF60020DB79 /* MTRClusterStateCacheContainer+XPC.h */, 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */, 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */, - 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */, - 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */, 3DFCB32B29678C9500332B35 /* MTRConversion.h */, 51565CAD2A79D42100469F18 /* MTRConversion.mm */, 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */, @@ -1186,7 +1169,6 @@ 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */, 515C1C6E284F9FFB00A48F0C /* MTRFramework.h */, 515C1C6D284F9FFB00A48F0C /* MTRFramework.mm */, - 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */, 998F286C26D55E10001846C6 /* MTRKeypair.h */, 3DECCB6F2934AC1C00585AEC /* MTRLogging.h */, 991DC08A247704DC00C13860 /* MTRLogging_Internal.h */, @@ -1465,7 +1447,6 @@ 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */, 511913FC28C100EF009235E9 /* MTRBaseSubscriptionCallback.h in Headers */, - 51E0310027EA20D20083DC9C /* MTRControllerAccessControl.h in Headers */, 51565CB12A7AD77600469F18 /* MTRDeviceControllerDataStore.h in Headers */, 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */, 991DC08B247704DC00C13860 /* MTRLogging_Internal.h in Headers */, @@ -1647,8 +1628,6 @@ B45373EF2A9FEBFE00807602 /* ops-raw-skt.c in Sources */, 037C3DD52991C2E200B7EEE2 /* CHIPCommandBridge.mm in Sources */, 039546BC2991E1CB006D42A8 /* LogCommands.cpp in Sources */, - 039547042992D9BF006D42A8 /* ota-provider.cpp in Sources */, - 039547022992D952006D42A8 /* privilege-storage.cpp in Sources */, B45373E12A9FEB7F00807602 /* ops-h1.c in Sources */, B45373EB2A9FEBDB00807602 /* ops-listen.c in Sources */, 0382FA2C2992F06C00247BBB /* Commands.cpp in Sources */, @@ -1660,7 +1639,6 @@ B45373E62A9FEBA400807602 /* header.c in Sources */, B45374002A9FEC4F00807602 /* unix-init.c in Sources */, B45373DF2A9FEB6F00807602 /* system.c in Sources */, - 039547032992D991006D42A8 /* MTRIMDispatch.mm in Sources */, 039546BD2991E1CB006D42A8 /* SystemCommands.cpp in Sources */, B45373FC2A9FEC4F00807602 /* unix-caps.c in Sources */, B4E262162AA0CF1C00DBA5BC /* RemoteDataModelLogger.mm in Sources */, @@ -1722,7 +1700,6 @@ 51B22C2A2740CB47008D5055 /* MTRCommandPayloadsObjc.mm in Sources */, 75B765C32A1D82D30014719B /* MTRAttributeSpecifiedCheck.mm in Sources */, AF5F90FF2878D351005503FA /* MTROTAProviderDelegateBridge.mm in Sources */, - 3D84374B29498BAE0070D20A /* privilege-storage.cpp in Sources */, 51E95DFC2A78443C00A434F0 /* MTRSessionResumptionStorageBridge.mm in Sources */, 7534F12828BFF20300390851 /* MTRDeviceAttestationDelegate.mm in Sources */, 2C5EEEF7268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm in Sources */, @@ -1736,7 +1713,6 @@ 1EDCE546289049A100E41EC9 /* MTROTAHeader.mm in Sources */, 1EC4CE5D25CC26E900D7304F /* MTRBaseClusters.mm in Sources */, 51565CB22A7AD77600469F18 /* MTRDeviceControllerDataStore.mm in Sources */, - 51E0310127EA20D20083DC9C /* MTRControllerAccessControl.mm in Sources */, 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* MTRError.mm in Sources */, 51E51FC1282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm in Sources */, @@ -1764,9 +1740,7 @@ 88EBF8CF27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm in Sources */, 5A6FEC9827B5C6AF00F25F42 /* MTRDeviceOverXPC.mm in Sources */, 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */, - 51431AF927D2973E008A7943 /* MTRIMDispatch.mm in Sources */, 1E4D655229C30A8700BC3478 /* MTRCommissionableBrowser.mm in Sources */, - 51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */, 3DECCB722934AFE200585AEC /* MTRLogging.mm in Sources */, 7596A84528762729004DAE0E /* MTRDevice.mm in Sources */, ); diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index 120496c146e2c0..54e3594dfda2a2 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -93,6 +93,7 @@ done declare -a args=( 'default_configs_cosmetic=[]' # suppress colorization 'chip_crypto="boringssl"' + 'chip_build_controller_dynamic_server=true' 'chip_build_tools=false' 'chip_build_tests=false' 'chip_enable_wifi=false'