LCOV - code coverage report
Current view: top level - app/icd/client - ICDClientInfo.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 12 12 100.0 %
Date: 2024-02-15 08:20:41 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2023 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             : #pragma once
      19             : 
      20             : #include <crypto/CHIPCryptoPAL.h>
      21             : #include <lib/core/CHIPConfig.h>
      22             : #include <lib/core/DataModelTypes.h>
      23             : #include <lib/core/ScopedNodeId.h>
      24             : #include <lib/support/CodeUtils.h>
      25             : #include <stddef.h>
      26             : 
      27             : namespace chip {
      28             : namespace app {
      29             : 
      30             : struct ICDClientInfo
      31             : {
      32             :     ScopedNodeId peer_node;
      33             :     uint32_t start_icd_counter               = 0;
      34             :     uint32_t offset                          = 0;
      35             :     uint64_t monitored_subject               = static_cast<uint64_t>(0);
      36             :     Crypto::Aes128KeyHandle aes_key_handle   = Crypto::Aes128KeyHandle();
      37             :     Crypto::Hmac128KeyHandle hmac_key_handle = Crypto::Hmac128KeyHandle();
      38             : 
      39          24 :     ICDClientInfo() {}
      40          27 :     ICDClientInfo(const ICDClientInfo & other) { *this = other; }
      41             : 
      42          33 :     ICDClientInfo & operator=(const ICDClientInfo & other)
      43             :     {
      44          33 :         peer_node         = other.peer_node;
      45          33 :         start_icd_counter = other.start_icd_counter;
      46          33 :         offset            = other.offset;
      47          33 :         monitored_subject = other.monitored_subject;
      48          33 :         ByteSpan aes_buf(other.aes_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>());
      49          33 :         memcpy(aes_key_handle.AsMutable<Crypto::Symmetric128BitsKeyByteArray>(), aes_buf.data(),
      50             :                sizeof(Crypto::Symmetric128BitsKeyByteArray));
      51          33 :         ByteSpan hmac_buf(other.hmac_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>());
      52          33 :         memcpy(hmac_key_handle.AsMutable<Crypto::Symmetric128BitsKeyByteArray>(), hmac_buf.data(),
      53             :                sizeof(Crypto::Symmetric128BitsKeyByteArray));
      54          33 :         return *this;
      55             :     }
      56             : };
      57             : 
      58             : } // namespace app
      59             : } // namespace chip

Generated by: LCOV version 1.14