Home | History | Annotate | Download | only in common
      1 //
      2 // Copyright (C) 2015 The Android Open Source Project
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 //      http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 //
     16 
     17 #ifndef TPM_MANAGER_COMMON_TPM_NVRAM_INTERFACE_H_
     18 #define TPM_MANAGER_COMMON_TPM_NVRAM_INTERFACE_H_
     19 
     20 #include <base/callback.h>
     21 
     22 #include "tpm_manager/common/export.h"
     23 #include "tpm_manager/common/tpm_nvram_interface.pb.h"
     24 
     25 namespace tpm_manager {
     26 
     27 // This is the interface to access the nvram subsystem of the Tpm. It is
     28 // extended by TpmManagerInterface.
     29 class TPM_MANAGER_EXPORT TpmNvramInterface {
     30  public:
     31   virtual ~TpmNvramInterface() = default;
     32 
     33   // Processes a DefineNvramRequest and responds with a DefineNvramReply.
     34   using DefineNvramCallback = base::Callback<void(const DefineNvramReply&)>;
     35   virtual void DefineNvram(const DefineNvramRequest& request,
     36                            const DefineNvramCallback& callback) = 0;
     37 
     38   // Processes a DestroyNvramRequest and responds with a DestroyNvramReply.
     39   using DestroyNvramCallback = base::Callback<void(const DestroyNvramReply&)>;
     40   virtual void DestroyNvram(const DestroyNvramRequest& request,
     41                             const DestroyNvramCallback& callback) = 0;
     42 
     43   // Processes a WriteNvramRequest and responds with a WriteNvramReply.
     44   using WriteNvramCallback = base::Callback<void(const WriteNvramReply&)>;
     45   virtual void WriteNvram(const WriteNvramRequest& request,
     46                           const WriteNvramCallback& callback) = 0;
     47 
     48   // Processes a ReadNvramRequest and responds with a ReadNvramReply.
     49   using ReadNvramCallback = base::Callback<void(const ReadNvramReply&)>;
     50   virtual void ReadNvram(const ReadNvramRequest& request,
     51                          const ReadNvramCallback& callback) = 0;
     52 
     53   // Processes a IsNvramDefinedRequest and responds with a IsNvramDefinedReply.
     54   using IsNvramDefinedCallback =
     55       base::Callback<void(const IsNvramDefinedReply&)>;
     56   virtual void IsNvramDefined(const IsNvramDefinedRequest& request,
     57                               const IsNvramDefinedCallback& callback) = 0;
     58 
     59   // Processes a IsNvramLockedRequest and responds with a IsNvramLockedReply.
     60   using IsNvramLockedCallback = base::Callback<void(const IsNvramLockedReply&)>;
     61   virtual void IsNvramLocked(const IsNvramLockedRequest& request,
     62                              const IsNvramLockedCallback& callback) = 0;
     63 
     64   // Processes a GetNvramSizeRequest and responds with a GetNvramSizeReply.
     65   using GetNvramSizeCallback = base::Callback<void(const GetNvramSizeReply&)>;
     66   virtual void GetNvramSize(const GetNvramSizeRequest& request,
     67                             const GetNvramSizeCallback& callback) = 0;
     68 };
     69 
     70 }  // namespace tpm_manager
     71 
     72 #endif  // TPM_MANAGER_COMMON_TPM_NVRAM_INTERFACE_H_
     73