LCOV - code coverage report
Current view: top level - protocols/secure_channel - SessionEstablishmentDelegate.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 1 7 14.3 %
Date: 2024-02-15 08:20:41 Functions: 1 6 16.7 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2021 Project CHIP Authors
       4             :  *    All rights reserved.
       5             :  *
       6             :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7             :  *    you may not use this file except in compliance with the License.
       8             :  *    You may obtain a copy of the License at
       9             :  *
      10             :  *        http://www.apache.org/licenses/LICENSE-2.0
      11             :  *
      12             :  *    Unless required by applicable law or agreed to in writing, software
      13             :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14             :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15             :  *    See the License for the specific language governing permissions and
      16             :  *    limitations under the License.
      17             :  */
      18             : 
      19             : /**
      20             :  *    @file
      21             :  *      This file defines the Delegate class that contains callbacks to
      22             :  *      establish a secure session and update status of the session establishment process.
      23             :  *
      24             :  */
      25             : 
      26             : #pragma once
      27             : 
      28             : #include <system/SystemPacketBuffer.h>
      29             : #include <transport/Session.h>
      30             : #include <transport/raw/MessageHeader.h>
      31             : #include <transport/raw/PeerAddress.h>
      32             : 
      33             : namespace chip {
      34             : 
      35             : enum class SessionEstablishmentStage : uint8_t
      36             : {
      37             :     kUnknown          = 0,
      38             :     kNotInKeyExchange = 1,
      39             :     kSentSigma1       = 2,
      40             :     kReceivedSigma1   = 3,
      41             :     kSentSigma2       = 4,
      42             :     kReceivedSigma2   = 5,
      43             :     kSentSigma3       = 6,
      44             :     kReceivedSigma3   = 7,
      45             : };
      46             : 
      47             : class DLL_EXPORT SessionEstablishmentDelegate
      48             : {
      49             : public:
      50             :     /**
      51             :      *   Called when session establishment fails with an error.  This will be
      52             :      *   called at most once per session establishment and will not be called if
      53             :      *   OnSessionEstablished is called.
      54             :      *
      55             :      *   This overload of OnSessionEstablishmentError is not called directly.
      56             :      *   It's only called from the default implementation of the two-argument
      57             :      *   overload.
      58             :      */
      59           0 :     virtual void OnSessionEstablishmentError(CHIP_ERROR error) {}
      60             : 
      61             :     /**
      62             :      *   Called when session establishment fails with an error and state at the
      63             :      *   failure. This will be called at most once per session establishment and
      64             :      *   will not be called if OnSessionEstablished is called.
      65             :      */
      66           0 :     virtual void OnSessionEstablishmentError(CHIP_ERROR error, SessionEstablishmentStage stage)
      67             :     {
      68           0 :         OnSessionEstablishmentError(error);
      69           0 :     }
      70             : 
      71             :     /**
      72             :      *   Called on start of session establishment process
      73             :      */
      74           0 :     virtual void OnSessionEstablishmentStarted() {}
      75             : 
      76             :     /**
      77             :      *   Called when the new secure session has been established.  This is
      78             :      *   mututally exclusive with OnSessionEstablishmentError for a give session
      79             :      *   establishment.
      80             :      */
      81           0 :     virtual void OnSessionEstablished(const SessionHandle & session) {}
      82             : 
      83           2 :     virtual ~SessionEstablishmentDelegate() {}
      84             : };
      85             : 
      86             : } // namespace chip

Generated by: LCOV version 1.14