From 6a362560d9183e69ad55f7d2dfb125a4e92a8111 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Wed, 11 Aug 2021 14:48:53 -0700 Subject: [PATCH] Use node ID provided in the NOC (#8826) * Use node ID and fabric ID provided in the NOC * update CHIPTool for modified opcreds cluster * remove more checks for NodeID * split cluster changes from the current PR * rename functions and variables * address review comments * Fix build issues --- examples/all-clusters-app/esp32/main/main.cpp | 4 +- examples/lighting-app/k32w/main/AppTask.cpp | 4 +- .../lighting-app/nrfconnect/main/AppTask.cpp | 6 +- examples/lighting-app/qpg/src/AppTask.cpp | 2 +- examples/lighting-app/telink/src/AppTask.cpp | 3 +- .../lock-app/cc13x2x7_26x2x7/main/AppTask.cpp | 4 +- examples/lock-app/k32w/main/AppTask.cpp | 4 +- examples/lock-app/nrfconnect/main/AppTask.cpp | 6 +- examples/lock-app/qpg/src/AppTask.cpp | 2 +- .../pump-app/cc13x2x7_26x2x7/main/AppTask.cpp | 4 +- examples/pump-app/nrfconnect/main/AppTask.cpp | 6 +- .../cc13x2x7_26x2x7/main/AppTask.cpp | 4 +- .../nrfconnect/main/AppTask.cpp | 6 +- examples/shell/shell_common/cmd_ping.cpp | 5 - examples/shell/shell_common/cmd_send.cpp | 4 - .../thermostat-common/gen/callback.h | 4901 ----------------- .../administrator-commissioning-server.cpp | 4 +- .../operational-credentials-server.cpp | 196 +- src/app/server/RendezvousServer.cpp | 28 +- src/app/server/RendezvousServer.h | 10 +- src/app/server/Server.cpp | 179 +- src/app/server/Server.h | 13 +- src/app/tests/TestCommandInteraction.cpp | 3 - src/app/tests/TestEventLogging.cpp | 4 - src/app/tests/TestInteractionModelEngine.cpp | 4 - src/app/tests/TestReportingEngine.cpp | 4 - .../tests/integration/chip_im_initiator.cpp | 2 - .../tests/integration/chip_im_responder.cpp | 3 - src/controller/CHIPDeviceController.cpp | 115 +- src/controller/CHIPDeviceController.h | 8 +- src/crypto/CHIPCryptoPAL.cpp | 8 +- .../Fabric/FabricUIViewController.m | 31 - .../QRCode/QRCodeViewController.m | 10 - src/messaging/ExchangeContext.cpp | 5 - src/messaging/tests/MessagingContext.cpp | 6 - src/messaging/tests/MessagingContext.h | 2 +- src/messaging/tests/echo/echo_requester.cpp | 4 - src/messaging/tests/echo/echo_responder.cpp | 4 - src/protocols/secure_channel/CASEServer.cpp | 9 +- src/protocols/secure_channel/CASESession.cpp | 13 - src/protocols/secure_channel/tests/BUILD.gn | 4 +- .../secure_channel/tests/TestCASESession.cpp | 21 +- src/transport/FabricTable.cpp | 194 +- src/transport/FabricTable.h | 98 +- src/transport/SecureMessageCodec.cpp | 12 +- src/transport/SecureMessageCodec.h | 5 +- src/transport/SecureSessionHandle.h | 2 +- src/transport/SecureSessionMgr.cpp | 93 +- src/transport/tests/TestSecureSessionMgr.cpp | 64 - 49 files changed, 398 insertions(+), 5725 deletions(-) delete mode 100644 examples/thermostat/thermostat-common/gen/callback.h diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 9bc3c04e82d805..16e63f7fad2c8a 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -343,7 +343,7 @@ class SetupListModel : public ListScreen::Model if (i == 0) { ConnectivityMgr().ClearWiFiStationProvision(); - OpenDefaultPairingWindow(ResetFabrics::kYes); + OpenBasicCommissioningWindow(ResetFabrics::kYes); } else if (i == 1) { @@ -352,7 +352,7 @@ class SetupListModel : public ListScreen::Model else if (i == 2) { app::Mdns::AdvertiseCommissionableNode(); - OpenDefaultPairingWindow(ResetFabrics::kYes, kNoCommissioningTimeout, PairingWindowAdvertisement::kMdns); + OpenBasicCommissioningWindow(ResetFabrics::kYes, kNoCommissioningTimeout, PairingWindowAdvertisement::kMdns); } } diff --git a/examples/lighting-app/k32w/main/AppTask.cpp b/examples/lighting-app/k32w/main/AppTask.cpp index b05671e9709377..4f800fef20c25b 100644 --- a/examples/lighting-app/k32w/main/AppTask.cpp +++ b/examples/lighting-app/k32w/main/AppTask.cpp @@ -483,13 +483,13 @@ void AppTask::BleHandler(AppEvent * aEvent) { ConnectivityMgr().SetBLEAdvertisingEnabled(true); - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { K32W_LOG("Started BLE Advertising!"); } else { - K32W_LOG("OpenDefaultPairingWindow() failed"); + K32W_LOG("OpenBasicCommissioningWindow() failed"); } } } diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 760ca6f7b3fcc8..215d4647e83945 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -345,7 +345,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (AddTestPairing() != CHIP_NO_ERROR) + if (AddTestCommissioning() != CHIP_NO_ERROR) { LOG_ERR("Failed to add test pairing"); } @@ -379,13 +379,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { LOG_INF("Enabled BLE Advertisement"); } else { - LOG_ERR("OpenDefaultPairingWindow() failed"); + LOG_ERR("OpenBasicCommissioningWindow() failed"); } } diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index 6dfc26b0b6e8f9..cd4b4c009981d7 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -103,7 +103,7 @@ CHIP_ERROR AppTask::Init() PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); // Enable BLE advertisements - OpenDefaultPairingWindow(chip::ResetFabrics::kNo); + OpenBasicCommissioningWindow(chip::ResetFabrics::kNo); ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); return err; diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index de3acec9bb948a..39a42c65052895 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -99,8 +99,7 @@ CHIP_ERROR AppTask::Init() ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - // Setup test pairing - ret = AddTestPairing(); + ret = AddTestCommissioning(); if (ret != CHIP_NO_ERROR) { LOG_ERR("Failed to add test pairing"); diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 71b18d51e0eb59..2cea346aaa697e 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -326,13 +326,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent) // Enable BLE advertisements if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) { - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { PLAT_LOG("Enabled BLE Advertisement"); } else { - PLAT_LOG("OpenDefaultPairingWindow() failed"); + PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } } diff --git a/examples/lock-app/k32w/main/AppTask.cpp b/examples/lock-app/k32w/main/AppTask.cpp index 8ae6838cf4a320..3cb194df97613b 100644 --- a/examples/lock-app/k32w/main/AppTask.cpp +++ b/examples/lock-app/k32w/main/AppTask.cpp @@ -487,13 +487,13 @@ void AppTask::BleHandler(AppEvent * aEvent) { ConnectivityMgr().SetBLEAdvertisingEnabled(true); - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { K32W_LOG("Started BLE Advertising!"); } else { - K32W_LOG("OpenDefaultPairingWindow() failed"); + K32W_LOG("OpenBasicCommissioningWindow() failed"); } } } diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index b3e724e15f86df..b30df9645b338c 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -345,7 +345,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (AddTestPairing() != CHIP_NO_ERROR) + if (AddTestCommissioning() != CHIP_NO_ERROR) { LOG_ERR("Failed to add test pairing"); } @@ -379,13 +379,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { LOG_INF("Enabled BLE Advertisement"); } else { - LOG_ERR("OpenDefaultPairingWindow() failed"); + LOG_ERR("OpenBasicCommissioningWindow() failed"); } } diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index ad2eb499ae1569..b30659c967f3b5 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -342,7 +342,7 @@ void AppTask::FunctionHandler(AppEvent * aEvent) if (!ConnectivityMgr().IsThreadProvisioned()) { // Enable BLE advertisements and pairing window - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); } diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index ab4a5e31c7d20e..b7923c67dfcf73 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -328,13 +328,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent) // Enable BLE advertisements if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) { - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { PLAT_LOG("Enabled BLE Advertisement"); } else { - PLAT_LOG("OpenDefaultPairingWindow() failed"); + PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } } diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 73c56d2c2fcf6a..240fd7e6d5c008 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -331,7 +331,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (AddTestPairing() != CHIP_NO_ERROR) + if (AddTestCommissioning() != CHIP_NO_ERROR) { LOG_ERR("Failed to add test pairing"); } @@ -364,13 +364,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { LOG_INF("Enabled BLE Advertisement"); } else { - LOG_ERR("OpenDefaultPairingWindow() failed"); + LOG_ERR("OpenBasicCommissioningWindow() failed"); } } diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index ab4a5e31c7d20e..b7923c67dfcf73 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -328,13 +328,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent) // Enable BLE advertisements if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) { - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { PLAT_LOG("Enabled BLE Advertisement"); } else { - PLAT_LOG("OpenDefaultPairingWindow() failed"); + PLAT_LOG("OpenBasicCommissioningWindow() failed"); } } } diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 73c56d2c2fcf6a..240fd7e6d5c008 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -331,7 +331,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (AddTestPairing() != CHIP_NO_ERROR) + if (AddTestCommissioning() != CHIP_NO_ERROR) { LOG_ERR("Failed to add test pairing"); } @@ -364,13 +364,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent) return; } - if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) + if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR) { LOG_INF("Enabled BLE Advertisement"); } else { - LOG_ERR("OpenDefaultPairingWindow() failed"); + LOG_ERR("OpenBasicCommissioningWindow() failed"); } } diff --git a/examples/shell/shell_common/cmd_ping.cpp b/examples/shell/shell_common/cmd_ping.cpp index fe796f84256eb8..ab2aee49259f74 100644 --- a/examples/shell/shell_common/cmd_ping.cpp +++ b/examples/shell/shell_common/cmd_ping.cpp @@ -285,17 +285,12 @@ void StartPinging(streamer_t * stream, char * destination) { CHIP_ERROR err = CHIP_NO_ERROR; - Transport::FabricInfo * fabricInfo = nullptr; - if (!IPAddress::FromString(destination, gDestAddr)) { streamer_printf(stream, "Invalid Echo Server IP address: %s\n", destination); ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); } - fabricInfo = gFabrics.AssignFabricIndex(gFabricIndex, kTestControllerNodeId); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); - #if INET_CONFIG_ENABLE_TCP_ENDPOINT err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer) .SetAddressType(gDestAddr.Type()) diff --git a/examples/shell/shell_common/cmd_send.cpp b/examples/shell/shell_common/cmd_send.cpp index f45b744df47c41..54000cbcb5ac17 100644 --- a/examples/shell/shell_common/cmd_send.cpp +++ b/examples/shell/shell_common/cmd_send.cpp @@ -203,7 +203,6 @@ void ProcessCommand(streamer_t * stream, char * destination) Transport::FabricTable fabrics; Transport::PeerAddress peerAddress; - Transport::FabricInfo * fabricInfo = nullptr; if (!chip::Inet::IPAddress::FromString(destination, gDestAddr)) { @@ -211,9 +210,6 @@ void ProcessCommand(streamer_t * stream, char * destination) ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); } - fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, kTestControllerNodeId); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); - #if INET_CONFIG_ENABLE_TCP_ENDPOINT err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer) .SetAddressType(gDestAddr.Type()) diff --git a/examples/thermostat/thermostat-common/gen/callback.h b/examples/thermostat/thermostat-common/gen/callback.h deleted file mode 100644 index b2749f5a762a4f..00000000000000 --- a/examples/thermostat/thermostat-common/gen/callback.h +++ /dev/null @@ -1,4901 +0,0 @@ -/* - * - * Copyright (c) 2021 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. - * 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. - */ - -// THIS FILE IS GENERATED BY ZAP - -// Prevent multiple inclusion -#pragma once - -#include -#include -#include - -#include -#include - -/** @brief Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - */ -void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clusterId); - -// Cluster Init Functions - -/** @brief Account Login Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfAccountLoginClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Application Basic Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfApplicationBasicClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Application Launcher Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfApplicationLauncherClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Audio Output Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfAudioOutputClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Barrier Control Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBarrierControlClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Basic Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBasicClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Binary Input (Basic) Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBinaryInputBasicClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Binding Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBindingClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Bridged Device Basic Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBridgedDeviceBasicClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Color Control Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Content Launcher Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfContentLauncherClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Descriptor Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDescriptorClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Diagnostic Logs Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDiagnosticLogsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Door Lock Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Ethernet Network Diagnostics Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfEthernetNetworkDiagnosticsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Fixed Label Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfFixedLabelClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Flow Measurement Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfFlowMeasurementClusterInitCallback(chip::EndpointId endpoint); - -/** @brief General Commissioning Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGeneralCommissioningClusterInitCallback(chip::EndpointId endpoint); - -/** @brief General Diagnostics Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGeneralDiagnosticsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Group Key Management Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGroupKeyManagementClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Groups Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGroupsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief IAS Zone Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfIasZoneClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Identify Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfIdentifyClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Keypad Input Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfKeypadInputClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Level Control Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Low Power Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Media Input Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfMediaInputClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Media Playback Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Network Commissioning Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint); - -/** @brief OTA Software Update Provider Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOtaSoftwareUpdateProviderClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Occupancy Sensing Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOccupancySensingClusterInitCallback(chip::EndpointId endpoint); - -/** @brief On/off Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Operational Credentials Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOperationalCredentialsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Pressure Measurement Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfPressureMeasurementClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Pump Configuration and Control Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfPumpConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Relative Humidity Measurement Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfRelativeHumidityMeasurementClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Scenes Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfScenesClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Software Diagnostics Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfSoftwareDiagnosticsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Switch Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfSwitchClusterInitCallback(chip::EndpointId endpoint); - -/** @brief TV Channel Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTvChannelClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Target Navigator Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTargetNavigatorClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Temperature Measurement Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Test Cluster Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Thermostat Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfThermostatClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Thread Network Diagnostics Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfThreadNetworkDiagnosticsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Wake on LAN Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWakeOnLanClusterInitCallback(chip::EndpointId endpoint); - -/** @brief WiFi Network Diagnostics Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWiFiNetworkDiagnosticsClusterInitCallback(chip::EndpointId endpoint); - -/** @brief Window Covering Cluster Init - * - * Cluster Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint); - -// Cluster Server/Client Init Functions - -// -// Account Login Cluster server -// - -/** @brief Account Login Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfAccountLoginClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Account Login Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfAccountLoginClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Account Login Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfAccountLoginClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Account Login Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfAccountLoginClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Account Login Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfAccountLoginClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Account Login Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfAccountLoginClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Application Basic Cluster server -// - -/** @brief Application Basic Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfApplicationBasicClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Application Basic Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfApplicationBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Application Basic Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfApplicationBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Application Basic Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfApplicationBasicClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Application Basic Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfApplicationBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Application Basic Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfApplicationBasicClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Application Launcher Cluster server -// - -/** @brief Application Launcher Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfApplicationLauncherClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Application Launcher Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfApplicationLauncherClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Application Launcher Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfApplicationLauncherClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Application Launcher Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfApplicationLauncherClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Application Launcher Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfApplicationLauncherClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Application Launcher Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfApplicationLauncherClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Audio Output Cluster server -// - -/** @brief Audio Output Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfAudioOutputClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Audio Output Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfAudioOutputClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Audio Output Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfAudioOutputClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Audio Output Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfAudioOutputClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Audio Output Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfAudioOutputClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Audio Output Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfAudioOutputClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Barrier Control Cluster server -// - -/** @brief Barrier Control Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBarrierControlClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Barrier Control Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfBarrierControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Barrier Control Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfBarrierControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Barrier Control Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfBarrierControlClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Barrier Control Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfBarrierControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Barrier Control Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfBarrierControlClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Basic Cluster server -// - -/** @brief Basic Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Basic Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Basic Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Basic Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfBasicClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Basic Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Basic Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Binary Input (Basic) Cluster server -// - -/** @brief Binary Input (Basic) Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBinaryInputBasicClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Binary Input (Basic) Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfBinaryInputBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Binary Input (Basic) Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfBinaryInputBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Binary Input (Basic) Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfBinaryInputBasicClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Binary Input (Basic) Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfBinaryInputBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Binary Input (Basic) Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfBinaryInputBasicClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Binding Cluster server -// - -/** @brief Binding Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBindingClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Binding Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfBindingClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Binding Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfBindingClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Binding Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfBindingClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Binding Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfBindingClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Binding Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfBindingClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Bridged Device Basic Cluster server -// - -/** @brief Bridged Device Basic Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfBridgedDeviceBasicClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Bridged Device Basic Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfBridgedDeviceBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Bridged Device Basic Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfBridgedDeviceBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Bridged Device Basic Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfBridgedDeviceBasicClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Bridged Device Basic Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfBridgedDeviceBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Bridged Device Basic Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfBridgedDeviceBasicClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Color Control Cluster server -// - -/** @brief Color Control Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfColorControlClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Color Control Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfColorControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Color Control Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfColorControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Color Control Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfColorControlClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Color Control Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfColorControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Color Control Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfColorControlClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Content Launcher Cluster server -// - -/** @brief Content Launcher Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfContentLauncherClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Content Launcher Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfContentLauncherClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Content Launcher Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfContentLauncherClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Content Launcher Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfContentLauncherClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Content Launcher Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfContentLauncherClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Content Launcher Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfContentLauncherClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Descriptor Cluster server -// - -/** @brief Descriptor Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDescriptorClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Descriptor Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfDescriptorClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Descriptor Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfDescriptorClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Descriptor Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfDescriptorClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Descriptor Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfDescriptorClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Descriptor Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfDescriptorClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Diagnostic Logs Cluster server -// - -/** @brief Diagnostic Logs Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDiagnosticLogsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Diagnostic Logs Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfDiagnosticLogsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Diagnostic Logs Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfDiagnosticLogsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Diagnostic Logs Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfDiagnosticLogsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Diagnostic Logs Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfDiagnosticLogsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Diagnostic Logs Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfDiagnosticLogsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Door Lock Cluster server -// - -/** @brief Door Lock Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfDoorLockClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Door Lock Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfDoorLockClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Door Lock Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfDoorLockClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Door Lock Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfDoorLockClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Door Lock Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfDoorLockClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Door Lock Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfDoorLockClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Ethernet Network Diagnostics Cluster server -// - -/** @brief Ethernet Network Diagnostics Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfEthernetNetworkDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Ethernet Network Diagnostics Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfEthernetNetworkDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId); - -/** @brief Ethernet Network Diagnostics Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfEthernetNetworkDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Ethernet Network Diagnostics Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfEthernetNetworkDiagnosticsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Ethernet Network Diagnostics Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfEthernetNetworkDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Ethernet Network Diagnostics Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfEthernetNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Fixed Label Cluster server -// - -/** @brief Fixed Label Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfFixedLabelClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Fixed Label Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfFixedLabelClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Fixed Label Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfFixedLabelClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Fixed Label Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfFixedLabelClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Fixed Label Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfFixedLabelClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Fixed Label Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfFixedLabelClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Flow Measurement Cluster server -// - -/** @brief Flow Measurement Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfFlowMeasurementClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Flow Measurement Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfFlowMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Flow Measurement Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfFlowMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Flow Measurement Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfFlowMeasurementClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Flow Measurement Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfFlowMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Flow Measurement Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfFlowMeasurementClusterServerTickCallback(chip::EndpointId endpoint); - -// -// General Commissioning Cluster server -// - -/** @brief General Commissioning Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGeneralCommissioningClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief General Commissioning Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfGeneralCommissioningClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief General Commissioning Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief General Commissioning Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief General Commissioning Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfGeneralCommissioningClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief General Commissioning Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfGeneralCommissioningClusterServerTickCallback(chip::EndpointId endpoint); - -// -// General Diagnostics Cluster server -// - -/** @brief General Diagnostics Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGeneralDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief General Diagnostics Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfGeneralDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief General Diagnostics Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfGeneralDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief General Diagnostics Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfGeneralDiagnosticsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief General Diagnostics Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfGeneralDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief General Diagnostics Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfGeneralDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Group Key Management Cluster server -// - -/** @brief Group Key Management Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGroupKeyManagementClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Group Key Management Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfGroupKeyManagementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Group Key Management Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfGroupKeyManagementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Group Key Management Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfGroupKeyManagementClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Group Key Management Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfGroupKeyManagementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Group Key Management Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfGroupKeyManagementClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Groups Cluster server -// - -/** @brief Groups Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfGroupsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Groups Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfGroupsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Groups Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfGroupsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Groups Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfGroupsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Groups Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfGroupsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Groups Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfGroupsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// IAS Zone Cluster server -// - -/** @brief IAS Zone Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfIasZoneClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief IAS Zone Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfIasZoneClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief IAS Zone Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfIasZoneClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief IAS Zone Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfIasZoneClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief IAS Zone Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfIasZoneClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief IAS Zone Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfIasZoneClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Identify Cluster server -// - -/** @brief Identify Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfIdentifyClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Identify Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfIdentifyClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Identify Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfIdentifyClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Identify Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfIdentifyClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Identify Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfIdentifyClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Identify Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfIdentifyClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Keypad Input Cluster server -// - -/** @brief Keypad Input Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfKeypadInputClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Keypad Input Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfKeypadInputClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Keypad Input Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfKeypadInputClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Keypad Input Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfKeypadInputClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Keypad Input Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfKeypadInputClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Keypad Input Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfKeypadInputClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Level Control Cluster server -// - -/** @brief Level Control Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfLevelControlClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Level Control Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfLevelControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Level Control Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Level Control Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfLevelControlClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Level Control Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfLevelControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Level Control Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfLevelControlClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Low Power Cluster server -// - -/** @brief Low Power Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfLowPowerClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Low Power Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfLowPowerClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Low Power Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfLowPowerClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Low Power Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfLowPowerClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Low Power Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfLowPowerClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Low Power Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfLowPowerClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Media Input Cluster server -// - -/** @brief Media Input Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfMediaInputClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Media Input Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfMediaInputClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Media Input Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfMediaInputClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Media Input Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfMediaInputClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Media Input Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfMediaInputClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Media Input Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfMediaInputClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Media Playback Cluster server -// - -/** @brief Media Playback Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfMediaPlaybackClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Media Playback Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfMediaPlaybackClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Media Playback Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfMediaPlaybackClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Media Playback Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfMediaPlaybackClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Media Playback Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfMediaPlaybackClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Media Playback Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfMediaPlaybackClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Network Commissioning Cluster server -// - -/** @brief Network Commissioning Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfNetworkCommissioningClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Network Commissioning Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfNetworkCommissioningClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Network Commissioning Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Network Commissioning Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Network Commissioning Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfNetworkCommissioningClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Network Commissioning Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfNetworkCommissioningClusterServerTickCallback(chip::EndpointId endpoint); - -// -// OTA Software Update Provider Cluster server -// - -/** @brief OTA Software Update Provider Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOtaSoftwareUpdateProviderClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief OTA Software Update Provider Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfOtaSoftwareUpdateProviderClusterServerAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId); - -/** @brief OTA Software Update Provider Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfOtaSoftwareUpdateProviderClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief OTA Software Update Provider Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfOtaSoftwareUpdateProviderClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief OTA Software Update Provider Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfOtaSoftwareUpdateProviderClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief OTA Software Update Provider Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfOtaSoftwareUpdateProviderClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Occupancy Sensing Cluster server -// - -/** @brief Occupancy Sensing Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOccupancySensingClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Occupancy Sensing Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfOccupancySensingClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Occupancy Sensing Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfOccupancySensingClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Occupancy Sensing Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfOccupancySensingClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Occupancy Sensing Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfOccupancySensingClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Occupancy Sensing Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfOccupancySensingClusterServerTickCallback(chip::EndpointId endpoint); - -// -// On/off Cluster server -// - -/** @brief On/off Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOnOffClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief On/off Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfOnOffClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief On/off Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief On/off Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfOnOffClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief On/off Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfOnOffClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief On/off Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Operational Credentials Cluster server -// - -/** @brief Operational Credentials Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfOperationalCredentialsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Operational Credentials Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfOperationalCredentialsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Operational Credentials Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfOperationalCredentialsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Operational Credentials Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfOperationalCredentialsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Operational Credentials Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfOperationalCredentialsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Operational Credentials Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfOperationalCredentialsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Pressure Measurement Cluster server -// - -/** @brief Pressure Measurement Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfPressureMeasurementClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Pressure Measurement Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfPressureMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Pressure Measurement Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfPressureMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Pressure Measurement Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfPressureMeasurementClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Pressure Measurement Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfPressureMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Pressure Measurement Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfPressureMeasurementClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Pump Configuration and Control Cluster server -// - -/** @brief Pump Configuration and Control Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfPumpConfigurationAndControlClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Pump Configuration and Control Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfPumpConfigurationAndControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId); - -/** @brief Pump Configuration and Control Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfPumpConfigurationAndControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Pump Configuration and Control Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfPumpConfigurationAndControlClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status); - -/** @brief Pump Configuration and Control Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfPumpConfigurationAndControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Pump Configuration and Control Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfPumpConfigurationAndControlClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Relative Humidity Measurement Cluster server -// - -/** @brief Relative Humidity Measurement Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfRelativeHumidityMeasurementClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Relative Humidity Measurement Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfRelativeHumidityMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId); - -/** @brief Relative Humidity Measurement Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfRelativeHumidityMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Relative Humidity Measurement Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfRelativeHumidityMeasurementClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status); - -/** @brief Relative Humidity Measurement Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfRelativeHumidityMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Relative Humidity Measurement Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfRelativeHumidityMeasurementClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Scenes Cluster server -// - -/** @brief Scenes Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfScenesClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Scenes Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfScenesClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Scenes Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfScenesClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Scenes Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfScenesClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Scenes Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfScenesClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Scenes Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfScenesClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Software Diagnostics Cluster server -// - -/** @brief Software Diagnostics Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfSoftwareDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Software Diagnostics Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfSoftwareDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Software Diagnostics Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfSoftwareDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Software Diagnostics Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfSoftwareDiagnosticsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Software Diagnostics Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfSoftwareDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Software Diagnostics Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfSoftwareDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Switch Cluster server -// - -/** @brief Switch Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfSwitchClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Switch Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfSwitchClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Switch Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfSwitchClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Switch Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfSwitchClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Switch Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfSwitchClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Switch Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfSwitchClusterServerTickCallback(chip::EndpointId endpoint); - -// -// TV Channel Cluster server -// - -/** @brief TV Channel Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTvChannelClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief TV Channel Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfTvChannelClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief TV Channel Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfTvChannelClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief TV Channel Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfTvChannelClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief TV Channel Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfTvChannelClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief TV Channel Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfTvChannelClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Target Navigator Cluster server -// - -/** @brief Target Navigator Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTargetNavigatorClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Target Navigator Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfTargetNavigatorClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Target Navigator Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfTargetNavigatorClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Target Navigator Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfTargetNavigatorClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Target Navigator Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfTargetNavigatorClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Target Navigator Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfTargetNavigatorClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Temperature Measurement Cluster server -// - -/** @brief Temperature Measurement Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTemperatureMeasurementClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Temperature Measurement Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfTemperatureMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Temperature Measurement Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Temperature Measurement Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Temperature Measurement Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfTemperatureMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Temperature Measurement Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfTemperatureMeasurementClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Test Cluster Cluster server -// - -/** @brief Test Cluster Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfTestClusterClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Test Cluster Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfTestClusterClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Test Cluster Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfTestClusterClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Test Cluster Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfTestClusterClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Test Cluster Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfTestClusterClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Test Cluster Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfTestClusterClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Thermostat Cluster server -// - -/** @brief Thermostat Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Thermostat Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfThermostatClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Thermostat Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfThermostatClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Thermostat Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfThermostatClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Thermostat Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfThermostatClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Thermostat Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfThermostatClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Thread Network Diagnostics Cluster server -// - -/** @brief Thread Network Diagnostics Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfThreadNetworkDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Thread Network Diagnostics Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfThreadNetworkDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Thread Network Diagnostics Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfThreadNetworkDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Thread Network Diagnostics Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfThreadNetworkDiagnosticsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Thread Network Diagnostics Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfThreadNetworkDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief Thread Network Diagnostics Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfThreadNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Wake on LAN Cluster server -// - -/** @brief Wake on LAN Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWakeOnLanClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Wake on LAN Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfWakeOnLanClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Wake on LAN Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfWakeOnLanClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Wake on LAN Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfWakeOnLanClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, - uint16_t msgLen, uint8_t * message, EmberStatus status); - -/** @brief Wake on LAN Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfWakeOnLanClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Wake on LAN Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfWakeOnLanClusterServerTickCallback(chip::EndpointId endpoint); - -// -// WiFi Network Diagnostics Cluster server -// - -/** @brief WiFi Network Diagnostics Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWiFiNetworkDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief WiFi Network Diagnostics Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfWiFiNetworkDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief WiFi Network Diagnostics Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfWiFiNetworkDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief WiFi Network Diagnostics Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfWiFiNetworkDiagnosticsClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief WiFi Network Diagnostics Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfWiFiNetworkDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, - uint16_t size, uint8_t * value); - -/** @brief WiFi Network Diagnostics Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfWiFiNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); - -// -// Window Covering Cluster server -// - -/** @brief Window Covering Cluster Server Init - * - * Server Init - * - * @param endpoint Endpoint that is being initialized - */ -void emberAfWindowCoveringClusterServerInitCallback(chip::EndpointId endpoint); - -/** @brief Window Covering Cluster Server Attribute Changed - * - * Server Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - */ -void emberAfWindowCoveringClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); - -/** @brief Window Covering Cluster Server Manufacturer Specific Attribute Changed - * - * Server Manufacturer Specific Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute that changed - * @param manufacturerCode Manufacturer Code of the attribute that changed - */ -void emberAfWindowCoveringClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - uint16_t manufacturerCode); - -/** @brief Window Covering Cluster Server Message Sent - * - * Server Message Sent - * - * @param type The type of message sent - * @param destination The destination to which the message was sent - * @param apsFrame The APS frame for the message - * @param msgLen The length of the message - * @param message The message that was sent - * @param status The status of the sent message - */ -void emberAfWindowCoveringClusterServerMessageSentCallback(const chip::MessageSendDestination & destination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); - -/** @brief Window Covering Cluster Server Pre Attribute Changed - * - * server Pre Attribute Changed - * - * @param endpoint Endpoint that is being initialized - * @param attributeId Attribute to be changed - * @param attributeType Attribute type - * @param size Attribute size - * @param value Attribute value - */ -EmberAfStatus emberAfWindowCoveringClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, - chip::AttributeId attributeId, - EmberAfAttributeType attributeType, uint16_t size, - uint8_t * value); - -/** @brief Window Covering Cluster Server Tick - * - * server Tick - * - * @param endpoint Endpoint that is being served - */ -void emberAfWindowCoveringClusterServerTickCallback(chip::EndpointId endpoint); - -// Cluster Commands Callback - -/** - * @brief Barrier Control Cluster BarrierControlGoToPercent Command callback - */ - -bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(chip::app::Command * commandObj, uint8_t percentOpen); - -/** - * @brief Barrier Control Cluster BarrierControlStop Command callback - */ - -bool emberAfBarrierControlClusterBarrierControlStopCallback(chip::app::Command * commandObj); - -/** - * @brief Basic Cluster MfgSpecificPing Command callback - */ - -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj); - -/** - * @brief Binding Cluster Bind Command callback - */ - -bool emberAfBindingClusterBindCallback(chip::app::Command * commandObj, chip::NodeId nodeId, chip::GroupId groupId, - chip::EndpointId endpointId, chip::ClusterId clusterId); - -/** - * @brief Binding Cluster Unbind Command callback - */ - -bool emberAfBindingClusterUnbindCallback(chip::app::Command * commandObj, chip::NodeId nodeId, chip::GroupId groupId, - chip::EndpointId endpointId, chip::ClusterId clusterId); - -/** - * @brief Color Control Cluster MoveColor Command callback - */ - -bool emberAfColorControlClusterMoveColorCallback(chip::app::Command * commandObj, int16_t rateX, int16_t rateY, uint8_t optionsMask, - uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveColorTemperature Command callback - */ - -bool emberAfColorControlClusterMoveColorTemperatureCallback(chip::app::Command * commandObj, uint8_t moveMode, uint16_t rate, - uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, - uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveHue Command callback - */ - -bool emberAfColorControlClusterMoveHueCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, - uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveSaturation Command callback - */ - -bool emberAfColorControlClusterMoveSaturationCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate, - uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveToColor Command callback - */ - -bool emberAfColorControlClusterMoveToColorCallback(chip::app::Command * commandObj, uint16_t colorX, uint16_t colorY, - uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveToColorTemperature Command callback - */ - -bool emberAfColorControlClusterMoveToColorTemperatureCallback(chip::app::Command * commandObj, uint16_t colorTemperature, - uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveToHue Command callback - */ - -bool emberAfColorControlClusterMoveToHueCallback(chip::app::Command * commandObj, uint8_t hue, uint8_t direction, - uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveToHueAndSaturation Command callback - */ - -bool emberAfColorControlClusterMoveToHueAndSaturationCallback(chip::app::Command * commandObj, uint8_t hue, uint8_t saturation, - uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride); - -/** - * @brief Color Control Cluster MoveToSaturation Command callback - */ - -bool emberAfColorControlClusterMoveToSaturationCallback(chip::app::Command * commandObj, uint8_t saturation, - uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster StepColor Command callback - */ - -bool emberAfColorControlClusterStepColorCallback(chip::app::Command * commandObj, int16_t stepX, int16_t stepY, - uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster StepColorTemperature Command callback - */ - -bool emberAfColorControlClusterStepColorTemperatureCallback(chip::app::Command * commandObj, uint8_t stepMode, uint16_t stepSize, - uint16_t transitionTime, uint16_t colorTemperatureMinimum, - uint16_t colorTemperatureMaximum, uint8_t optionsMask, - uint8_t optionsOverride); - -/** - * @brief Color Control Cluster StepHue Command callback - */ - -bool emberAfColorControlClusterStepHueCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, - uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster StepSaturation Command callback - */ - -bool emberAfColorControlClusterStepSaturationCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, - uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Color Control Cluster StopMoveStep Command callback - */ - -bool emberAfColorControlClusterStopMoveStepCallback(chip::app::Command * commandObj, uint8_t optionsMask, uint8_t optionsOverride); - -/** - * @brief Diagnostic Logs Cluster RetrieveLogsRequest Command callback - */ - -bool emberAfDiagnosticLogsClusterRetrieveLogsRequestCallback(chip::app::Command * commandObj, uint8_t intent, - uint8_t requestedProtocol, chip::ByteSpan transferFileDesignator); - -/** - * @brief Door Lock Cluster ClearAllPins Command callback - */ - -bool emberAfDoorLockClusterClearAllPinsCallback(chip::app::Command * commandObj); - -/** - * @brief Door Lock Cluster ClearAllRfids Command callback - */ - -bool emberAfDoorLockClusterClearAllRfidsCallback(chip::app::Command * commandObj); - -/** - * @brief Door Lock Cluster ClearHolidaySchedule Command callback - */ - -bool emberAfDoorLockClusterClearHolidayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId); - -/** - * @brief Door Lock Cluster ClearPin Command callback - */ - -bool emberAfDoorLockClusterClearPinCallback(chip::app::Command * commandObj, uint16_t userId); - -/** - * @brief Door Lock Cluster ClearRfid Command callback - */ - -bool emberAfDoorLockClusterClearRfidCallback(chip::app::Command * commandObj, uint16_t userId); - -/** - * @brief Door Lock Cluster ClearWeekdaySchedule Command callback - */ - -bool emberAfDoorLockClusterClearWeekdayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId); - -/** - * @brief Door Lock Cluster ClearYeardaySchedule Command callback - */ - -bool emberAfDoorLockClusterClearYeardayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId); - -/** - * @brief Door Lock Cluster GetHolidaySchedule Command callback - */ - -bool emberAfDoorLockClusterGetHolidayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId); - -/** - * @brief Door Lock Cluster GetLogRecord Command callback - */ - -bool emberAfDoorLockClusterGetLogRecordCallback(chip::app::Command * commandObj, uint16_t logIndex); - -/** - * @brief Door Lock Cluster GetPin Command callback - */ - -bool emberAfDoorLockClusterGetPinCallback(chip::app::Command * commandObj, uint16_t userId); - -/** - * @brief Door Lock Cluster GetRfid Command callback - */ - -bool emberAfDoorLockClusterGetRfidCallback(chip::app::Command * commandObj, uint16_t userId); - -/** - * @brief Door Lock Cluster GetUserType Command callback - */ - -bool emberAfDoorLockClusterGetUserTypeCallback(chip::app::Command * commandObj, uint16_t userId); - -/** - * @brief Door Lock Cluster GetWeekdaySchedule Command callback - */ - -bool emberAfDoorLockClusterGetWeekdayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId); - -/** - * @brief Door Lock Cluster GetYeardaySchedule Command callback - */ - -bool emberAfDoorLockClusterGetYeardayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId); - -/** - * @brief Door Lock Cluster LockDoor Command callback - */ - -bool emberAfDoorLockClusterLockDoorCallback(chip::app::Command * commandObj, uint8_t * PIN); - -/** - * @brief Door Lock Cluster SetHolidaySchedule Command callback - */ - -bool emberAfDoorLockClusterSetHolidayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint32_t localStartTime, - uint32_t localEndTime, uint8_t operatingModeDuringHoliday); - -/** - * @brief Door Lock Cluster SetPin Command callback - */ - -bool emberAfDoorLockClusterSetPinCallback(chip::app::Command * commandObj, uint16_t userId, uint8_t userStatus, uint8_t userType, - uint8_t * pin); - -/** - * @brief Door Lock Cluster SetRfid Command callback - */ - -bool emberAfDoorLockClusterSetRfidCallback(chip::app::Command * commandObj, uint16_t userId, uint8_t userStatus, uint8_t userType, - uint8_t * id); - -/** - * @brief Door Lock Cluster SetUserType Command callback - */ - -bool emberAfDoorLockClusterSetUserTypeCallback(chip::app::Command * commandObj, uint16_t userId, uint8_t userType); - -/** - * @brief Door Lock Cluster SetWeekdaySchedule Command callback - */ - -bool emberAfDoorLockClusterSetWeekdayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId, - uint8_t daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, - uint8_t endMinute); - -/** - * @brief Door Lock Cluster SetYeardaySchedule Command callback - */ - -bool emberAfDoorLockClusterSetYeardayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId, - uint32_t localStartTime, uint32_t localEndTime); - -/** - * @brief Door Lock Cluster UnlockDoor Command callback - */ - -bool emberAfDoorLockClusterUnlockDoorCallback(chip::app::Command * commandObj, uint8_t * PIN); - -/** - * @brief Door Lock Cluster UnlockWithTimeout Command callback - */ - -bool emberAfDoorLockClusterUnlockWithTimeoutCallback(chip::app::Command * commandObj, uint16_t timeoutInSeconds, uint8_t * pin); - -/** - * @brief General Commissioning Cluster ArmFailSafe Command callback - */ - -bool emberAfGeneralCommissioningClusterArmFailSafeCallback(chip::app::Command * commandObj, uint16_t expiryLengthSeconds, - uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief General Commissioning Cluster CommissioningComplete Command callback - */ - -bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(chip::app::Command * commandObj); - -/** - * @brief General Commissioning Cluster SetRegulatoryConfig Command callback - */ - -bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(chip::app::Command * commandObj, uint8_t location, - uint8_t * countryCode, uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Groups Cluster AddGroup Command callback - */ - -bool emberAfGroupsClusterAddGroupCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t * groupName); - -/** - * @brief Groups Cluster AddGroupIfIdentifying Command callback - */ - -bool emberAfGroupsClusterAddGroupIfIdentifyingCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t * groupName); - -/** - * @brief Groups Cluster GetGroupMembership Command callback - */ - -bool emberAfGroupsClusterGetGroupMembershipCallback(chip::app::Command * commandObj, uint8_t groupCount, - /* TYPE WARNING: array array defaults to */ uint8_t * groupList); - -/** - * @brief Groups Cluster RemoveAllGroups Command callback - */ - -bool emberAfGroupsClusterRemoveAllGroupsCallback(chip::app::Command * commandObj); - -/** - * @brief Groups Cluster RemoveGroup Command callback - */ - -bool emberAfGroupsClusterRemoveGroupCallback(chip::app::Command * commandObj, uint16_t groupId); - -/** - * @brief Groups Cluster ViewGroup Command callback - */ - -bool emberAfGroupsClusterViewGroupCallback(chip::app::Command * commandObj, uint16_t groupId); - -/** - * @brief IAS Zone Cluster ZoneEnrollResponse Command callback - */ - -bool emberAfIasZoneClusterZoneEnrollResponseCallback(chip::app::Command * commandObj, uint8_t enrollResponseCode, uint8_t zoneId); - -/** - * @brief Identify Cluster Identify Command callback - */ - -bool emberAfIdentifyClusterIdentifyCallback(chip::app::Command * commandObj, uint16_t identifyTime); - -/** - * @brief Identify Cluster IdentifyQuery Command callback - */ - -bool emberAfIdentifyClusterIdentifyQueryCallback(chip::app::Command * commandObj); - -/** - * @brief Level Control Cluster Move Command callback - */ - -bool emberAfLevelControlClusterMoveCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate, uint8_t optionMask, - uint8_t optionOverride); - -/** - * @brief Level Control Cluster MoveToLevel Command callback - */ - -bool emberAfLevelControlClusterMoveToLevelCallback(chip::app::Command * commandObj, uint8_t level, uint16_t transitionTime, - uint8_t optionMask, uint8_t optionOverride); - -/** - * @brief Level Control Cluster MoveToLevelWithOnOff Command callback - */ - -bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(chip::app::Command * commandObj, uint8_t level, - uint16_t transitionTime); - -/** - * @brief Level Control Cluster MoveWithOnOff Command callback - */ - -bool emberAfLevelControlClusterMoveWithOnOffCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate); - -/** - * @brief Level Control Cluster Step Command callback - */ - -bool emberAfLevelControlClusterStepCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, - uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride); - -/** - * @brief Level Control Cluster StepWithOnOff Command callback - */ - -bool emberAfLevelControlClusterStepWithOnOffCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, - uint16_t transitionTime); - -/** - * @brief Level Control Cluster Stop Command callback - */ - -bool emberAfLevelControlClusterStopCallback(chip::app::Command * commandObj, uint8_t optionMask, uint8_t optionOverride); - -/** - * @brief Level Control Cluster StopWithOnOff Command callback - */ - -bool emberAfLevelControlClusterStopWithOnOffCallback(chip::app::Command * commandObj); - -/** - * @brief Low Power Cluster Sleep Command callback - */ - -bool emberAfLowPowerClusterSleepCallback(chip::app::Command * commandObj); - -/** - * @brief Network Commissioning Cluster AddThreadNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan operationalDataset, - uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster AddWiFiNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan ssid, - chip::ByteSpan credentials, uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster DisableNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterDisableNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan networkID, - uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster EnableNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterEnableNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan networkID, - uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster GetLastNetworkCommissioningResult Command callback - */ - -bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(chip::app::Command * commandObj, - uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster RemoveNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan NetworkID, - uint64_t Breadcrumb, uint32_t TimeoutMs); - -/** - * @brief Network Commissioning Cluster ScanNetworks Command callback - */ - -bool emberAfNetworkCommissioningClusterScanNetworksCallback(chip::app::Command * commandObj, chip::ByteSpan ssid, - uint64_t breadcrumb, uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster UpdateThreadNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(chip::app::Command * commandObj, - chip::ByteSpan operationalDataset, uint64_t breadcrumb, - uint32_t timeoutMs); - -/** - * @brief Network Commissioning Cluster UpdateWiFiNetwork Command callback - */ - -bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(chip::app::Command * commandObj, chip::ByteSpan ssid, - chip::ByteSpan credentials, uint64_t breadcrumb, - uint32_t timeoutMs); - -/** - * @brief OTA Software Update Provider Cluster ApplyUpdateRequest Command callback - */ - -bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(chip::app::Command * commandObj, chip::ByteSpan updateToken, - uint32_t newVersion); - -/** - * @brief OTA Software Update Provider Cluster NotifyUpdateApplied Command callback - */ - -bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(chip::app::Command * commandObj, chip::ByteSpan updateToken, - uint32_t currentVersion); - -/** - * @brief OTA Software Update Provider Cluster QueryImage Command callback - */ - -bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback( - chip::app::Command * commandObj, uint16_t vendorId, uint16_t productId, uint16_t imageType, uint16_t hardwareVersion, - uint32_t currentVersion, /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported, uint8_t * location, - uint8_t requestorCanConsent, chip::ByteSpan metadataForProvider); - -/** - * @brief On/off Cluster Off Command callback - */ - -bool emberAfOnOffClusterOffCallback(chip::app::Command * commandObj); - -/** - * @brief On/off Cluster On Command callback - */ - -bool emberAfOnOffClusterOnCallback(chip::app::Command * commandObj); - -/** - * @brief On/off Cluster Toggle Command callback - */ - -bool emberAfOnOffClusterToggleCallback(chip::app::Command * commandObj); - -/** - * @brief Operational Credentials Cluster AddOpCert Command callback - */ - -bool emberAfOperationalCredentialsClusterAddOpCertCallback(chip::app::Command * commandObj, chip::ByteSpan NOCArray, - chip::ByteSpan IPKValue, chip::NodeId CaseAdminNode, - uint16_t AdminVendorId); - -/** - * @brief Operational Credentials Cluster AddTrustedRootCertificate Command callback - */ - -bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback(chip::app::Command * commandObj, - chip::ByteSpan RootCertificate); - -/** - * @brief Operational Credentials Cluster OpCSRRequest Command callback - */ - -bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(chip::app::Command * commandObj, chip::ByteSpan CSRNonce); - -/** - * @brief Operational Credentials Cluster RemoveAllFabrics Command callback - */ - -bool emberAfOperationalCredentialsClusterRemoveAllFabricsCallback(chip::app::Command * commandObj); - -/** - * @brief Operational Credentials Cluster RemoveFabric Command callback - */ - -bool emberAfOperationalCredentialsClusterRemoveFabricCallback(chip::app::Command * commandObj, chip::FabricId FabricId, - chip::NodeId NodeId, uint16_t VendorId); - -/** - * @brief Operational Credentials Cluster RemoveTrustedRootCertificate Command callback - */ - -bool emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback(chip::app::Command * commandObj, - chip::ByteSpan TrustedRootIdentifier); - -/** - * @brief Operational Credentials Cluster SetFabric Command callback - */ - -bool emberAfOperationalCredentialsClusterSetFabricCallback(chip::app::Command * commandObj, uint16_t VendorId); - -/** - * @brief Operational Credentials Cluster UpdateFabricLabel Command callback - */ - -bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(chip::app::Command * commandObj, uint8_t * Label); - -/** - * @brief Scenes Cluster AddScene Command callback - */ - -bool emberAfScenesClusterAddSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId, - uint16_t transitionTime, uint8_t * sceneName, - /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); - -/** - * @brief Scenes Cluster GetSceneMembership Command callback - */ - -bool emberAfScenesClusterGetSceneMembershipCallback(chip::app::Command * commandObj, uint16_t groupId); - -/** - * @brief Scenes Cluster RecallScene Command callback - */ - -bool emberAfScenesClusterRecallSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId, - uint16_t transitionTime); - -/** - * @brief Scenes Cluster RemoveAllScenes Command callback - */ - -bool emberAfScenesClusterRemoveAllScenesCallback(chip::app::Command * commandObj, uint16_t groupId); - -/** - * @brief Scenes Cluster RemoveScene Command callback - */ - -bool emberAfScenesClusterRemoveSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); - -/** - * @brief Scenes Cluster StoreScene Command callback - */ - -bool emberAfScenesClusterStoreSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); - -/** - * @brief Scenes Cluster ViewScene Command callback - */ - -bool emberAfScenesClusterViewSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); - -/** - * @brief Test Cluster Cluster Test Command callback - */ - -bool emberAfTestClusterClusterTestCallback(chip::app::Command * commandObj); - -/** - * @brief Test Cluster Cluster TestNotHandled Command callback - */ - -bool emberAfTestClusterClusterTestNotHandledCallback(chip::app::Command * commandObj); - -/** - * @brief Test Cluster Cluster TestSpecific Command callback - */ - -bool emberAfTestClusterClusterTestSpecificCallback(chip::app::Command * commandObj); - -// -// Non-Cluster Related Callbacks -// - -/** @brief Add To Current App Tasks - * - * This function is only useful to sleepy end devices. This function will note - * the passed item as part of a set of tasks the application has outstanding - * (e.g. message sent requiring APS acknwoledgement). This will affect how the - * application behaves with regard to sleeping and polling. Until the - * outstanding task is completed, the device may poll more frequently and sleep - * less often. - * - * @param tasks Ver.: always - */ -void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks); - -/** @brief Remove From Current App Tasks - * - * This function is only useful to sleepy end devices. This function will - * remove the passed item from the set of tasks the application has outstanding - * (e.g. message sent requiring APS acknwoledgement). This will affect how the - * application behaves with regard to sleeping and polling. Removing the item - * from the list of outstanding tasks may allow the device to sleep longer and - * poll less frequently. If there are other outstanding tasks the system may - * still have to stay away and poll more often. - * - * @param tasks Ver.: always - */ -void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks); - -/** @brief Allow Network Write Attribute - * - * This function is called by the application framework before it writes an - * attribute in response to a write attribute request from an external device. - * The value passed into this callback is the value to which the attribute is to - * be set by the framework. - Example: In mirroring simple metering data - * on an Energy Services Interface (ESI) (formerly called Energy Service Portal - * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only - * attributes on its mirror. The-meter-mirror sample application, located in - * app/framework/sample-apps, uses this callback to allow the mirrored device to - * write simple metering attributes on the mirror regardless of the fact that - * most simple metering attributes are defined as read-only by the ZigBee - * specification. - Note: The ZCL specification does not (as of this - * writing) specify any permission-level security for writing writeable - * attributes. As far as the ZCL specification is concerned, if an attribute is - * writeable, any device that has a link key for the device should be able to - * write that attribute. Furthermore if an attribute is read only, it should not - * be written over the air. Thus, if you implement permissions for writing - * attributes as a feature, you MAY be operating outside the specification. This - * is unlikely to be a problem for writing read-only attributes, but it may be a - * problem for attributes that are writeable according to the specification but - * restricted by the application implementing this callback. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param attributeId Ver.: always - * @param mask Ver.: always - * @param manufacturerCode Ver.: always - * @param value Ver.: always - * @param type Ver.: always - */ -EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - chip::AttributeId attributeId, uint8_t mask, - uint16_t manufacturerCode, uint8_t * value, uint8_t type); - -/** @brief Attribute Read Access - * - * This function is called whenever the Application Framework needs to check - * access permission for an attribute read. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param manufacturerCode Ver.: always - * @param attributeId Ver.: always - */ -bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode, - chip::AttributeId attributeId); - -/** @brief Attribute Write Access - * - * This function is called whenever the Application Framework needs to check - * access permission for an attribute write. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param manufacturerCode Ver.: always - * @param attributeId Ver.: always - */ -bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode, - chip::AttributeId attributeId); - -/** @brief Default Response - * - * This function is called by the application framework when a Default Response - * command is received from an external device. The application should return - * true if the message was processed or false if it was not. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param commandId The command identifier to which this is a response. Ver.: - * always - * @param status Specifies either SUCCESS or the nature of the error that was - * detected in the received command. Ver.: always - */ -bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status); - -/** @brief Configure Reporting Response - * - * This function is called by the application framework when a Configure - * Reporting Response command is received from an external device. The - * application should return true if the message was processed or false if it - * was not. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param buffer Buffer containing the list of attribute status records. Ver.: - * always - * @param bufLen The length in bytes of the list. Ver.: always - */ -bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen); - -/** @brief Read Reporting Configuration Response - * - * This function is called by the application framework when a Read Reporting - * Configuration Response command is received from an external device. The - * application should return true if the message was processed or false if it - * was not. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param buffer Buffer containing the list of attribute reporting configuration - * records. Ver.: always - * @param bufLen The length in bytes of the list. Ver.: always - */ -bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen); - -/** @brief Discover Attributes Response - * - * This function is called by the application framework when a Discover - * Attributes Response or Discover Attributes Extended Response command is - * received from an external device. The Discover Attributes Response command - * contains a bool indicating if discovery is complete and a list of zero or - * more attribute identifier/type records. The final argument indicates whether - * the response is in the extended format or not. The application should return - * true if the message was processed or false if it was not. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param discoveryComplete Indicates whether there are more attributes to be - * discovered. true if there are no more attributes to be discovered. Ver.: - * always - * @param buffer Buffer containing the list of attribute identifier/type - * records. Ver.: always - * @param bufLen The length in bytes of the list. Ver.: always - * @param extended Indicates whether the response is in the extended format or - * not. Ver.: always - */ -bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen, - bool extended); - -/** @brief Discover Commands Generated Response - * - * This function is called by the framework when Discover Commands Generated - * Response is received. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param manufacturerCode Manufacturer code Ver.: always - * @param discoveryComplete Indicates whether there are more commands to be - * discovered. Ver.: always - * @param commandIds Buffer containing the list of command identifiers. Ver.: - * always - * @param commandIdCount The length of bytes of the list, whish is the same as - * the number of identifiers. Ver.: always - */ -bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete, - chip::CommandId * commandIds, uint16_t commandIdCount); - -/** @brief Discover Commands Received Response - * - * This function is called by the framework when Discover Commands Received - * Response is received. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param manufacturerCode Manufacturer code Ver.: always - * @param discoveryComplete Indicates whether there are more commands to be - * discovered. Ver.: always - * @param commandIds Buffer containing the list of command identifiers. Ver.: - * always - * @param commandIdCount The length of bytes of the list, whish is the same as - * the number of identifiers. Ver.: always - */ -bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete, - chip::CommandId * commandIds, uint16_t commandIdCount); - -/** @brief Pre Command Received - * - * This callback is the second in the Application Framework's message processing - * chain. At this point in the processing of incoming over-the-air messages, the - * application has determined that the incoming message is a ZCL command. It - * parses enough of the message to populate an EmberAfClusterCommand struct. The - * Application Framework defines this struct value in a local scope to the - * command processing but also makes it available through a global pointer - * called emberAfCurrentCommand, in app/framework/util/util.c. When command - * processing is complete, this pointer is cleared. - * - * @param cmd Ver.: always - */ -bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd); - -/** @brief Pre Message Send - * - * This function is called by the framework when it is about to pass a message - * to the stack primitives for sending. This message may or may not be ZCL, - * ZDO, or some other protocol. This is called prior to - any ZigBee - * fragmentation that may be done. If the function returns true it is assumed - * the callback has consumed and processed the message. The callback must also - * set the EmberStatus status code to be passed back to the caller. The - * framework will do no further processing on the message. - If the - * function returns false then it is assumed that the callback has not processed - * the mesasge and the framework will continue to process accordingly. - * - * @param messageStruct The structure containing the parameters of the APS - * message to be sent. Ver.: always - * @param status A pointer to the status code value that will be returned to the - * caller. Ver.: always - */ -bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status); - -/** @brief Message Sent - * - * This function is called by the application framework from the message sent - * handler, when it is informed by the stack regarding the message sent status. - * All of the values passed to the emberMessageSentHandler are passed on to this - * callback. This provides an opportunity for the application to verify that its - * message has been sent successfully and take the appropriate action. This - * callback should return a bool value of true or false. A value of true - * indicates that the message sent notification has been handled and should not - * be handled by the application framework. - * - * @param type Ver.: always - * @param destination Ver.: always - * @param apsFrame Ver.: always - * @param msgLen Ver.: always - * @param message Ver.: always - * @param status Ver.: always - */ -bool emberAfMessageSentCallback(const chip::MessageSendDestination & destination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status); - -/** @brief Pre Attribute Change - * - * This function is called by the application framework before it changes an - * attribute value. The value passed into this callback is the value to which - * the attribute is to be set by the framework. The application should return - * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus - * to reject it. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param attributeId Ver.: always - * @param mask Ver.: always - * @param manufacturerCode Ver.: always - * @param type Ver.: always - * @param size Ver.: always - * @param value Ver.: always - */ -EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId, - uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint16_t size, - uint8_t * value); - -/** @brief Post Attribute Change - * - * This function is called by the application framework after it changes an - * attribute value. The value passed into this callback is the value to which - * the attribute was set by the framework. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param attributeId Ver.: always - * @param mask Ver.: always - * @param manufacturerCode Ver.: always - * @param type Ver.: always - * @param size Ver.: always - * @param value Ver.: always - */ -void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId, - uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value); - -/** @brief External Attribute Read - * - * Like emberAfExternalAttributeWriteCallback above, this function is called - * when the framework needs to read an attribute that is not stored within the - * Application Framework's data structures. - All of the important - * information about the attribute itself is passed as a pointer to an - * EmberAfAttributeMetadata struct, which is stored within the application and - * used to manage the attribute. A complete description of the - * EmberAfAttributeMetadata struct is provided in - * app/framework/include/af-types.h - This function assumes that the - * application is able to read the attribute, write it into the passed buffer, - * and return immediately. Any attributes that require a state machine for - * reading and writing are not really candidates for externalization at the - * present time. The Application Framework does not currently include a state - * machine for reading or writing attributes that must take place across a - * series of application ticks. Attributes that cannot be read in a timely - * manner should be stored within the Application Framework and updated - * occasionally by the application code from within the - * emberAfMainTickCallback. - If the application was successfully able to - * read the attribute and write it into the passed buffer, it should return a - * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally - * managed attribute value is smaller than what the buffer can hold. In the case - * of a buffer overflow throw an appropriate error such as - * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the - * application was not able to read the attribute. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param attributeMetadata Ver.: always - * @param manufacturerCode Ver.: always - * @param buffer Ver.: always - * @param maxReadLength Ver.: always - * @param index Ver.: always - */ -EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode, - uint8_t * buffer, uint16_t maxReadLength, int32_t index = -1); - -/** @brief Write Attributes Response - * - * This function is called by the application framework when a Write Attributes - * Response command is received from an external device. The application should - * return true if the message was processed or false if it was not. - * - * @param clusterId The cluster identifier of this response. Ver.: always - * @param buffer Buffer containing the list of write attribute status records. - * Ver.: always - * @param bufLen The length in bytes of the list. Ver.: always - */ -bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen); - -/** @brief External Attribute Write - * - * This function is called whenever the Application Framework needs to write an - * attribute which is not stored within the data structures of the Application - * Framework itself. One of the new features in Version 2 is the ability to - * store attributes outside the Framework. This is particularly useful for - * attributes that do not need to be stored because they can be read off the - * hardware when they are needed, or are stored in some central location used by - * many modules within the system. In this case, you can indicate that the - * attribute is stored externally. When the framework needs to write an external - * attribute, it makes a call to this callback. - This callback is very - * useful for host micros which need to store attributes in persistent memory. - * Because each host micro (used with an Ember NCP) has its own type of - * persistent memory storage, the Application Framework does not include the - * ability to mark attributes as stored in flash the way that it does for Ember - * SoCs like the EM35x. On a host micro, any attributes that need to be stored - * in persistent memory should be marked as external and accessed through the - * external read and write callbacks. Any host code associated with the - * persistent storage should be implemented within this callback. - All of - * the important information about the attribute itself is passed as a pointer - * to an EmberAfAttributeMetadata struct, which is stored within the application - * and used to manage the attribute. A complete description of the - * EmberAfAttributeMetadata struct is provided in - * app/framework/include/af-types.h. - This function assumes that the - * application is able to write the attribute and return immediately. Any - * attributes that require a state machine for reading and writing are not - * candidates for externalization at the present time. The Application Framework - * does not currently include a state machine for reading or writing attributes - * that must take place across a series of application ticks. Attributes that - * cannot be written immediately should be stored within the Application - * Framework and updated occasionally by the application code from within the - * emberAfMainTickCallback. - If the application was successfully able to - * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any - * other return value indicates the application was not able to write the - * attribute. - * - * @param endpoint Ver.: always - * @param clusterId Ver.: always - * @param attributeMetadata Ver.: always - * @param manufacturerCode Ver.: always - * @param buffer Ver.: always - * @param index Ver.: always - */ -EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode, - uint8_t * buffer, int32_t index = -1); - -/** @brief Report Attributes - * - * This function is called by the application framework when a Report Attributes - * command is received from an external device. The application should return - * true if the message was processed or false if it was not. - * - * @param clusterId The cluster identifier of this command. Ver.: always - * @param buffer Buffer containing the list of attribute report records. Ver.: - * always - * @param bufLen The length in bytes of the list. Ver.: always - */ -bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen); - -/** @brief Get Current Time - * - * This callback is called when device attempts to get current time from the - * hardware. If this device has means to retrieve exact time, then this method - * should implement it. If the callback can't provide the exact time it should - * return 0 to indicate failure. Default action is to return 0, which indicates - * that device does not have access to real time. - * - */ -uint32_t emberAfGetCurrentTimeCallback(); - -/** @brief Get Endpoint Info - * - * This function is a callback to an application implemented endpoint that - * operates outside the normal application framework. When the framework wishes - * to perform operations with that endpoint it uses this callback to retrieve - * the endpoint's information. If the endpoint exists and the application can - * provide data then true shall be returned. Otherwise the callback must return - * false. - * - * @param endpoint The endpoint to retrieve data for. Ver.: always - * @param returnNetworkIndex The index corresponding to the ZigBee network the - * endpoint belongs to. If not using a multi-network device, 0 must be - * returned. Otherwise on a multi-network device the stack will switch to this - * network before sending the message. Ver.: always - * @param returnEndpointInfo A pointer to a data struct that will be written - * with information about the endpoint. Ver.: always - */ -bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex, - EmberAfEndpointInfoStruct * returnEndpointInfo); - -/** @brief Registration Abort - * - * This callback is called when the device should abort the registration - * process. - * - */ -void emberAfRegistrationAbortCallback(); - -/** @brief Interpan Send Message - * - * This function will send a raw MAC message with interpan frame format using - * the passed parameters. - * - * @param header Interpan header info Ver.: always - * @param messageLength The length of the message received or to send Ver.: - * always - * @param message The message data received or to send. Ver.: always - */ -EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message); - -/** @brief Start Move - * - * This function is called to initiate the process for a device to move (rejoin) - * to a new parent. - * - */ -bool emberAfStartMoveCallback(); diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index c03e76c3852634..e41ee5075aa6d2 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -55,7 +55,7 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(End memcpy(verifier.mW0, &verifierData[0], kSpake2p_WS_Length); memcpy(verifier.mL, &verifierData[kSpake2p_WS_Length], kSpake2p_WS_Length); - VerifyOrExit(OpenPairingWindowUsingVerifier(commissioningTimeout, discriminator, verifier, iterations, salt, passcodeID) == + VerifyOrExit(OpenEnhancedCommissioningWindow(commissioningTimeout, discriminator, verifier, iterations, salt, passcodeID) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); ChipLogProgress(Zcl, "Commissioning window is now open"); @@ -77,7 +77,7 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac ChipLogProgress(Zcl, "Received command to open basic commissioning window"); VerifyOrExit(!IsPairingWindowOpen(), status = EMBER_ZCL_STATUS_FAILURE); VerifyOrExit(commissioningTimeout <= kMaxCommissionioningTimeoutSeconds, status = EMBER_ZCL_STATUS_FAILURE); - VerifyOrExit(OpenDefaultPairingWindow(ResetFabrics::kNo, commissioningTimeout) == CHIP_NO_ERROR, + VerifyOrExit(OpenBasicCommissioningWindow(ResetFabrics::kNo, commissioningTimeout) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); ChipLogProgress(Zcl, "Commissioning window is now open"); diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 093e718711391f..40564c9d6cda89 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -161,21 +161,16 @@ CHIP_ERROR writeFabricsIntoFabricsListAttribute() return err; } -/* - * Look at "Temporary flow for fabric management" comment above for current fabric management flow. - * To retrieve the current fabric, we retrieve the emberAfCurrentCommand()->source which should be set - * to the commissioner node Id, which we are temporarily using as the fabricId. - * We should also figure out how to retrieve the device nodeId and vendorId if we can so that we use multiple - * fields to find the current fabric. Once addOptCert and fabric index are implemented, remove all this and use fabricIndex. - */ - static FabricInfo * retrieveCurrentFabric() { - uint64_t fabricId = emberAfCurrentCommand()->SourceNodeId(); - // TODO: Figure out how to get device node id so we can do FindFabricForNode(fabricId, nodeId)... - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Finding fabric with fabricId 0x" ChipLogFormatX64 ".", - ChipLogValueX64(fabricId)); - return GetGlobalFabricTable().FindFabricForNode(fabricId); + if (emberAfCurrentCommand()->source == nullptr) + { + return nullptr; + } + + FabricIndex index = emberAfCurrentCommand()->source->GetSecureSession().GetFabricIndex(); + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Finding fabric with fabricIndex %d", index); + return GetGlobalFabricTable().FindFabricWithIndex(index); } // TODO: The code currently has two sources of truths for fabrics, the pairing table + the attributes. There should only be one, @@ -226,81 +221,27 @@ void emberAfPluginOperationalCredentialsServerInitCallback(void) writeFabricsIntoFabricsListAttribute(); } -// TODO: Use FabricIndex as a parameter instead of fabricId/nodeId/vendorId once AddOptCert + FabricIndex are implemented bool emberAfOperationalCredentialsClusterRemoveFabricCallback(EndpointId endpoint, app::CommandHandler * commandObj, FabricId fabricId, NodeId nodeId, uint16_t vendorId) { emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: RemoveFabric"); // TODO: Generate emberAfFabricClusterPrintln EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - FabricInfo * fabric; - FabricIndex fabricIndex; - CHIP_ERROR err = CHIP_NO_ERROR; - - // Fetch matching fabric - fabric = GetGlobalFabricTable().FindFabricForNode(fabricId, nodeId, vendorId); - VerifyOrExit(fabric != nullptr, status = EMBER_ZCL_STATUS_SUCCESS); // Fabric has already been removed - - // Delete fabric - fabricIndex = fabric->GetFabricIndex(); - err = GetGlobalFabricTable().Delete(fabricIndex); - VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); - -exit: + // TODO - Update RemoveFabric command to take FabricIndex as input parameter + // The fix requires an update to cluster definition. + // CHIP_ERROR err = GetGlobalFabricTable().Delete(fabricIndex); + // VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); + // exit: writeFabricsIntoFabricsListAttribute(); emberAfSendImmediateDefaultResponse(status); return true; } -// TODO: remove SetFabric once AddOptCert + FabricIndex are implemented bool emberAfOperationalCredentialsClusterSetFabricCallback(EndpointId endpoint, app::CommandHandler * commandObj, uint16_t VendorId) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: SetFabric with vendorId %" PRIX16, VendorId); - - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - EmberStatus sendStatus = EMBER_SUCCESS; - CHIP_ERROR err = CHIP_NO_ERROR; - - // Fetch current fabric - FabricInfo * fabric = retrieveCurrentFabric(); - VerifyOrExit(fabric != nullptr, status = EMBER_ZCL_STATUS_FAILURE); - - // Store vendorId - fabric->SetVendorId(VendorId); - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: vendorId is now set %" PRIX16, fabric->GetVendorId()); - err = GetGlobalFabricTable().Store(fabric->GetFabricIndex()); - VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); - - // Return FabricId - we are temporarily using commissioner nodeId (retrieved via emberAfCurrentCommand()->SourceNodeId()) as - // fabricId until addOptCert + fabricIndex are implemented. Once they are, this method and its response will go away. - { - app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, - ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) }; - TLV::TLVWriter * writer = nullptr; - - VerifyOrExit(commandObj != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - SuccessOrExit(err = commandObj->PrepareCommand(cmdParams)); - writer = commandObj->GetCommandDataElementTLVWriter(); - SuccessOrExit(err = writer->Put(TLV::ContextTag(0), commandObj->GetExchangeContext()->GetSecureSession().GetPeerNodeId())); - SuccessOrExit(err = commandObj->FinishCommand()); - } - -exit: - if (status == EMBER_ZCL_STATUS_FAILURE) - { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed setFabricVendorId."); - emberAfSendImmediateDefaultResponse(status); - } - if (sendStatus != EMBER_SUCCESS) - { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed to send SetFabric response: 0x%x", sendStatus); - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Failed to encode response command: %s", ErrorStr(err)); - } - + // TODO - Delete SetFabric command as this is not spec compliant + ChipLogError(Zcl, "operational-credentials cluster received SetFabric command, which is not supported"); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); return true; } @@ -331,10 +272,8 @@ bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(EndpointId en } namespace { -void DoRemoveAllFabrics(intptr_t) -{ - OpenDefaultPairingWindow(ResetFabrics::kYes); -} + +FabricInfo gFabricBeingCommissioned; CHIP_ERROR SendNOCResponse(app::Command * commandObj, EmberAfNodeOperationalCertStatus status, uint8_t index, ByteSpan debug_text) { @@ -391,30 +330,66 @@ EmberAfNodeOperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) // Up for discussion in Multi-Admin TT: chip-spec:#2891 bool emberAfOperationalCredentialsClusterRemoveAllFabricsCallback(EndpointId endpoint, app::CommandHandler * commandObj) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Remove all Fabrics"); - PlatformMgr().ScheduleWork(DoRemoveAllFabrics, 0); + // TODO - Delete RemoveAll fabrics command as this is not spec compliant + ChipLogError(Zcl, "operational-credentials cluster received remove all fabric command, which is not supported"); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); return true; } bool emberAfOperationalCredentialsClusterAddNOCCallback(EndpointId endpoint, app::CommandHandler * commandObj, ByteSpan NOCArray, - ByteSpan IPKValue, NodeId CaseAdminNode, uint16_t AdminVendorId) + ByteSpan IPKValue, NodeId adminNodeId, uint16_t adminVendorId) { EmberAfNodeOperationalCertStatus nocResponse = EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS; - CHIP_ERROR err = CHIP_NO_ERROR; - uint8_t fabricIndex = 0; + CHIP_ERROR err = CHIP_NO_ERROR; + FabricIndex fabricIndex = 0; emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: commissioner has added an Op Cert"); + err = gFabricBeingCommissioned.SetOperationalCertsFromCertArray(NOCArray); + VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err)); + + gFabricBeingCommissioned.SetVendorId(adminVendorId); + + err = GetGlobalFabricTable().AddNewFabric(gFabricBeingCommissioned, &fabricIndex); + VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err)); + + err = GetGlobalFabricTable().Store(fabricIndex); + VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err)); + + // We might have a new operational identity, so we should start advertising it right away. + chip::app::Mdns::AdvertiseOperational(); + +exit: + + gFabricBeingCommissioned.Reset(); + SendNOCResponse(commandObj, nocResponse, fabricIndex, ByteSpan()); + + if (nocResponse != EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS) + { + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed AddNOC request. Status %d", nocResponse); + } + + return true; +} + +bool emberAfOperationalCredentialsClusterUpdateNOCCallback(EndpointId endpoint, app::CommandHandler * commandObj, ByteSpan NOCArray) +{ + EmberAfNodeOperationalCertStatus nocResponse = EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS; + + CHIP_ERROR err = CHIP_NO_ERROR; + FabricIndex fabricIndex = 0; + + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: an administrator has updated the Op Cert"); + + // Fetch current fabric FabricInfo * fabric = retrieveCurrentFabric(); - VerifyOrExit(fabric != nullptr, nocResponse = EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_MISSING_CSR); + VerifyOrExit(fabric != nullptr, nocResponse = ConvertToNOCResponseStatus(CHIP_ERROR_INVALID_FABRIC_ID)); err = fabric->SetOperationalCertsFromCertArray(NOCArray); VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err)); - err = GetGlobalFabricTable().Store(fabric->GetFabricIndex()); - VerifyOrExit(err == CHIP_NO_ERROR, nocResponse = ConvertToNOCResponseStatus(err)); + fabricIndex = fabric->GetFabricIndex(); // We have a new operational identity and should start advertising it. We // can't just wait until we get network configuration commands, because we @@ -422,15 +397,13 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(EndpointId endpoint, app // expected to be live with our new identity at this point. app::Mdns::AdvertiseOperational(); - fabricIndex = GetGlobalFabricTable().GetFabricIndex(fabric); - exit: SendNOCResponse(commandObj, nocResponse, fabricIndex, ByteSpan()); if (nocResponse != EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed AddNOC request. Status %d", nocResponse); + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed UpdateNOC request. Status %d", nocResponse); } return true; @@ -439,9 +412,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(EndpointId endpoint, app bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(EndpointId endpoint, app::CommandHandler * commandObj, ByteSpan CSRNonce) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - EmberStatus sendStatus = EMBER_SUCCESS; - CHIP_ERROR err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; Platform::ScopedMemoryBuffer csr; size_t csrLength = Crypto::kMAX_CSR_Length; @@ -457,25 +428,21 @@ bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(EndpointId endpoin TLV::TLVWriter csrElementWriter; TLV::TLVType containerType; - // Fetch current fabric - FabricInfo * fabric = retrieveCurrentFabric(); - VerifyOrExit(fabric != nullptr, status = EMBER_ZCL_STATUS_FAILURE); - - VerifyOrExit(csr.Alloc(Crypto::kMAX_CSR_Length), status = EMBER_ZCL_STATUS_FAILURE); + VerifyOrExit(csr.Alloc(Crypto::kMAX_CSR_Length), err = CHIP_ERROR_NO_MEMORY); - if (fabric->GetOperationalKey() == nullptr) + if (gFabricBeingCommissioned.GetEphemeralKey() == nullptr) { Crypto::P256Keypair keypair; keypair.Initialize(); - VerifyOrExit(fabric->SetOperationalKey(keypair) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); + SuccessOrExit(err = gFabricBeingCommissioned.SetEphemeralKey(&keypair)); } - err = fabric->GetOperationalKey()->NewCertificateSigningRequest(csr.Get(), csrLength); + err = gFabricBeingCommissioned.GetEphemeralKey()->NewCertificateSigningRequest(csr.Get(), csrLength); emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: NewCertificateSigningRequest returned %d", err); - VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); - VerifyOrExit(csrLength < UINT8_MAX, status = EMBER_ZCL_STATUS_FAILURE); + SuccessOrExit(err); + VerifyOrExit(csrLength < UINT8_MAX, err = CHIP_ERROR_INTERNAL); - VerifyOrExit(csrElements.Alloc(kMaxRspLen), status = EMBER_ZCL_STATUS_FAILURE); + VerifyOrExit(csrElements.Alloc(kMaxRspLen), err = CHIP_ERROR_NO_MEMORY); csrElementWriter.Init(csrElements.Get(), kMaxRspLen); SuccessOrExit(err = csrElementWriter.StartContainer(TLV::AnonymousTag, TLV::TLVType::kTLVType_Structure, containerType)); @@ -500,18 +467,11 @@ bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(EndpointId endpoin SuccessOrExit(err = commandObj->FinishCommand()); exit: - if (status == EMBER_ZCL_STATUS_FAILURE) - { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed OpCSRRequest."); - emberAfSendImmediateDefaultResponse(status); - } - if (sendStatus != EMBER_SUCCESS) - { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed to send OpCSRRequest: 0x%x", sendStatus); - } if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Failed to encode response command: %s", ErrorStr(err)); + gFabricBeingCommissioned.Reset(); + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed OpCSRRequest: %s", ErrorStr(err)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); } return true; @@ -532,17 +492,13 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback(Endpo emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: commissioner has added a trusted root Cert"); - // Fetch current fabric - FabricInfo * fabric = retrieveCurrentFabric(); - VerifyOrExit(fabric != nullptr, status = EMBER_ZCL_STATUS_FAILURE); - VerifyOrExit(fabric->SetRootCert(RootCertificate) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); - - VerifyOrExit(GetGlobalFabricTable().Store(fabric->GetFabricIndex()) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); + VerifyOrExit(gFabricBeingCommissioned.SetRootCert(RootCertificate) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); exit: emberAfSendImmediateDefaultResponse(status); if (status == EMBER_ZCL_STATUS_FAILURE) { + gFabricBeingCommissioned.Reset(); emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Failed AddTrustedRootCert request."); } diff --git a/src/app/server/RendezvousServer.cpp b/src/app/server/RendezvousServer.cpp index a84624e59b640e..284d5e573f4c01 100644 --- a/src/app/server/RendezvousServer.cpp +++ b/src/app/server/RendezvousServer.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -56,7 +55,6 @@ void RendezvousServer::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent * even ChipLogError(Discovery, "Commissioning errored out with error %" CHIP_ERROR_FORMAT, event->CommissioningComplete.status.Format()); } - // TODO: Commissioning complete means we can finalize the fabric in our storage } else if (event->Type == DeviceLayer::DeviceEventType::kOperationalNetworkEnabled) { @@ -67,13 +65,11 @@ void RendezvousServer::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent * even CHIP_ERROR RendezvousServer::WaitForPairing(const RendezvousParameters & params, uint32_t pbkdf2IterCount, const ByteSpan & salt, uint16_t passcodeID, Messaging::ExchangeManager * exchangeManager, - TransportMgrBase * transportMgr, SecureSessionMgr * sessionMgr, - Transport::FabricInfo * fabric) + TransportMgrBase * transportMgr, SecureSessionMgr * sessionMgr) { VerifyOrReturnError(transportMgr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(exchangeManager != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(sessionMgr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(fabric != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(params.HasSetupPINCode() || params.HasPASEVerifier(), CHIP_ERROR_INVALID_ARGUMENT); #if CONFIG_NETWORK_LAYER_BLE @@ -95,7 +91,6 @@ CHIP_ERROR RendezvousServer::WaitForPairing(const RendezvousParameters & params, } mSessionMgr = sessionMgr; - mFabric = fabric; mExchangeManager = exchangeManager; ReturnErrorOnFailure(mExchangeManager->RegisterUnsolicitedMessageHandlerForType( @@ -145,10 +140,9 @@ void RendezvousServer::OnSessionEstablishmentError(CHIP_ERROR err) void RendezvousServer::OnSessionEstablished() { - CHIP_ERROR err = - mSessionMgr->NewPairing(Optional::Value(mPairingSession.PeerConnection().GetPeerAddress()), - mPairingSession.PeerConnection().GetPeerNodeId(), &mPairingSession, - SecureSession::SessionRole::kResponder, mFabric->GetFabricIndex()); + CHIP_ERROR err = mSessionMgr->NewPairing( + Optional::Value(mPairingSession.PeerConnection().GetPeerAddress()), + mPairingSession.PeerConnection().GetPeerNodeId(), &mPairingSession, SecureSession::SessionRole::kResponder, 0); if (err != CHIP_NO_ERROR) { ChipLogError(Ble, "Failed in setting up secure channel: err %s", ErrorStr(err)); @@ -177,19 +171,5 @@ void RendezvousServer::OnSessionEstablished() } ChipLogProgress(AppServer, "Device completed Rendezvous process"); - StorablePeerConnection connection(mPairingSession, mFabric->GetFabricIndex()); - - VerifyOrReturn(mStorage != nullptr, - ChipLogError(AppServer, "Storage delegate is not available. Cannot store the connection state")); - VerifyOrReturn(connection.StoreIntoKVS(*mStorage) == CHIP_NO_ERROR, - ChipLogError(AppServer, "Failed to store the connection state")); - - // The Peek() is used to find the smallest key ID that's not been assigned to any session. - // This value is persisted, and on reboot, it is used to revive any previously - // active secure sessions. - // We support one active PASE session at any time. So the key ID should not be updated - // in another thread, while we retrieve it here. - uint16_t keyID = mIDAllocator->Peek(); - mStorage->SyncSetKeyValue(kStorablePeerConnectionCountKey, &keyID, sizeof(keyID)); } } // namespace chip diff --git a/src/app/server/RendezvousServer.h b/src/app/server/RendezvousServer.h index df55bcf7697b5f..2a3769d5b02845 100644 --- a/src/app/server/RendezvousServer.h +++ b/src/app/server/RendezvousServer.h @@ -31,13 +31,10 @@ class RendezvousServer : public SessionEstablishmentDelegate public: CHIP_ERROR WaitForPairing(const RendezvousParameters & params, uint32_t pbkdf2IterCount, const ByteSpan & salt, uint16_t passcodeID, Messaging::ExchangeManager * exchangeManager, TransportMgrBase * transportMgr, - SecureSessionMgr * sessionMgr, Transport::FabricInfo * fabric); + SecureSessionMgr * sessionMgr); - CHIP_ERROR Init(AppDelegate * delegate, PersistentStorageDelegate * storage, SessionIDAllocator * idAllocator) + CHIP_ERROR Init(AppDelegate * delegate, SessionIDAllocator * idAllocator) { - VerifyOrReturnError(storage != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - mStorage = storage; - VerifyOrReturnError(idAllocator != nullptr, CHIP_ERROR_INVALID_ARGUMENT); mIDAllocator = idAllocator; @@ -57,14 +54,11 @@ class RendezvousServer : public SessionEstablishmentDelegate private: AppDelegate * mDelegate; - PersistentStorageDelegate * mStorage = nullptr; Messaging::ExchangeManager * mExchangeManager = nullptr; PASESession mPairingSession; SecureSessionMgr * mSessionMgr = nullptr; - Transport::FabricInfo * mFabric = nullptr; - SessionIDAllocator * mIDAllocator = nullptr; const RendezvousAdvertisementDelegate * mAdvDelegate; diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 31c33fce079661..d2bef7b3a4e764 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -106,107 +105,6 @@ class ServerStorageDelegate : public PersistentStorageDelegate ServerStorageDelegate gServerStorage; SessionIDAllocator gSessionIDAllocator; -CHIP_ERROR PersistFabricToKVS(FabricInfo * fabric, FabricIndex nextAvailableId) -{ - ReturnErrorCodeIf(fabric == nullptr, CHIP_ERROR_INVALID_ARGUMENT); - ChipLogProgress(AppServer, "Persisting fabric ID %d, next available %d", fabric->GetFabricIndex(), nextAvailableId); - - ReturnErrorOnFailure(GetGlobalFabricTable().Store(fabric->GetFabricIndex())); - ReturnErrorOnFailure(PersistedStorage::KeyValueStoreMgr().Put(kFabricTableCountKey, &nextAvailableId, sizeof(nextAvailableId))); - - ChipLogProgress(AppServer, "Persisting fabric ID successfully"); - return CHIP_NO_ERROR; -} - -CHIP_ERROR RestoreAllFabricsFromKVS(FabricTable & fabrics, FabricIndex & nextAvailableId) -{ - // It's not an error if the key doesn't exist. Just return right away. - VerifyOrReturnError(PersistedStorage::KeyValueStoreMgr().Get(kFabricTableCountKey, &nextAvailableId) == CHIP_NO_ERROR, - CHIP_NO_ERROR); - ChipLogProgress(AppServer, "Next available fabric ID is %d", nextAvailableId); - - // TODO: The fabric ID space allocation should be re-evaluated. With the current approach, the space could be - // exhausted while IDs are still available (e.g. if the fabric IDs are allocated and freed over a period of time). - // Also, the current approach can make ID lookup slower as more IDs are allocated and freed. - for (FabricIndex id = 0; id < nextAvailableId; id++) - { - // Recreate the binding if one exists in persistent storage. Else skip to the next ID - if (fabrics.LoadFromStorage(id) == CHIP_NO_ERROR) - { - FabricInfo * fabric = fabrics.FindFabricWithIndex(id); - if (fabric != nullptr) - { - ChipLogProgress(AppServer, "Found fabric pairing for %d, node ID 0x" ChipLogFormatX64, fabric->GetFabricIndex(), - ChipLogValueX64(fabric->GetNodeId())); - } - } - } - ChipLogProgress(AppServer, "Restored all fabric pairings from KVS."); - - return CHIP_NO_ERROR; -} - -void EraseAllFabricsUpTo(FabricIndex nextAvailableId) -{ - PersistedStorage::KeyValueStoreMgr().Delete(kFabricTableCountKey); - - for (FabricIndex id = 0; id < nextAvailableId; id++) - { - GetGlobalFabricTable().Delete(id); - } -} - -static CHIP_ERROR RestoreAllSessionsFromKVS(SecureSessionMgr & sessionMgr) -{ - uint16_t nextSessionKeyId = 0; - // It's not an error if the key doesn't exist. Just return right away. - VerifyOrReturnError(PersistedStorage::KeyValueStoreMgr().Get(kStorablePeerConnectionCountKey, &nextSessionKeyId) == - CHIP_NO_ERROR, - CHIP_NO_ERROR); - ChipLogProgress(AppServer, "Found %d stored connections", nextSessionKeyId); - - PASESession * session = chip::Platform::New(); - VerifyOrReturnError(session != nullptr, CHIP_ERROR_NO_MEMORY); - - for (uint16_t keyId = 0; keyId < nextSessionKeyId; keyId++) - { - StorablePeerConnection connection; - if (CHIP_NO_ERROR == connection.FetchFromKVS(gServerStorage, keyId)) - { - connection.GetPASESession(session); - - ChipLogProgress(AppServer, "Fetched the session information: from 0x" ChipLogFormatX64, - ChipLogValueX64(session->PeerConnection().GetPeerNodeId())); - if (gSessionIDAllocator.Reserve(keyId) == CHIP_NO_ERROR) - { - sessionMgr.NewPairing(Optional::Value(session->PeerConnection().GetPeerAddress()), - session->PeerConnection().GetPeerNodeId(), session, SecureSession::SessionRole::kResponder, - connection.GetFabricIndex()); - } - else - { - ChipLogProgress(AppServer, "Session Key ID %" PRIu16 " cannot be used. Skipping over this session", keyId); - } - session->Clear(); - } - } - - chip::Platform::Delete(session); - - return CHIP_NO_ERROR; -} - -void EraseAllSessionsUpTo(uint16_t nextSessionKeyId) -{ - PersistedStorage::KeyValueStoreMgr().Delete(kStorablePeerConnectionCountKey); - - for (uint16_t keyId = 0; keyId < nextSessionKeyId; keyId++) - { - gSessionIDAllocator.Free(keyId); - StorablePeerConnection::DeleteFromKVS(gServerStorage, keyId); - } -} - // TODO: The following class is setting the discriminator in Persistent Storage. This is // is needed since BLE reads the discriminator using ConfigurationMgr APIs. The // better solution will be to pass the discriminator to BLE without changing it @@ -246,8 +144,7 @@ class DeviceDiscriminatorCache DeviceDiscriminatorCache gDeviceDiscriminatorCache; FabricTable gFabrics; -FabricIndex gNextAvailableFabricIndex = 0; -bool gPairingWindowOpen = false; +bool gPairingWindowOpen = false; class ServerRendezvousAdvertisementDelegate : public RendezvousAdvertisementDelegate { @@ -281,12 +178,6 @@ class ServerRendezvousAdvertisementDelegate : public RendezvousAdvertisementDele mDelegate->OnPairingWindowClosed(); } - FabricInfo * fabric = gFabrics.FindFabricWithIndex(mFabric); - if (fabric != nullptr) - { - ReturnErrorOnFailure(PersistFabricToKVS(fabric, gNextAvailableFabricIndex)); - } - return CHIP_NO_ERROR; } @@ -316,16 +207,7 @@ class ServerCallback : public ExchangeDelegate CHIP_ERROR err = CHIP_NO_ERROR; // as soon as a client connects, assume it is connected VerifyOrExit(!buffer.IsNull(), ChipLogError(AppServer, "Received data but couldn't process it...")); - VerifyOrExit(packetHeader.GetSourceNodeId().HasValue(), ChipLogError(AppServer, "Unknown source for received message")); - VerifyOrExit(mSessionMgr != nullptr, ChipLogError(AppServer, "SecureSessionMgr is not initilized yet")); - - VerifyOrExit(packetHeader.GetSourceNodeId().Value() != kUndefinedNodeId, - ChipLogError(AppServer, "Unknown source for received message")); - - ChipLogProgress(AppServer, "Packet received from Node 0x" ChipLogFormatX64 ": %u bytes", - ChipLogValueX64(packetHeader.GetSourceNodeId().Value()), buffer->DataLength()); - HandleDataModelMessage(exchangeContext, std::move(buffer)); exit: @@ -366,8 +248,8 @@ void HandlePairingWindowTimeout(System::Layer * aSystemLayer, void * aAppState) } // namespace -CHIP_ERROR OpenDefaultPairingWindow(ResetFabrics resetFabrics, uint16_t commissioningTimeoutSeconds, - chip::PairingWindowAdvertisement advertisementMode) +CHIP_ERROR OpenBasicCommissioningWindow(ResetFabrics resetFabrics, uint16_t commissioningTimeoutSeconds, + chip::PairingWindowAdvertisement advertisementMode) { // TODO(cecille): If this is re-called when the window is already open, what should happen? gDeviceDiscriminatorCache.RestoreDiscriminator(); @@ -389,23 +271,17 @@ CHIP_ERROR OpenDefaultPairingWindow(ResetFabrics resetFabrics, uint16_t commissi if (resetFabrics == ResetFabrics::kYes) { - EraseAllFabricsUpTo(gNextAvailableFabricIndex); - EraseAllSessionsUpTo(gSessionIDAllocator.Peek()); + gFabrics.DeleteAllFabrics(); // Only resetting gNextAvailableFabricIndex at reboot otherwise previously paired device with fabricID 0 // can continue sending messages to accessory as next available fabric will also be 0. // This logic is not up to spec, will be implemented up to spec once AddOptCert is implemented. gFabrics.Reset(); } - FabricIndex fabricIndex = gNextAvailableFabricIndex; - FabricInfo * fabricInfo = gFabrics.AssignFabricIndex(fabricIndex); - VerifyOrReturnError(fabricInfo != nullptr, CHIP_ERROR_NO_MEMORY); - gNextAvailableFabricIndex++; - ReturnErrorOnFailure(gRendezvousServer.WaitForPairing( std::move(params), kSpake2p_Iteration_Count, ByteSpan(reinterpret_cast(kSpake2pKeyExchangeSalt), strlen(kSpake2pKeyExchangeSalt)), 0, &gExchangeMgr, - &gTransports, &gSessions, fabricInfo)); + &gTransports, &gSessions)); if (commissioningTimeoutSeconds != kNoCommissioningTimeout) { @@ -416,8 +292,8 @@ CHIP_ERROR OpenDefaultPairingWindow(ResetFabrics resetFabrics, uint16_t commissi return CHIP_NO_ERROR; } -CHIP_ERROR OpenPairingWindowUsingVerifier(uint16_t commissioningTimeoutSeconds, uint16_t discriminator, PASEVerifier & verifier, - uint32_t iterations, ByteSpan salt, uint16_t passcodeID) +CHIP_ERROR OpenEnhancedCommissioningWindow(uint16_t commissioningTimeoutSeconds, uint16_t discriminator, PASEVerifier & verifier, + uint32_t iterations, ByteSpan salt, uint16_t passcodeID) { RendezvousParameters params; @@ -426,13 +302,8 @@ CHIP_ERROR OpenPairingWindowUsingVerifier(uint16_t commissioningTimeoutSeconds, gAdvDelegate.SetBLE(false); params.SetPASEVerifier(verifier).SetAdvertisementDelegate(&gAdvDelegate); - FabricIndex fabricIndex = gNextAvailableFabricIndex; - FabricInfo * fabricInfo = gFabrics.AssignFabricIndex(fabricIndex); - VerifyOrReturnError(fabricInfo != nullptr, CHIP_ERROR_NO_MEMORY); - gNextAvailableFabricIndex++; - - ReturnErrorOnFailure(gRendezvousServer.WaitForPairing(std::move(params), iterations, salt, passcodeID, &gExchangeMgr, - &gTransports, &gSessions, fabricInfo)); + ReturnErrorOnFailure( + gRendezvousServer.WaitForPairing(std::move(params), iterations, salt, passcodeID, &gExchangeMgr, &gTransports, &gSessions)); if (commissioningTimeoutSeconds != kNoCommissioningTimeout) { @@ -475,7 +346,7 @@ void InitServer(AppDelegate * delegate) PersistedStorage::KeyValueStoreMgrImpl().Init(CHIP_CONFIG_KVS_PATH); #endif - err = gRendezvousServer.Init(delegate, &gServerStorage, &gSessionIDAllocator); + err = gRendezvousServer.Init(delegate, &gSessionIDAllocator); SuccessOrExit(err); gAdvDelegate.SetDelegate(delegate); @@ -517,25 +388,18 @@ void InitServer(AppDelegate * delegate) if (useTestPairing()) { ChipLogProgress(AppServer, "Rendezvous and secure pairing skipped"); - SuccessOrExit(err = AddTestPairing()); + SuccessOrExit(err = AddTestCommissioning()); } else if (DeviceLayer::ConnectivityMgr().IsWiFiStationProvisioned() || DeviceLayer::ConnectivityMgr().IsThreadProvisioned()) { // If the network is already provisioned, proactively disable BLE advertisement. ChipLogProgress(AppServer, "Network already provisioned. Disabling BLE advertisement"); chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(false); - - // Restore any previous fabric pairings - VerifyOrExit(CHIP_NO_ERROR == RestoreAllFabricsFromKVS(gFabrics, gNextAvailableFabricIndex), - ChipLogError(AppServer, "Could not restore fabric table")); - - VerifyOrExit(CHIP_NO_ERROR == RestoreAllSessionsFromKVS(gSessions), - ChipLogError(AppServer, "Could not restore previous sessions")); } else { #if CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART - SuccessOrExit(err = OpenDefaultPairingWindow(ResetFabrics::kYes)); + SuccessOrExit(err = OpenBasicCommissioningWindow(ResetFabrics::kYes)); #endif } @@ -609,28 +473,18 @@ CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress com #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT -CHIP_ERROR AddTestPairing() +CHIP_ERROR AddTestCommissioning() { CHIP_ERROR err = CHIP_NO_ERROR; - FabricInfo * fabricInfo = nullptr; PASESession * testSession = nullptr; PASESessionSerializable serializedTestSession; - for (const FabricInfo & fabric : gFabrics) - if (fabric.IsInitialized() && fabric.GetNodeId() == chip::kTestDeviceNodeId) - ExitNow(); - - fabricInfo = gFabrics.AssignFabricIndex(gNextAvailableFabricIndex); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); - - fabricInfo->SetNodeId(chip::kTestDeviceNodeId); gTestPairing.ToSerializable(serializedTestSession); testSession = chip::Platform::New(); testSession->FromSerializable(serializedTestSession); SuccessOrExit(err = gSessions.NewPairing(Optional{ PeerAddress::Uninitialized() }, chip::kTestControllerNodeId, - testSession, SecureSession::SessionRole::kResponder, gNextAvailableFabricIndex)); - ++gNextAvailableFabricIndex; + testSession, SecureSession::SessionRole::kResponder, kMinValidFabricIndex)); exit: if (testSession) @@ -639,9 +493,8 @@ CHIP_ERROR AddTestPairing() chip::Platform::Delete(testSession); } - if (err != CHIP_NO_ERROR && fabricInfo != nullptr) - gFabrics.ReleaseFabricIndex(gNextAvailableFabricIndex); - + if (err != CHIP_NO_ERROR) + gFabrics.ReleaseFabricIndex(kMinValidFabricIndex); return err; } diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 94f087f61e7a27..909f0ce0ee5e6f 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -52,7 +52,7 @@ void InitServer(AppDelegate * delegate = nullptr); CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress commissioner); #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT -CHIP_ERROR AddTestPairing(); +CHIP_ERROR AddTestCommissioning(); chip::Transport::FabricTable & GetGlobalFabricTable(); @@ -77,12 +77,13 @@ constexpr uint16_t kNoCommissioningTimeout = UINT16_MAX; /** * Open the pairing window using default configured parameters. */ -CHIP_ERROR OpenDefaultPairingWindow(chip::ResetFabrics resetFabrics, uint16_t commissioningTimeoutSeconds = kNoCommissioningTimeout, - chip::PairingWindowAdvertisement advertisementMode = chip::PairingWindowAdvertisement::kBle); +CHIP_ERROR +OpenBasicCommissioningWindow(chip::ResetFabrics resetFabrics, uint16_t commissioningTimeoutSeconds = kNoCommissioningTimeout, + chip::PairingWindowAdvertisement advertisementMode = chip::PairingWindowAdvertisement::kBle); -CHIP_ERROR OpenPairingWindowUsingVerifier(uint16_t commissioningTimeoutSeconds, uint16_t discriminator, - chip::PASEVerifier & verifier, uint32_t iterations, chip::ByteSpan salt, - uint16_t passcodeID); +CHIP_ERROR OpenEnhancedCommissioningWindow(uint16_t commissioningTimeoutSeconds, uint16_t discriminator, + chip::PASEVerifier & verifier, uint32_t iterations, chip::ByteSpan salt, + uint16_t passcodeID); void ClosePairingWindow(); diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 51ff06eb0d5e9b..d8a572004319cf 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -426,9 +426,6 @@ void InitializeChip(nlTestSuite * apSuite) CHIP_ERROR err = CHIP_NO_ERROR; chip::Optional peer(chip::Transport::Type::kUndefined); chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(chip::gFabricIndex, chip::kTestDeviceNodeId); - - NL_TEST_ASSERT(apSuite, fabricInfo != nullptr); err = chip::Platform::MemoryInit(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index 88ff5a57183bca..6c5ca2d2d1436c 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -54,7 +54,6 @@ static const chip::ClusterId kLivenessClusterId = 0x00000022; static const uint32_t kLivenessChangeEvent = 1; static const chip::EndpointId kTestEndpointId = 2; static const uint64_t kLivenessDeviceStatus = chip::TLV::ContextTag(1); -static const chip::FabricIndex gFabricIndex = 0; static chip::TransportMgr gTransportManager; static chip::System::Layer gSystemLayer; @@ -72,9 +71,6 @@ void InitializeChip(nlTestSuite * apSuite) CHIP_ERROR err = CHIP_NO_ERROR; chip::Optional peer(chip::Transport::Type::kUndefined); chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, kTestDeviceNodeId1); - - NL_TEST_ASSERT(apSuite, fabricInfo != nullptr); err = chip::Platform::MemoryInit(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index 82640b8fa474e7..7f79d8c0c272fe 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -48,7 +48,6 @@ static chip::SecureSessionMgr gSessionManager; static chip::Messaging::ExchangeManager gExchangeManager; static chip::secure_channel::MessageCounterManager gMessageCounterManager; static chip::TransportMgr gTransportManager; -static const chip::FabricIndex gFabricIndex = 0; } // namespace namespace chip { @@ -110,9 +109,6 @@ void InitializeChip(nlTestSuite * apSuite) CHIP_ERROR err = CHIP_NO_ERROR; chip::Optional peer(chip::Transport::Type::kUndefined); chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, chip::kTestDeviceNodeId); - - NL_TEST_ASSERT(apSuite, fabricInfo != nullptr); err = chip::Platform::MemoryInit(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index 80e9f4b3ee2ca6..ef92e44dc6e167 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -49,7 +49,6 @@ static SecureSessionMgr gSessionManager; static Messaging::ExchangeManager gExchangeManager; static TransportMgr gTransportManager; static secure_channel::MessageCounterManager gMessageCounterManager; -static const FabricIndex gFabricIndex = 0; constexpr ClusterId kTestClusterId = 6; constexpr EndpointId kTestEndpointId = 1; constexpr chip::FieldId kTestFieldId1 = 1; @@ -149,9 +148,6 @@ void InitializeChip(nlTestSuite * apSuite) CHIP_ERROR err = CHIP_NO_ERROR; chip::Optional peer(chip::Transport::Type::kUndefined); chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(chip::gFabricIndex, chip::kTestDeviceNodeId); - - NL_TEST_ASSERT(apSuite, fabricInfo != nullptr); err = chip::Platform::MemoryInit(); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index 8276e37373e45c..6681c30b595dc4 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -552,8 +552,6 @@ int main(int argc, char * argv[]) std::unique_lock lock(mutex); MockInteractionModelApp mockDelegate; chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, chip::kTestControllerNodeId); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); if (argc <= 1) { diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp index 93e9dc2a56f13c..5c34571ef5db71 100644 --- a/src/app/tests/integration/chip_im_responder.cpp +++ b/src/app/tests/integration/chip_im_responder.cpp @@ -170,9 +170,6 @@ int main(int argc, char * argv[]) chip::Optional peer(chip::Transport::Type::kUndefined); const chip::FabricIndex gFabricIndex = 0; chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, chip::kTestDeviceNodeId); - - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); InitializeChip(); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 94b45100153e06..ae8aec46ca6f67 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -168,11 +168,6 @@ CHIP_ERROR DeviceController::Init(NodeId localDeviceId, ControllerInitParams par ReturnErrorOnFailure(mFabrics.Init(mStorageDelegate)); - Transport::FabricInfo * const fabric = mFabrics.AssignFabricIndex(mFabricIndex, localDeviceId); - VerifyOrReturnError(fabric != nullptr, CHIP_ERROR_NO_MEMORY); - - ReturnErrorOnFailure(mFabrics.LoadFromStorage(mFabricIndex)); - ReturnErrorOnFailure(mSessionMgr->Init(mSystemLayer, mTransportMgr, &mFabrics, mMessageCounterManager)); ReturnErrorOnFailure(mExchangeMgr->Init(mSessionMgr)); @@ -207,7 +202,10 @@ CHIP_ERROR DeviceController::Init(NodeId localDeviceId, ControllerInitParams par VerifyOrReturnError(params.operationalCredentialsDelegate != nullptr, CHIP_ERROR_INVALID_ARGUMENT); mOperationalCredentialsDelegate = params.operationalCredentialsDelegate; - ReturnErrorOnFailure(LoadLocalCredentials(fabric)); + if (LoadLocalCredentials() != CHIP_NO_ERROR) + { + ReturnErrorOnFailure(GenerateLocalCredentials()); + } ReleaseAllDevices(); @@ -221,23 +219,26 @@ void DeviceController::OnLocalNOCChainGeneration(void * context, CHIP_ERROR stat DeviceController * controller = static_cast(context); - Transport::FabricInfo * const fabric = controller->mFabrics.FindFabricWithIndex(controller->mFabricIndex); + Transport::FabricInfo newFabric; + + newFabric.SetEphemeralKey(&controller->mOperationalKey); constexpr uint32_t chipCertAllocatedLen = kMaxCHIPCertLength * 2; chip::Platform::ScopedMemoryBuffer chipCert; uint32_t chipCertLen = 0; + Transport::FabricInfo * fabric = nullptr; + // Check if the callback returned a failure VerifyOrExit(status == CHIP_NO_ERROR, err = status); - VerifyOrExit(fabric != nullptr, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(chipCert.Alloc(chipCertAllocatedLen), err = CHIP_ERROR_NO_MEMORY); err = ConvertX509CertToChipCert(rcac, chipCert.Get(), chipCertAllocatedLen, chipCertLen); SuccessOrExit(err); - err = fabric->SetRootCert(ByteSpan(chipCert.Get(), chipCertLen)); + err = newFabric.SetRootCert(ByteSpan(chipCert.Get(), chipCertLen)); SuccessOrExit(err); if (icac.empty()) @@ -251,11 +252,24 @@ void DeviceController::OnLocalNOCChainGeneration(void * context, CHIP_ERROR stat err = ConvertX509CertsToChipCertArray(noc, icac, chipCertSpan); SuccessOrExit(err); - err = fabric->SetOperationalCertsFromCertArray(chipCertSpan); + err = newFabric.SetOperationalCertsFromCertArray(chipCertSpan); SuccessOrExit(err); } - err = controller->mFabrics.Store(fabric->GetFabricIndex()); + err = controller->mFabrics.AddNewFabric(newFabric, &controller->mFabricIndex); + SuccessOrExit(err); + ChipLogProgress(Controller, "Added new fabric %d", controller->mFabricIndex); + + ChipLogProgress(Controller, "Storing controller credentials"); + err = controller->mFabrics.Store(controller->mFabricIndex); + SuccessOrExit(err); + + fabric = controller->mFabrics.FindFabricWithIndex(controller->mFabricIndex); + VerifyOrExit(fabric != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + err = fabric->GetCredentials(controller->mCredentials, controller->mCertificates, controller->mRootKeyId, + controller->mCredentialsIndex); + SuccessOrExit(err); exit: if (err != CHIP_NO_ERROR) @@ -265,54 +279,61 @@ void DeviceController::OnLocalNOCChainGeneration(void * context, CHIP_ERROR stat } } -CHIP_ERROR DeviceController::LoadLocalCredentials(Transport::FabricInfo * fabric) +CHIP_ERROR DeviceController::GenerateLocalCredentials() { - ChipLogProgress(Controller, "Getting operational keys"); - Crypto::P256Keypair * keypair = fabric->GetOperationalKey(); + ChipLogProgress(Controller, "Generating new local credentials"); + mOperationalKey.Initialize(); - ReturnErrorCodeIf(keypair == nullptr, CHIP_ERROR_NO_MEMORY); + chip::Platform::ScopedMemoryBuffer CSR; + size_t csrLength = kMaxCHIPCSRLength; + ReturnErrorCodeIf(!CSR.Alloc(csrLength), CHIP_ERROR_NO_MEMORY); - if (!fabric->AreCredentialsAvailable()) - { - chip::Platform::ScopedMemoryBuffer CSR; - size_t csrLength = kMaxCHIPCSRLength; - ReturnErrorCodeIf(!CSR.Alloc(csrLength), CHIP_ERROR_NO_MEMORY); + ReturnErrorOnFailure(mOperationalKey.NewCertificateSigningRequest(CSR.Get(), csrLength)); - ReturnErrorOnFailure(keypair->NewCertificateSigningRequest(CSR.Get(), csrLength)); + ChipLogProgress(Controller, "Getting certificate chain for the controller from the issuer"); - ChipLogProgress(Controller, "Getting certificate chain for the controller from the issuer"); + // As per specifications section 11.22.5.1. Constant RESP_MAX + constexpr uint16_t kMaxRspLen = 900; + chip::Platform::ScopedMemoryBuffer csrElements; + ReturnErrorCodeIf(!csrElements.Alloc(kMaxRspLen), CHIP_ERROR_NO_MEMORY); - // As per specifications section 11.22.5.1. Constant RESP_MAX - constexpr uint16_t kMaxRspLen = 900; - chip::Platform::ScopedMemoryBuffer csrElements; - ReturnErrorCodeIf(!csrElements.Alloc(kMaxRspLen), CHIP_ERROR_NO_MEMORY); + TLV::TLVWriter csrElementWriter; + TLV::TLVType containerType; + csrElementWriter.Init(csrElements.Get(), kMaxRspLen); + ReturnErrorOnFailure(csrElementWriter.StartContainer(TLV::AnonymousTag, TLV::TLVType::kTLVType_Structure, containerType)); + ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(1), ByteSpan(CSR.Get(), csrLength))); + + // TODO - Need a mechanism to generate CSRNonce for commissioner's CSR + ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(2), ByteSpan())); + ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(3), ByteSpan())); + ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(4), ByteSpan())); + ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(5), ByteSpan())); + ReturnErrorOnFailure(csrElementWriter.EndContainer(containerType)); + ReturnErrorOnFailure(csrElementWriter.Finalize()); + + mOperationalCredentialsDelegate->SetNodeIdForNextNOCRequest(mLocalDeviceId); + mOperationalCredentialsDelegate->SetFabricIdForNextNOCRequest(0); - TLV::TLVWriter csrElementWriter; - TLV::TLVType containerType; - csrElementWriter.Init(csrElements.Get(), kMaxRspLen); - ReturnErrorOnFailure(csrElementWriter.StartContainer(TLV::AnonymousTag, TLV::TLVType::kTLVType_Structure, containerType)); - ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(1), ByteSpan(CSR.Get(), csrLength))); + // TODO - Need a mechanism to generate signature for commissioner's CSR + ReturnErrorOnFailure( + mOperationalCredentialsDelegate->GenerateNOCChain(ByteSpan(csrElements.Get(), csrElementWriter.GetLengthWritten()), + ByteSpan(), ByteSpan(), ByteSpan(), ByteSpan(), &mLocalNOCChainCallback)); - // TODO - Need a mechanism to generate CSRNonce for commissioner's CSR - ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(2), ByteSpan())); - ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(3), ByteSpan())); - ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(4), ByteSpan())); - ReturnErrorOnFailure(csrElementWriter.Put(TLV::ContextTag(5), ByteSpan())); - ReturnErrorOnFailure(csrElementWriter.EndContainer(containerType)); - ReturnErrorOnFailure(csrElementWriter.Finalize()); + ChipLogProgress(Controller, "Called credentials delegate to generate credentials"); + return CHIP_NO_ERROR; +} - mOperationalCredentialsDelegate->SetNodeIdForNextNOCRequest(mLocalDeviceId); - mOperationalCredentialsDelegate->SetFabricIdForNextNOCRequest(0); +CHIP_ERROR DeviceController::LoadLocalCredentials() +{ + ChipLogProgress(Controller, "Loading local credentials for fabric %d from the storage", mFabricIndex); + ReturnErrorOnFailure(mFabrics.LoadFromStorage(mFabricIndex)); - // TODO - Need a mechanism to generate signature for commissioner's CSR - ReturnErrorOnFailure(mOperationalCredentialsDelegate->GenerateNOCChain( - ByteSpan(csrElements.Get(), csrElementWriter.GetLengthWritten()), ByteSpan(), ByteSpan(), ByteSpan(), ByteSpan(), - &mLocalNOCChainCallback)); + Transport::FabricInfo * fabric = mFabrics.FindFabricWithIndex(mFabricIndex); + ReturnErrorCodeIf(fabric == nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mFabrics.Store(fabric->GetFabricIndex())); - } + ReturnErrorCodeIf(!fabric->IsInitialized(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorCodeIf(!fabric->AreCredentialsAvailable(), CHIP_ERROR_INCORRECT_STATE); - ChipLogProgress(Controller, "Generating credentials"); ReturnErrorOnFailure(fabric->GetCredentials(mCredentials, mCertificates, mRootKeyId, mCredentialsIndex)); ChipLogProgress(Controller, "Loaded credentials successfully"); diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index be7bbb988f5578..7db176f7807a23 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -345,9 +345,11 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, void PersistNextKeyId(); - FabricIndex mFabricIndex = 0; + FabricIndex mFabricIndex = 1; Transport::FabricTable mFabrics; + Crypto::P256Keypair mOperationalKey; + OperationalCredentialsDelegate * mOperationalCredentialsDelegate; Credentials::ChipCertificateSet mCertificates; @@ -376,7 +378,9 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, void ReleaseAllDevices(); - CHIP_ERROR LoadLocalCredentials(Transport::FabricInfo * fabric); + CHIP_ERROR LoadLocalCredentials(); + + CHIP_ERROR GenerateLocalCredentials(); static void OnLocalNOCChainGeneration(void * context, CHIP_ERROR status, const ByteSpan & noc, const ByteSpan & icac, const ByteSpan & rcac); diff --git a/src/crypto/CHIPCryptoPAL.cpp b/src/crypto/CHIPCryptoPAL.cpp index 747ddaaef9ab1f..eb55ac0231c546 100644 --- a/src/crypto/CHIPCryptoPAL.cpp +++ b/src/crypto/CHIPCryptoPAL.cpp @@ -443,7 +443,13 @@ CHIP_ERROR Spake2p::KeyConfirm(const uint8_t * in, size_t in_len) VerifyOrReturnError(Kcaorb != nullptr, CHIP_ERROR_INTERNAL); ReturnErrorOnFailure(PointWrite(XY, point_buffer, point_size)); - ReturnErrorOnFailure(MacVerify(Kcaorb, hash_size / 2, in, in_len, point_buffer, point_size)); + + CHIP_ERROR err = MacVerify(Kcaorb, hash_size / 2, in, in_len, point_buffer, point_size); + if (err == CHIP_ERROR_INTERNAL) + { + ChipLogError(SecureChannel, "Failed to verify peer's MAC. This can happen when setup code is incorrect."); + } + ReturnErrorOnFailure(err); state = CHIP_SPAKE2P_STATE::KC; return CHIP_NO_ERROR; diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m index 4f46ddc7472fb2..ac2e65a59d2f07 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m @@ -320,15 +320,6 @@ - (IBAction)removeAllFabricsButtonPressed:(id)sender [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()]; - [cluster removeAllFabrics:^(NSError * error, NSDictionary * values) { - BOOL errorOccured = (error != nil); - NSString * resultString = errorOccured - ? [NSString stringWithFormat:@"An error occured: 0x%02lx", error.code] - : @"Remove all fabrics success"; - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateResult:resultString isError:errorOccured]; - }); - }]; } else { [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] isError:YES]; @@ -416,28 +407,6 @@ - (IBAction)removeFabricButtonPressed:(id)sender [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()]; [self updateResult:[NSString stringWithFormat:@"removeFabric command sent for fabricID %@.", fabricId] isError:NO]; - [cluster removeFabric:[fabricId unsignedLongLongValue] - nodeId:[nodeID unsignedLongLongValue] - vendorId:[vendorID unsignedShortValue] - responseHandler:^(NSError * _Nullable error, NSDictionary * _Nullable values) { - if (error) { - NSLog(@"Failed to remove fabric with error %@", error); - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateResult:[NSString - stringWithFormat:@"Command removeFabric failed with error %@", error] - isError:YES]; - self->_removeFabricTextField.text = @""; - }); - } else { - NSLog(@"Succeeded removing fabric!"); - dispatch_async(dispatch_get_main_queue(), ^{ - self->_removeFabricTextField.text = @""; - [self updateResult:[NSString stringWithFormat:@"Command removeFabric succeeded to remove %@", - fabricId] - isError:NO]; - }); - } - }]; } else { [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] isError:YES]; } diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index 687ea8854f1fd3..65a8502b9f0995 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -372,16 +372,6 @@ - (void)setVendorIDOnAccessory if (device) { CHIPOperationalCredentials * opCreds = [[CHIPOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:dispatch_get_main_queue()]; - [opCreds setFabric:kCHIPToolTmpVendorId - responseHandler:^(NSError * _Nullable error, NSDictionary * _Nullable values) { - if (error.code != CHIPSuccess) { - NSLog(@"Got back error trying to getFabricId %@", error); - } else { - NSLog(@"Got back fabricID values %@, storing it", values); - NSNumber * fabricID = [values objectForKey:@"FabricId"]; - CHIPSetDomainValueForKey(kCHIPToolDefaultsDomain, kFabricIdKey, fabricID); - } - }]; } else { NSLog(@"Status: Failed to establish a connection with the device"); } diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index faf8d31b4d5bd8..ade6f2639b930c 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -309,11 +309,6 @@ bool ExchangeContext::MatchExchange(SecureSessionHandle session, const PacketHea // AND The message was received from the peer node associated with the exchange && (mSecureSession == session) - // AND The message's source Node ID matches the peer Node ID associated with the exchange, or the peer Node ID of the - // exchange is 'any'. - && ((mSecureSession.GetPeerNodeId() == kPlaceholderNodeId) || - (packetHeader.GetSourceNodeId().HasValue() && mSecureSession.GetPeerNodeId() == packetHeader.GetSourceNodeId().Value())) - // AND The message was sent by an initiator and the exchange context is a responder (IsInitiator==false) // OR The message was sent by a responder and the exchange context is an initiator (IsInitiator==true) (for the broadcast // case, the initiator is ill defined) diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp index 76f2a5b96e740c..6656f5165c13c7 100644 --- a/src/messaging/tests/MessagingContext.cpp +++ b/src/messaging/tests/MessagingContext.cpp @@ -32,12 +32,6 @@ CHIP_ERROR MessagingContext::Init(nlTestSuite * suite, TransportMgrBase * transp mFabrics.Reset(); - chip::Transport::FabricInfo * srcNodeFabric = mFabrics.AssignFabricIndex(mSrcFabricIndex, GetSourceNodeId()); - VerifyOrReturnError(srcNodeFabric != nullptr, CHIP_ERROR_NO_MEMORY); - - chip::Transport::FabricInfo * destNodeFabric = mFabrics.AssignFabricIndex(mDestFabricIndex, GetDestinationNodeId()); - VerifyOrReturnError(destNodeFabric != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure(mSecureSessionMgr.Init(&GetSystemLayer(), transport, &mFabrics, &mMessageCounterManager)); ReturnErrorOnFailure(mExchangeManager.Init(&mSecureSessionMgr)); diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h index 3153fde2358632..501a65cbbbdcab 100644 --- a/src/messaging/tests/MessagingContext.h +++ b/src/messaging/tests/MessagingContext.h @@ -103,7 +103,7 @@ class MessagingContext SecurePairingUsingTestSecret mPairingLocalToPeer; Transport::FabricTable mFabrics; FabricIndex mSrcFabricIndex = 0; - FabricIndex mDestFabricIndex = 1; + FabricIndex mDestFabricIndex = 0; Credentials::OperationalCredentialSet mOperationalCredentialSet; }; diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index 538ad7d6e4937d..d87600002dd36b 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -201,7 +201,6 @@ int main(int argc, char * argv[]) CHIP_ERROR err = CHIP_NO_ERROR; chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = nullptr; if (argc <= 1) { @@ -228,9 +227,6 @@ int main(int argc, char * argv[]) InitializeChip(); - fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, chip::kTestControllerNodeId); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); - if (gUseTCP) { err = gTCPManager.Init(chip::Transport::TcpListenParameters(&chip::DeviceLayer::InetLayer) diff --git a/src/messaging/tests/echo/echo_responder.cpp b/src/messaging/tests/echo/echo_responder.cpp index 9cc2e15d7bdd84..7bf6f041e07c5e 100644 --- a/src/messaging/tests/echo/echo_responder.cpp +++ b/src/messaging/tests/echo/echo_responder.cpp @@ -62,7 +62,6 @@ int main(int argc, char * argv[]) bool disableEcho = false; chip::Transport::FabricTable fabrics; - chip::Transport::FabricInfo * fabricInfo = nullptr; const chip::FabricIndex gFabricIndex = 0; @@ -84,9 +83,6 @@ int main(int argc, char * argv[]) InitializeChip(); - fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, chip::kTestDeviceNodeId); - VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY); - if (useTCP) { err = gTCPManager.Init( diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index 21eec48890de4a..e5ca4ff389fcbf 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -54,16 +54,13 @@ CHIP_ERROR CASEServer::InitCASEHandshake(Messaging::ExchangeContext * ec) { ReturnErrorCodeIf(ec == nullptr, CHIP_ERROR_INVALID_ARGUMENT); - // TODO - Use PK of the root CA for the initiator to figure out the fabric. - mFabricIndex = ec->GetSecureSession().GetFabricIndex(); - // TODO - Use section [4.368] and definition of `Destination Identifier` to find fabric ID for CASE SigmaR1 message - // ReturnErrorCodeIf(mFabricIndex == Transport::kUndefinedFabricIndex, CHIP_ERROR_INVALID_ARGUMENT); - mFabricIndex = 0; + mFabricIndex = kMinValidFabricIndex; Transport::FabricInfo * fabric = mFabrics->FindFabricWithIndex(mFabricIndex); + ReturnErrorCodeIf(fabric == nullptr, CHIP_ERROR_INVALID_ARGUMENT); - if (fabric == nullptr) + if (!fabric->IsInitialized() || !fabric->AreCredentialsAvailable()) { ReturnErrorOnFailure(mFabrics->LoadFromStorage(mFabricIndex)); fabric = mFabrics->FindFabricWithIndex(mFabricIndex); diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index 207901996350ca..0bf1aca66bb2ed 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -1278,19 +1278,6 @@ CHIP_ERROR CASESession::ValidateReceivedMessage(ExchangeContext * ec, const Pack payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::CASE_SigmaErr), CHIP_ERROR_INVALID_MESSAGE_TYPE); - if (packetHeader.GetSourceNodeId().HasValue()) - { - if (mConnectionState.GetPeerNodeId() == kUndefinedNodeId) - { - mConnectionState.SetPeerNodeId(packetHeader.GetSourceNodeId().Value()); - } - else - { - VerifyOrReturnError(packetHeader.GetSourceNodeId().Value() == mConnectionState.GetPeerNodeId(), - CHIP_ERROR_WRONG_NODE_ID); - } - } - return CHIP_NO_ERROR; } diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index ca0a348033df5a..ee036a67284595 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -10,7 +10,9 @@ chip_test_suite("tests") { test_sources = [ "TestCASESession.cpp", - "TestMessageCounterManager.cpp", + + # TODO - Fix Message Counter Sync to use group key + # "TestMessageCounterManager.cpp", "TestPASESession.cpp", "TestSessionIDAllocator.cpp", "TestStatusReport.cpp", diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 64b0492b7cb94a..f4295708451b52 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -369,11 +369,10 @@ void CASE_SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inConte fabricTable.Init(&storageDelegate); - FabricInfo * fabric = fabricTable.AssignFabricIndex(0); + FabricInfo fabric; - NL_TEST_ASSERT(inSuite, fabric->SetOperationalKey(accessoryOpKeys) == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, fabric->SetRootCert(ByteSpan(sTestCert_Root01_Chip, sTestCert_Root01_Chip_Len)) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, fabric.SetEphemeralKey(&accessoryOpKeys) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, fabric.SetRootCert(ByteSpan(sTestCert_Root01_Chip, sTestCert_Root01_Chip_Len)) == CHIP_NO_ERROR); uint8_t chipCert[kMaxCHIPCertLength * 2]; MutableByteSpan chipCertSpan(chipCert, sizeof(chipCert)); @@ -381,19 +380,21 @@ void CASE_SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inConte ConvertX509CertsToChipCertArray(ByteSpan(sTestCert_Node01_01_DER, sTestCert_Node01_01_DER_Len), ByteSpan(sTestCert_ICA01_DER, sTestCert_ICA01_DER_Len), chipCertSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, fabric->SetOperationalCertsFromCertArray(chipCertSpan) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, fabric.SetOperationalCertsFromCertArray(chipCertSpan) == CHIP_NO_ERROR); - fabricTable.Store(0); - fabricTable.ReleaseFabricIndex(0); + FabricIndex index; + fabricTable.AddNewFabric(fabric, &index); + fabricTable.Store(index); + fabricTable.ReleaseFabricIndex(index); - fabricTable.LoadFromStorage(0); - fabric = fabricTable.FindFabricWithIndex(0); + fabricTable.LoadFromStorage(index); + FabricInfo * loaded_fabric = fabricTable.FindFabricWithIndex(index); ChipCertificateSet certificates; OperationalCredentialSet credentials; CertificateKeyId rootKeyId; uint8_t credentialsIndex; - NL_TEST_ASSERT(inSuite, fabric->GetCredentials(credentials, certificates, rootKeyId, credentialsIndex) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, loaded_fabric->GetCredentials(credentials, certificates, rootKeyId, credentialsIndex) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &gTransportMgr, diff --git a/src/transport/FabricTable.cpp b/src/transport/FabricTable.cpp index 708e48f2bc8541..9fb8116bca6d66 100644 --- a/src/transport/FabricTable.cpp +++ b/src/transport/FabricTable.cpp @@ -53,24 +53,24 @@ CHIP_ERROR FabricInfo::StoreIntoKVS(PersistentStorageDelegate * kvs) StorableFabricInfo * info = chip::Platform::New(); ReturnErrorCodeIf(info == nullptr, CHIP_ERROR_NO_MEMORY); - info->mNodeId = Encoding::LittleEndian::HostSwap64(mNodeId); + info->mNodeId = Encoding::LittleEndian::HostSwap64(mOperationalId.GetNodeId()); info->mFabric = Encoding::LittleEndian::HostSwap16(mFabric); - info->mFabricId = Encoding::LittleEndian::HostSwap64(mFabricId); + info->mFabricId = Encoding::LittleEndian::HostSwap64(mOperationalId.GetFabricId()); info->mVendorId = Encoding::LittleEndian::HostSwap16(mVendorId); size_t stringLength = strnlen(mFabricLabel, kFabricLabelMaxLengthInBytes); memcpy(info->mFabricLabel, mFabricLabel, stringLength); info->mFabricLabel[stringLength] = '\0'; // Set null terminator - if (mOperationalKey != nullptr) + if (mEphemeralKey != nullptr) { - SuccessOrExit(err = mOperationalKey->Serialize(info->mOperationalKey)); + SuccessOrExit(err = mEphemeralKey->Serialize(info->mEphemeralKey)); } else { P256Keypair keypair; SuccessOrExit(err = keypair.Initialize()); - SuccessOrExit(err = keypair.Serialize(info->mOperationalKey)); + SuccessOrExit(err = keypair.Serialize(info->mEphemeralKey)); } if (mRootCert == nullptr || mRootCertLen == 0) @@ -134,9 +134,9 @@ CHIP_ERROR FabricInfo::FetchFromKVS(PersistentStorageDelegate * kvs) SuccessOrExit(err = kvs->SyncGetKeyValue(key, info, infoSize)); - mNodeId = Encoding::LittleEndian::HostSwap64(info->mNodeId); + mOperationalId.SetNodeId(Encoding::LittleEndian::HostSwap64(info->mNodeId)); + mOperationalId.SetFabricId(Encoding::LittleEndian::HostSwap64(info->mFabricId)); id = Encoding::LittleEndian::HostSwap16(info->mFabric); - mFabricId = Encoding::LittleEndian::HostSwap64(info->mFabricId); mVendorId = Encoding::LittleEndian::HostSwap16(info->mVendorId); rootCertLen = Encoding::LittleEndian::HostSwap16(info->mRootCertLen); icaCertLen = Encoding::LittleEndian::HostSwap16(info->mICACertLen); @@ -148,29 +148,29 @@ CHIP_ERROR FabricInfo::FetchFromKVS(PersistentStorageDelegate * kvs) VerifyOrExit(mFabric == id, err = CHIP_ERROR_INCORRECT_STATE); - if (mOperationalKey == nullptr) + if (mEphemeralKey == nullptr) { #ifdef ENABLE_HSM_CASE_OPS_KEY - mOperationalKey = chip::Platform::New(); - mOperationalKey->SetKeyId(CASE_OPS_KEY); + mEphemeralKey = chip::Platform::New(); + mEphemeralKey->SetKeyId(CASE_OPS_KEY); #else - mOperationalKey = chip::Platform::New(); + mEphemeralKey = chip::Platform::New(); #endif } - VerifyOrExit(mOperationalKey != nullptr, err = CHIP_ERROR_NO_MEMORY); - SuccessOrExit(err = mOperationalKey->Deserialize(info->mOperationalKey)); + VerifyOrExit(mEphemeralKey != nullptr, err = CHIP_ERROR_NO_MEMORY); + SuccessOrExit(err = mEphemeralKey->Deserialize(info->mEphemeralKey)); ChipLogProgress(Inet, "Loading certs from KVS"); - SuccessOrExit(SetRootCert(ByteSpan(info->mRootCert, rootCertLen))); - SuccessOrExit(SetICACert(ByteSpan(info->mICACert, icaCertLen))); - SuccessOrExit(SetNOCCert(ByteSpan(info->mNOCCert, nocCertLen))); + SuccessOrExit(err = SetRootCert(ByteSpan(info->mRootCert, rootCertLen))); + SuccessOrExit(err = SetICACert(ByteSpan(info->mICACert, icaCertLen))); + SuccessOrExit(err = SetNOCCert(ByteSpan(info->mNOCCert, nocCertLen))); exit: if (info != nullptr) { chip::Platform::Delete(info); } - return CHIP_NO_ERROR; + return err; } CHIP_ERROR FabricInfo::DeleteFromKVS(PersistentStorageDelegate * kvs, FabricIndex id) @@ -202,21 +202,21 @@ CHIP_ERROR FabricInfo::GenerateKey(FabricIndex id, char * key, size_t len) return CHIP_NO_ERROR; } -CHIP_ERROR FabricInfo::SetOperationalKey(const P256Keypair & key) +CHIP_ERROR FabricInfo::SetEphemeralKey(const P256Keypair * key) { P256SerializedKeypair serialized; - ReturnErrorOnFailure(key.Serialize(serialized)); - if (mOperationalKey == nullptr) + ReturnErrorOnFailure(key->Serialize(serialized)); + if (mEphemeralKey == nullptr) { #ifdef ENABLE_HSM_CASE_OPS_KEY - mOperationalKey = chip::Platform::New(); - mOperationalKey->SetKeyId(CASE_OPS_KEY); + mEphemeralKey = chip::Platform::New(); + mEphemeralKey->SetKeyId(CASE_OPS_KEY); #else - mOperationalKey = chip::Platform::New(); + mEphemeralKey = chip::Platform::New(); #endif } - VerifyOrReturnError(mOperationalKey != nullptr, CHIP_ERROR_NO_MEMORY); - return mOperationalKey->Deserialize(serialized); + VerifyOrReturnError(mEphemeralKey != nullptr, CHIP_ERROR_NO_MEMORY); + return mEphemeralKey->Deserialize(serialized); } void FabricInfo::ReleaseRootCert() @@ -317,6 +317,8 @@ CHIP_ERROR FabricInfo::SetNOCCert(const ByteSpan & cert) ReleaseNOCCert(); } + ReturnErrorOnFailure(ExtractPeerIdFromOpCert(cert, &mOperationalId)); + VerifyOrReturnError(CanCastTo(cert.size()), CHIP_ERROR_INVALID_ARGUMENT); if (mNOCCert == nullptr) { @@ -379,38 +381,11 @@ CHIP_ERROR FabricInfo::GetCredentials(OperationalCredentialSet & credentials, Ch rootKeyId = credentials.GetTrustedRootId(0); ReturnErrorOnFailure(credentials.SetDevOpCred(rootKeyId, mNOCCert, mNOCCertLen)); - ReturnErrorOnFailure(credentials.SetDevOpCredKeypair(rootKeyId, mOperationalKey)); + ReturnErrorOnFailure(credentials.SetDevOpCredKeypair(rootKeyId, mEphemeralKey)); return CHIP_NO_ERROR; } -FabricInfo * FabricTable::AssignFabricIndex(FabricIndex fabricIndex) -{ - for (size_t i = 0; i < CHIP_CONFIG_MAX_DEVICE_ADMINS; i++) - { - if (!mStates[i].IsInitialized()) - { - mStates[i].SetFabricIndex(fabricIndex); - - return &mStates[i]; - } - } - - return nullptr; -} - -FabricInfo * FabricTable::AssignFabricIndex(FabricIndex fabricIndex, NodeId nodeId) -{ - FabricInfo * fabric = AssignFabricIndex(fabricIndex); - - if (fabric != nullptr) - { - fabric->SetNodeId(nodeId); - } - - return fabric; -} - void FabricTable::ReleaseFabricIndex(FabricIndex fabricIndex) { FabricInfo * fabric = FindFabricWithIndex(fabricIndex); @@ -422,49 +397,27 @@ void FabricTable::ReleaseFabricIndex(FabricIndex fabricIndex) FabricInfo * FabricTable::FindFabricWithIndex(FabricIndex fabricIndex) { - for (auto & state : mStates) + if (fabricIndex >= kMinValidFabricIndex && fabricIndex <= kMaxValidFabricIndex) { - if (state.IsInitialized() && state.GetFabricIndex() == fabricIndex) - { - return &state; - } + return &mStates[fabricIndex - kMinValidFabricIndex]; } return nullptr; } -FabricInfo * FabricTable::FindFabricForNode(FabricId fabricId, NodeId nodeId, uint16_t vendorId) +void FabricTable::Reset() { - uint32_t index = 0; - for (auto & state : mStates) + static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); + for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) { - if (state.IsInitialized()) - { - ChipLogProgress(Discovery, - "Checking ind:%" PRIu32 " [fabricId 0x" ChipLogFormatX64 " nodeId 0x" ChipLogFormatX64 - " vendorId %" PRIu16 "] vs" - " [fabricId 0x" ChipLogFormatX64 " nodeId 0x" ChipLogFormatX64 " vendorId %d]", - index, ChipLogValueX64(state.GetFabricId()), ChipLogValueX64(state.GetNodeId()), state.GetVendorId(), - ChipLogValueX64(fabricId), ChipLogValueX64(nodeId), vendorId); - } - if (state.IsInitialized() && state.GetFabricId() == fabricId && - (nodeId == kUndefinedNodeId || state.GetNodeId() == nodeId) && - (vendorId == kUndefinedVendorId || state.GetVendorId() == vendorId)) - { - ChipLogProgress(Discovery, "Found a match!"); - return &state; - } - index++; - } + FabricInfo * fabric = FindFabricWithIndex(i); - return nullptr; -} + if (fabric != nullptr) + { + fabric->Reset(); -void FabricTable::Reset() -{ - for (size_t i = 0; i < CHIP_CONFIG_MAX_DEVICE_ADMINS; i++) - { - mStates[i].Reset(); + fabric->mFabric = i; + } } } @@ -496,13 +449,15 @@ CHIP_ERROR FabricTable::LoadFromStorage(FabricIndex id) VerifyOrExit(mStorage != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); fabric = FindFabricWithIndex(id); - if (fabric == nullptr) + VerifyOrExit(fabric != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); + + if (!fabric->IsInitialized()) { - fabric = AssignFabricIndex(id); didCreateFabric = true; + + err = fabric->FetchFromKVS(mStorage); + SuccessOrExit(err); } - VerifyOrExit(fabric != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); - err = fabric->FetchFromKVS(mStorage); exit: if (err != CHIP_NO_ERROR && didCreateFabric) @@ -517,6 +472,56 @@ CHIP_ERROR FabricTable::LoadFromStorage(FabricIndex id) return err; } +CHIP_ERROR FabricTable::SetFabricInfoIfIndexAvailable(FabricIndex index, FabricInfo & newFabric) +{ + FabricInfo * fabric = FindFabricWithIndex(index); + + if (fabric != nullptr && !fabric->IsInitialized()) + { + fabric->SetEphemeralKey(newFabric.GetEphemeralKey()); + fabric->SetRootCert(ByteSpan(newFabric.mRootCert, newFabric.mRootCertLen)); + fabric->SetICACert(ByteSpan(newFabric.mICACert, newFabric.mICACertLen)); + fabric->SetNOCCert(ByteSpan(newFabric.mNOCCert, newFabric.mNOCCertLen)); + fabric->SetOperationalId(newFabric.mOperationalId); + fabric->SetVendorId(newFabric.GetVendorId()); + fabric->SetFabricLabel(newFabric.GetFabricLabel()); + ChipLogProgress(Discovery, "Added new fabric at index: %d, Initialized: %d", fabric->GetFabricIndex(), + fabric->IsInitialized()); + ChipLogProgress(Discovery, "Assigned fabric ID: 0x" ChipLogFormatX64 ", node ID: 0x" ChipLogFormatX64, + ChipLogValueX64(fabric->mOperationalId.GetFabricId()), ChipLogValueX64(fabric->mOperationalId.GetNodeId())); + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_INVALID_ARGUMENT; +} + +CHIP_ERROR FabricTable::AddNewFabric(FabricInfo & newFabric, FabricIndex * outputIndex) +{ + VerifyOrReturnError(outputIndex != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); + for (FabricIndex i = mNextAvailableFabricIndex; i <= kMaxValidFabricIndex; i++) + { + if (CHIP_NO_ERROR == SetFabricInfoIfIndexAvailable(i, newFabric)) + { + mNextAvailableFabricIndex = static_cast((i + 1) % UINT8_MAX); + *outputIndex = i; + return CHIP_NO_ERROR; + } + } + + for (FabricIndex i = kMinValidFabricIndex; i < kMaxValidFabricIndex; i++) + { + if (CHIP_NO_ERROR == SetFabricInfoIfIndexAvailable(i, newFabric)) + { + mNextAvailableFabricIndex = static_cast((i + 1) % UINT8_MAX); + *outputIndex = i; + return CHIP_NO_ERROR; + } + } + + return CHIP_ERROR_NO_MEMORY; +} + CHIP_ERROR FabricTable::Delete(FabricIndex id) { FabricInfo * fabric = nullptr; @@ -541,6 +546,15 @@ CHIP_ERROR FabricTable::Delete(FabricIndex id) return CHIP_NO_ERROR; } +void FabricTable::DeleteAllFabrics() +{ + static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); + for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + { + Delete(i); + } +} + CHIP_ERROR FabricTable::Init(PersistentStorageDelegate * storage) { VerifyOrReturnError(storage != nullptr, CHIP_ERROR_INVALID_ARGUMENT); diff --git a/src/transport/FabricTable.h b/src/transport/FabricTable.h index 1984050f4241bc..123d3826e05e6c 100644 --- a/src/transport/FabricTable.h +++ b/src/transport/FabricTable.h @@ -41,7 +41,9 @@ namespace chip { namespace Transport { -static constexpr FabricIndex kUndefinedFabricIndex = UINT8_MAX; +static constexpr FabricIndex kUndefinedFabricIndex = 0; +static constexpr FabricIndex kMinValidFabricIndex = 1; +static constexpr FabricIndex kMaxValidFabricIndex = std::min(UINT8_MAX, CHIP_CONFIG_MAX_DEVICE_ADMINS); static constexpr uint8_t kFabricLabelMaxLengthInBytes = 32; // KVS store is sensitive to length of key strings, based on the underlying @@ -70,7 +72,11 @@ struct AccessControlList class DLL_EXPORT FabricInfo { public: - FabricInfo() { Reset(); } + FabricInfo() + { + Reset(); + mFabric = kUndefinedFabricIndex; + } // Returns a pointer to a null terminated char array const uint8_t * GetFabricLabel() const { return Uint8::from_const_char(mFabricLabel); }; @@ -80,42 +86,38 @@ class DLL_EXPORT FabricInfo ~FabricInfo() { - if (mOperationalKey != nullptr) + if (mEphemeralKey != nullptr) { - chip::Platform::Delete(mOperationalKey); + chip::Platform::Delete(mEphemeralKey); } ReleaseRootCert(); ReleaseICACert(); ReleaseNOCCert(); } - NodeId GetNodeId() const { return mNodeId; } - void SetNodeId(NodeId nodeId) { mNodeId = nodeId; } - - FabricId GetFabricId() const { return mFabricId; } - void SetFabricId(FabricId fabricId) { mFabricId = fabricId; } + NodeId GetNodeId() const { return mOperationalId.GetNodeId(); } + FabricId GetFabricId() const { return mOperationalId.GetFabricId(); } FabricIndex GetFabricIndex() const { return mFabric; } - void SetFabricIndex(FabricIndex fabricId) { mFabric = fabricId; } uint16_t GetVendorId() const { return mVendorId; } void SetVendorId(uint16_t vendorId) { mVendorId = vendorId; } - Crypto::P256Keypair * GetOperationalKey() + Crypto::P256Keypair * GetEphemeralKey() { - if (mOperationalKey == nullptr) + if (mEphemeralKey == nullptr) { #ifdef ENABLE_HSM_CASE_OPS_KEY - mOperationalKey = chip::Platform::New(); - mOperationalKey->SetKeyId(CASE_OPS_KEY); + mEphemeralKey = chip::Platform::New(); + mEphemeralKey->SetKeyId(CASE_OPS_KEY); #else - mOperationalKey = chip::Platform::New(); + mEphemeralKey = chip::Platform::New(); #endif - mOperationalKey->Initialize(); + mEphemeralKey->Initialize(); } - return mOperationalKey; + return mEphemeralKey; } - CHIP_ERROR SetOperationalKey(const Crypto::P256Keypair & key); + CHIP_ERROR SetEphemeralKey(const Crypto::P256Keypair * key); bool AreCredentialsAvailable() const { @@ -145,30 +147,26 @@ class DLL_EXPORT FabricInfo // TODO - Update these APIs to take ownership of the buffer, instead of copying // internally. CHIP_ERROR SetOperationalCertsFromCertArray(const chip::ByteSpan & certArray); - CHIP_ERROR SetNOCCert(const chip::ByteSpan & cert); - CHIP_ERROR SetICACert(const chip::ByteSpan & cert); CHIP_ERROR SetRootCert(const chip::ByteSpan & cert); const AccessControlList & GetACL() const { return mACL; } AccessControlList & GetACL() { return mACL; } void SetACL(const AccessControlList & acl) { mACL = acl; } - bool IsInitialized() const { return (mFabric != kUndefinedFabricIndex); } + bool IsInitialized() const { return IsOperationalNodeId(mOperationalId.GetNodeId()); } /** * Reset the state to a completely uninitialized status. */ void Reset() { - mNodeId = kUndefinedNodeId; - mFabric = kUndefinedFabricIndex; - mFabricId = kUndefinedFabricId; + mOperationalId = PeerId(); mVendorId = kUndefinedVendorId; mFabricLabel[0] = '\0'; - if (mOperationalKey != nullptr) + if (mEphemeralKey != nullptr) { - mOperationalKey->Initialize(); + mEphemeralKey->Initialize(); } ReleaseRootCert(); ReleaseICACert(); @@ -178,8 +176,8 @@ class DLL_EXPORT FabricInfo friend class FabricTable; private: - NodeId mNodeId = kUndefinedNodeId; - FabricId mFabricId = kUndefinedFabricId; + PeerId mOperationalId; + FabricIndex mFabric = kUndefinedFabricIndex; uint16_t mVendorId = kUndefinedVendorId; char mFabricLabel[kFabricLabelMaxLengthInBytes + 1] = { '\0' }; @@ -187,9 +185,9 @@ class DLL_EXPORT FabricInfo AccessControlList mACL; #ifdef ENABLE_HSM_CASE_OPS_KEY - Crypto::P256KeypairHSM * mOperationalKey = nullptr; + Crypto::P256KeypairHSM * mEphemeralKey = nullptr; #else - Crypto::P256Keypair * mOperationalKey = nullptr; + Crypto::P256Keypair * mEphemeralKey = nullptr; #endif uint8_t * mRootCert = nullptr; @@ -208,6 +206,11 @@ class DLL_EXPORT FabricInfo CHIP_ERROR FetchFromKVS(PersistentStorageDelegate * kvs); static CHIP_ERROR DeleteFromKVS(PersistentStorageDelegate * kvs, FabricIndex id); + void SetOperationalId(PeerId id) { mOperationalId = id; } + + CHIP_ERROR SetNOCCert(const chip::ByteSpan & cert); + CHIP_ERROR SetICACert(const chip::ByteSpan & cert); + void ReleaseNOCCert(); void ReleaseICACert(); void ReleaseRootCert(); @@ -223,7 +226,7 @@ class DLL_EXPORT FabricInfo uint16_t mICACertLen; /* This field is serialized in LittleEndian byte order */ uint16_t mNOCCertLen; /* This field is serialized in LittleEndian byte order */ - Crypto::P256SerializedKeypair mOperationalKey; + Crypto::P256SerializedKeypair mEphemeralKey; uint8_t mRootCert[Credentials::kMaxCHIPCertLength]; uint8_t mICACert[Credentials::kMaxCHIPCertLength]; uint8_t mNOCCert[Credentials::kMaxCHIPCertLength]; @@ -324,20 +327,28 @@ class ConstFabricIterator class DLL_EXPORT FabricTable { public: + FabricTable() { Reset(); } CHIP_ERROR Store(FabricIndex id); CHIP_ERROR LoadFromStorage(FabricIndex id); - CHIP_ERROR Delete(FabricIndex id); - FabricInfo * AssignFabricIndex(FabricIndex fabricId); + CHIP_ERROR Delete(FabricIndex id); + void DeleteAllFabrics(); - FabricInfo * AssignFabricIndex(FabricIndex fabricId, NodeId nodeId); + /** + * Add the new fabric information to fabric table if the table has space to store + * more fabrics. CHIP_ERROR_NO_MEMORY error will be returned if the table is full. + * + * The provided information will get copied to internal data structures, and the caller + * can release the memory associated with input parameter after the call is complete. + * + * If the call is successful, the assigned fabric index is returned as output parameter. + */ + CHIP_ERROR AddNewFabric(FabricInfo & fabric, FabricIndex * assignedIndex); void ReleaseFabricIndex(FabricIndex fabricId); FabricInfo * FindFabricWithIndex(FabricIndex fabricId); - FabricInfo * FindFabricForNode(FabricId fabricId, NodeId nodeId = kUndefinedNodeId, uint16_t vendorId = kUndefinedVendorId); - void Reset(); CHIP_ERROR Init(PersistentStorageDelegate * storage); @@ -351,23 +362,16 @@ class DLL_EXPORT FabricTable ConstFabricIterator begin() const { return cbegin(); } ConstFabricIterator end() const { return cend(); } - uint8_t GetFabricIndex(FabricInfo * fabric) const - { - std::ptrdiff_t diff = reinterpret_cast(fabric) - reinterpret_cast(&mStates[0]); - assert(diff >= 0); - assert(static_cast(diff) % sizeof(FabricInfo) == 0); - auto index = static_cast(diff) / sizeof(FabricInfo); - assert(index < CHIP_CONFIG_MAX_DEVICE_ADMINS); - assert(index < UINT8_MAX); - return static_cast(index); - } - private: FabricInfo mStates[CHIP_CONFIG_MAX_DEVICE_ADMINS]; PersistentStorageDelegate * mStorage = nullptr; // TODO: Fabric table should be backed by a single backing store (attribute store), remove delegate callbacks #6419 FabricTableDelegate * mDelegate = nullptr; + + FabricIndex mNextAvailableFabricIndex = kMinValidFabricIndex; + + CHIP_ERROR SetFabricInfoIfIndexAvailable(FabricIndex index, FabricInfo & fabric); }; } // namespace Transport diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp index ff3481fcc66572..5cafed0ae54e30 100644 --- a/src/transport/SecureMessageCodec.cpp +++ b/src/transport/SecureMessageCodec.cpp @@ -36,8 +36,8 @@ using System::PacketBufferHandle; namespace SecureMessageCodec { -CHIP_ERROR Encode(NodeId localNodeId, Transport::PeerConnectionState * state, PayloadHeader & payloadHeader, - PacketHeader & packetHeader, System::PacketBufferHandle & msgBuf, MessageCounter & counter) +CHIP_ERROR Encode(Transport::PeerConnectionState * state, PayloadHeader & payloadHeader, PacketHeader & packetHeader, + System::PacketBufferHandle & msgBuf, MessageCounter & counter) { VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); @@ -49,15 +49,9 @@ CHIP_ERROR Encode(NodeId localNodeId, Transport::PeerConnectionState * state, Pa "Addition to generate payloadLength might overflow"); packetHeader - .SetSourceNodeId(localNodeId) // - .SetMessageId(msgId) // + .SetMessageId(msgId) // .SetEncryptionKeyID(state->GetPeerKeyID()); - if (state->GetPeerNodeId() != kUndefinedNodeId) - { - packetHeader.SetDestinationNodeId(state->GetPeerNodeId()); - } - packetHeader.GetFlags().Set(Header::FlagValues::kEncryptedMessage); ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(msgBuf)); diff --git a/src/transport/SecureMessageCodec.h b/src/transport/SecureMessageCodec.h index edf5b2b47d0c3e..2656b2432ff18d 100644 --- a/src/transport/SecureMessageCodec.h +++ b/src/transport/SecureMessageCodec.h @@ -38,7 +38,6 @@ namespace SecureMessageCodec { * Attach payload header to the message and encrypt the message buffer using * key from the connection state. * - * @param localNodeId Node Id of local node * @param state The connection state with peer node * @param payloadHeader Reference to the payload header that should be inserted in * the message @@ -50,8 +49,8 @@ namespace SecureMessageCodec { * @param counter The local counter object to be used * @ return CHIP_ERROR The result of the encode operation */ -CHIP_ERROR Encode(NodeId localNodeId, Transport::PeerConnectionState * state, PayloadHeader & payloadHeader, - PacketHeader & packetHeader, System::PacketBufferHandle & msgBuf, MessageCounter & counter); +CHIP_ERROR Encode(Transport::PeerConnectionState * state, PayloadHeader & payloadHeader, PacketHeader & packetHeader, + System::PacketBufferHandle & msgBuf, MessageCounter & counter); /** * @brief diff --git a/src/transport/SecureSessionHandle.h b/src/transport/SecureSessionHandle.h index 71a781ff53229a..fd052841ff0a6a 100644 --- a/src/transport/SecureSessionHandle.h +++ b/src/transport/SecureSessionHandle.h @@ -35,7 +35,7 @@ class SecureSessionHandle bool operator==(const SecureSessionHandle & that) const { - return mPeerNodeId == that.mPeerNodeId && mPeerKeyId == that.mPeerKeyId && mFabric == that.mFabric; + return mPeerNodeId == that.mPeerNodeId && mPeerKeyId == that.mPeerKeyId; } NodeId GetPeerNodeId() const { return mPeerNodeId; } diff --git a/src/transport/SecureSessionMgr.cpp b/src/transport/SecureSessionMgr.cpp index 08d68ac5e4216a..330f8e52bb7137 100644 --- a/src/transport/SecureSessionMgr.cpp +++ b/src/transport/SecureSessionMgr.cpp @@ -121,25 +121,15 @@ CHIP_ERROR SecureSessionMgr::BuildEncryptedMessagePayload(SecureSessionHandle se return CHIP_ERROR_NOT_CONNECTED; } - Transport::FabricInfo * fabric = mFabrics->FindFabricWithIndex(state->GetFabricIndex()); - if (fabric == nullptr) - { - return CHIP_ERROR_INCORRECT_STATE; - } - - NodeId localNodeId = fabric->GetNodeId(); MessageCounter & counter = GetSendCounterForPacket(payloadHeader, *state); - ReturnErrorOnFailure(SecureMessageCodec::Encode(localNodeId, state, payloadHeader, packetHeader, msgBuf, counter)); + ReturnErrorOnFailure(SecureMessageCodec::Encode(state, payloadHeader, packetHeader, msgBuf, counter)); ReturnErrorOnFailure(packetHeader.EncodeBeforeData(msgBuf)); encryptedMessage = EncryptedPacketBufferHandle::MarkEncrypted(std::move(msgBuf)); - ChipLogProgress(Inet, - "Encrypted message %p from 0x" ChipLogFormatX64 " to 0x" ChipLogFormatX64 " of type %d and protocolId %" PRIu32 - " on exchange %d.", - &encryptedMessage, ChipLogValueX64(localNodeId), ChipLogValueX64(state->GetPeerNodeId()), - payloadHeader.GetMessageType(), payloadHeader.GetProtocolID().ToFullyQualifiedSpecForm(), - payloadHeader.GetExchangeID()); + ChipLogProgress(Inet, "Encrypted message %p to 0x" ChipLogFormatX64 " of type %d and protocolId %" PRIu32 " on exchange %d.", + &encryptedMessage, ChipLogValueX64(state->GetPeerNodeId()), payloadHeader.GetMessageType(), + payloadHeader.GetProtocolID().ToFullyQualifiedSpecForm(), payloadHeader.GetExchangeID()); return CHIP_NO_ERROR; } @@ -322,12 +312,6 @@ void SecureSessionMgr::SecureMessageDispatch(const PacketHeader & packetHeader, PayloadHeader payloadHeader; - Transport::FabricInfo * fabric = nullptr; - - bool modifiedFabric = false; - NodeId localNodeId; - FabricId fabricId; - SecureSessionMgrDelegate::DuplicateMessage isDuplicate = SecureSessionMgrDelegate::DuplicateMessage::No; VerifyOrExit(!msg.IsNull(), ChipLogError(Inet, "Secure transport received NULL packet, discarding")); @@ -381,32 +365,6 @@ void SecureSessionMgr::SecureMessageDispatch(const PacketHeader & packetHeader, SuccessOrExit(err); } - fabric = mFabrics->FindFabricWithIndex(state->GetFabricIndex()); - VerifyOrExit(fabric != nullptr, - ChipLogError(Inet, "Secure transport received packet for unknown fabric (%p, %d) pairing, discarding", state, - state->GetFabricIndex())); - if (packetHeader.GetDestinationNodeId().HasValue() && fabric->GetNodeId() != kUndefinedNodeId) - { - VerifyOrExit(fabric->GetNodeId() == packetHeader.GetDestinationNodeId().Value(), - ChipLogError(Inet, - "Secure transport received message, but destination node ID (0x" ChipLogFormatX64 - ") doesn't match our node ID (0x" ChipLogFormatX64 "), discarding", - ChipLogValueX64(packetHeader.GetDestinationNodeId().Value()), - ChipLogValueX64(fabric->GetNodeId()))); - } - - if (packetHeader.GetDestinationNodeId().HasValue()) - { - ChipLogProgress(Inet, "Secure transport received message destined to fabric %d, node 0x" ChipLogFormatX64 ". Key ID %d", - static_cast(state->GetFabricIndex()), ChipLogValueX64(packetHeader.GetDestinationNodeId().Value()), - packetHeader.GetEncryptionKeyID()); - } - else - { - ChipLogProgress(Inet, "Secure transport received message for fabric %d without node ID. Key ID %d", - static_cast(state->GetFabricIndex()), packetHeader.GetEncryptionKeyID()); - } - mPeerConnections.MarkConnectionActive(state); // Decode the message @@ -429,49 +387,6 @@ void SecureSessionMgr::SecureMessageDispatch(const PacketHeader & packetHeader, state->GetSessionMessageCounter().GetPeerMessageCounter().Commit(packetHeader.GetMessageId()); } - // See operational-credentials-server.cpp for explanation as to why fabricId is being set to commissioner node id - // This is temporary code until AddOptCert is implemented through which a fabric will be correctly added with the correct - // fields. - // TODO: Remove temporary code once AddOptCert is implemented - if (packetHeader.GetSourceNodeId().HasValue()) - { - if (state->GetPeerNodeId() == kUndefinedNodeId) - { - state->SetPeerNodeId(packetHeader.GetSourceNodeId().Value()); - } - } - - // TODO: Remove temporary code once AddOptCert is implemented - if (packetHeader.GetDestinationNodeId().HasValue()) - { - localNodeId = packetHeader.GetDestinationNodeId().Value(); - if (localNodeId != kUndefinedNodeId && fabric->GetNodeId() != localNodeId) - { - fabric->SetNodeId(localNodeId); - ChipLogProgress(Inet, "Setting nodeID %" PRIX64 " on fabric.", fabric->GetNodeId()); - modifiedFabric = true; - } - } - - // TODO: Remove temporary code once AddOptCert is implemented - if (packetHeader.GetSourceNodeId().HasValue()) - { - fabricId = packetHeader.GetSourceNodeId().Value(); - if (fabricId != kUndefinedFabricId && fabric->GetFabricId() != fabricId) - { - fabric->SetFabricId(packetHeader.GetSourceNodeId().Value()); - ChipLogProgress(Inet, "Setting fabricID %" PRIX64 " on fabric.", fabric->GetFabricId()); - modifiedFabric = true; - } - } - - // TODO: Remove temporary code once AddOptCert is implemented - if (modifiedFabric) - { - ChipLogProgress(Inet, "Since fabric was modified, persisting changes to KVS"); - mFabrics->Store(fabric->GetFabricIndex()); - } - // TODO: once mDNS address resolution is available reconsider if this is required // This updates the peer address once a packet is received from a new address // and serves as a way to auto-detect peer changing IPs. diff --git a/src/transport/tests/TestSecureSessionMgr.cpp b/src/transport/tests/TestSecureSessionMgr.cpp index 47a6b5fdb47825..8cafaed6b89bc1 100644 --- a/src/transport/tests/TestSecureSessionMgr.cpp +++ b/src/transport/tests/TestSecureSessionMgr.cpp @@ -66,8 +66,6 @@ class TestSessMgrCallback : public SecureSessionMgrDelegate const Transport::PeerAddress & source, DuplicateMessage isDuplicate, System::PacketBufferHandle && msgBuf) override { - NL_TEST_ASSERT(mSuite, header.GetSourceNodeId() == Optional::Value(kSourceNodeId)); - NL_TEST_ASSERT(mSuite, header.GetDestinationNodeId() == Optional::Value(kDestinationNodeId)); NL_TEST_ASSERT(mSuite, session == mRemoteToLocalSession); // Packet received by remote peer size_t data_len = msgBuf->DataLength(); @@ -158,12 +156,6 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - Transport::FabricInfo * fabric = fabrics.AssignFabricIndex(0, kSourceNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - - fabric = fabrics.AssignFabricIndex(1, kDestinationNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - SecurePairingUsingTestSecret pairing1(1, 2); err = secureSessionMgr.NewPairing(peer, kSourceNodeId, &pairing1, SecureSession::SessionRole::kInitiator, 1); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); @@ -254,12 +246,6 @@ void SendEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - Transport::FabricInfo * fabric = fabrics.AssignFabricIndex(0, kSourceNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - - fabric = fabrics.AssignFabricIndex(1, kDestinationNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - SecurePairingUsingTestSecret pairing1(1, 2); err = secureSessionMgr.NewPairing(peer, kSourceNodeId, &pairing1, SecureSession::SessionRole::kInitiator, 1); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); @@ -334,12 +320,6 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - Transport::FabricInfo * fabric = fabrics.AssignFabricIndex(0, kSourceNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - - fabric = fabrics.AssignFabricIndex(1, kDestinationNodeId); - NL_TEST_ASSERT(inSuite, fabric != nullptr); - SecurePairingUsingTestSecret pairing1(1, 2); err = secureSessionMgr.NewPairing(peer, kSourceNodeId, &pairing1, SecureSession::SessionRole::kInitiator, 1); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); @@ -379,50 +359,6 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) PacketHeader packetHeader; - // Change Destination Node ID - EncryptedPacketBufferHandle badDestNodeIdMsg = preparedMessage.CloneData(); - NL_TEST_ASSERT(inSuite, badDestNodeIdMsg.ExtractPacketHeader(packetHeader) == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, packetHeader.GetDestinationNodeId().Value() == kDestinationNodeId); - packetHeader.SetDestinationNodeId(kSourceNodeId); - NL_TEST_ASSERT(inSuite, badDestNodeIdMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR); - - err = secureSessionMgr.SendPreparedMessage(localToRemoteSession, badDestNodeIdMsg); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); - - /* -------------------------------------------------------------------------------------------*/ - state->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1); - - // Change Source Node ID - EncryptedPacketBufferHandle badSrcNodeIdMsg = preparedMessage.CloneData(); - NL_TEST_ASSERT(inSuite, badSrcNodeIdMsg.ExtractPacketHeader(packetHeader) == CHIP_NO_ERROR); - - packetHeader.SetSourceNodeId(kDestinationNodeId); - NL_TEST_ASSERT(inSuite, badSrcNodeIdMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR); - - err = secureSessionMgr.SendPreparedMessage(localToRemoteSession, badSrcNodeIdMsg); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); - - /* -------------------------------------------------------------------------------------------*/ - state->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1); - - // Change Source Node ID - EncryptedPacketBufferHandle noDstNodeIdMsg = preparedMessage.CloneData(); - NL_TEST_ASSERT(inSuite, noDstNodeIdMsg.ExtractPacketHeader(packetHeader) == CHIP_NO_ERROR); - - packetHeader.ClearDestinationNodeId(); - NL_TEST_ASSERT(inSuite, noDstNodeIdMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR); - - err = secureSessionMgr.SendPreparedMessage(localToRemoteSession, noDstNodeIdMsg); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); - - /* -------------------------------------------------------------------------------------------*/ state->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1); // Change Message ID