Matter SDK Coverage Report
Current view: top level - app - CASEClient.cpp (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 0.0 % 16 0
Test Date: 2025-01-17 19:00:11 Functions: 0.0 % 3 0

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2021 Project CHIP Authors
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : #include <app/CASEClient.h>
      19              : #include <messaging/ReliableMessageProtocolConfig.h>
      20              : 
      21              : namespace chip {
      22              : 
      23            0 : void CASEClient::SetRemoteMRPIntervals(const ReliableMessageProtocolConfig & remoteMRPConfig)
      24              : {
      25            0 :     mCASESession.SetRemoteMRPConfig(remoteMRPConfig);
      26            0 : }
      27              : 
      28            0 : const ReliableMessageProtocolConfig & CASEClient::GetRemoteMRPIntervals()
      29              : {
      30            0 :     return mCASESession.GetRemoteMRPConfig();
      31              : }
      32              : 
      33            0 : CHIP_ERROR CASEClient::EstablishSession(const CASEClientInitParams & params, const ScopedNodeId & peer,
      34              :                                         const Transport::PeerAddress & peerAddress,
      35              :                                         const ReliableMessageProtocolConfig & remoteMRPConfig,
      36              :                                         SessionEstablishmentDelegate * delegate)
      37              : {
      38            0 :     VerifyOrReturnError(params.fabricTable != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
      39              : 
      40              :     // Create a UnauthenticatedSession for CASE pairing.
      41            0 :     Optional<SessionHandle> session = params.sessionManager->CreateUnauthenticatedSession(peerAddress, remoteMRPConfig);
      42            0 :     VerifyOrReturnError(session.HasValue(), CHIP_ERROR_NO_MEMORY);
      43              : 
      44              :     // Allocate the exchange immediately before calling CASESession::EstablishSession.
      45              :     //
      46              :     // CASESession::EstablishSession takes ownership of the exchange and will
      47              :     // free it on error, but can only do this if it is actually called.
      48              :     // Allocating the exchange context right before calling EstablishSession
      49              :     // ensures that if allocation succeeds, CASESession has taken ownership.
      50            0 :     Messaging::ExchangeContext * exchange = params.exchangeMgr->NewContext(session.Value(), &mCASESession);
      51            0 :     VerifyOrReturnError(exchange != nullptr, CHIP_ERROR_INTERNAL);
      52              : 
      53              :     const Optional<ReliableMessageProtocolConfig> & mrpLocalConfig =
      54            0 :         params.mrpLocalConfig.HasValue() ? params.mrpLocalConfig : GetLocalMRPConfig();
      55            0 :     mCASESession.SetGroupDataProvider(params.groupDataProvider);
      56            0 :     ReturnErrorOnFailure(mCASESession.EstablishSession(*params.sessionManager, params.fabricTable, peer, exchange,
      57              :                                                        params.sessionResumptionStorage, params.certificateValidityPolicy, delegate,
      58              :                                                        mrpLocalConfig));
      59              : 
      60            0 :     return CHIP_NO_ERROR;
      61            0 : }
      62              : 
      63              : }; // namespace chip
        

Generated by: LCOV version 2.0-1