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_OWNERSHIP_INTERFACE_H_
     18 #define TPM_MANAGER_COMMON_TPM_OWNERSHIP_INTERFACE_H_
     19 
     20 #include <base/callback.h>
     21 
     22 #include "tpm_manager/common/export.h"
     23 #include "tpm_manager/common/tpm_manager.pb.h"
     24 
     25 namespace tpm_manager {
     26 
     27 // The command interface for TPM administration. Inherited by both IPC proxy
     28 // and service classes. All methods are asynchronous because all TPM operations
     29 // may take a long time to finish.
     30 class TPM_MANAGER_EXPORT TpmOwnershipInterface {
     31  public:
     32   virtual ~TpmOwnershipInterface() = default;
     33 
     34   // Processes a GetTpmStatusRequest and responds with a GetTpmStatusReply.
     35   using GetTpmStatusCallback = base::Callback<void(const GetTpmStatusReply&)>;
     36   virtual void GetTpmStatus(const GetTpmStatusRequest& request,
     37                             const GetTpmStatusCallback& callback) = 0;
     38 
     39   // Processes a TakeOwnershipRequest and responds with a TakeOwnershipReply.
     40   using TakeOwnershipCallback = base::Callback<void(const TakeOwnershipReply&)>;
     41   virtual void TakeOwnership(const TakeOwnershipRequest& request,
     42                              const TakeOwnershipCallback& callback) = 0;
     43 
     44   // Processes a RemoveOwnerDependencyRequest and responds with a
     45   // RemoveOwnerDependencyReply.
     46   using RemoveOwnerDependencyCallback =
     47       base::Callback<void(const RemoveOwnerDependencyReply&)>;
     48   virtual void RemoveOwnerDependency(
     49       const RemoveOwnerDependencyRequest& request,
     50       const RemoveOwnerDependencyCallback& callback) = 0;
     51 };
     52 
     53 }  // namespace tpm_manager
     54 
     55 #endif  // TPM_MANAGER_COMMON_TPM_OWNERSHIP_INTERFACE_H_
     56