/* * * 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. */ #pragma once #include #include #include #include namespace chip { class CASEClient; struct CASEClientInitParams { SessionManager * sessionManager = nullptr; SessionResumptionStorage * sessionResumptionStorage = nullptr; Credentials::CertificateValidityPolicy * certificateValidityPolicy = nullptr; Messaging::ExchangeManager * exchangeMgr = nullptr; FabricTable * fabricTable = nullptr; Credentials::GroupDataProvider * groupDataProvider = nullptr; // mrpLocalConfig should not generally be set to anything other than // NullOptional. Doing that can lead to different parts of the system // claiming different MRP parameters for the same node. Optional mrpLocalConfig = NullOptional; CHIP_ERROR Validate() const { // sessionResumptionStorage can be nullptr when resumption is disabled. // certificateValidityPolicy is optional, too. VerifyOrReturnError(sessionManager != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(exchangeMgr != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(fabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(groupDataProvider != nullptr, CHIP_ERROR_INCORRECT_STATE); return CHIP_NO_ERROR; } }; class DLL_EXPORT CASEClient { public: void SetRemoteMRPIntervals(const ReliableMessageProtocolConfig & remoteMRPConfig); const ReliableMessageProtocolConfig & GetRemoteMRPIntervals(); CHIP_ERROR EstablishSession(const CASEClientInitParams & params, const ScopedNodeId & peer, const Transport::PeerAddress & peerAddress, const ReliableMessageProtocolConfig & remoteMRPConfig, SessionEstablishmentDelegate * delegate); private: CASESession mCASESession; }; } // namespace chip