summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Sanghi <usanghi@google.com>2015-12-12 00:45:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-12-12 00:45:38 +0000
commit5cb93f016cff70190b89577ca3e8416ce3fd888a (patch)
treeb6442767f4d4b6f3d4f35625e86e49632dc28263
parent7b153bf1bbbda58d1be395a77a26bce3e4bdf9ef (diff)
parent18477d0ea05e3646417850e071225a52416b8eb8 (diff)
downloadtpm-brillo-m8-release.tar.gz
Merge "trunks: Move BackgroundCommandTransceiver into libtrunks"brillo-m8-releasebrillo-m8-dev
-rw-r--r--trunks/background_command_transceiver.h4
-rw-r--r--trunks/trunks.gyp2
-rw-r--r--trunks/trunks_proxy.cc5
3 files changed, 8 insertions, 3 deletions
diff --git a/trunks/background_command_transceiver.h b/trunks/background_command_transceiver.h
index 048ff36..99fb76e 100644
--- a/trunks/background_command_transceiver.h
+++ b/trunks/background_command_transceiver.h
@@ -25,6 +25,8 @@
#include <base/memory/weak_ptr.h>
#include <base/sequenced_task_runner.h>
+#include "trunks/trunks_export.h"
+
namespace trunks {
// Sends commands to another CommandTransceiver on a background thread. Response
@@ -37,7 +39,7 @@ namespace trunks {
// background_thread.message_loop_proxy());
// ...
// background_transceiver.SendCommand(my_command, MyCallback);
-class BackgroundCommandTransceiver: public CommandTransceiver {
+class TRUNKS_EXPORT BackgroundCommandTransceiver: public CommandTransceiver {
public:
// All commands will be forwarded to |next_transceiver| on |task_runner|,
// regardless of whether the synchronous or asynchronous method is used. This
diff --git a/trunks/trunks.gyp b/trunks/trunks.gyp
index 63c9907..08204b9 100644
--- a/trunks/trunks.gyp
+++ b/trunks/trunks.gyp
@@ -48,6 +48,7 @@
'target_name': 'trunks',
'type': 'shared_library',
'sources': [
+ 'background_command_transceiver.cc',
'blob_parser.cc',
'error_codes.cc',
'hmac_authorization_delegate.cc',
@@ -114,7 +115,6 @@
'target_name': 'trunksd_lib',
'type': 'static_library',
'sources': [
- 'background_command_transceiver.cc',
'resource_manager.cc',
'tpm_handle.cc',
'tpm_simulator_handle.cc',
diff --git a/trunks/trunks_proxy.cc b/trunks/trunks_proxy.cc
index 2ab4774..ddef65b 100644
--- a/trunks/trunks_proxy.cc
+++ b/trunks/trunks_proxy.cc
@@ -63,6 +63,9 @@ void TrunksProxy::SendCommand(const std::string& command,
}
SendCommandRequest tpm_command_proto;
tpm_command_proto.set_command(command);
+ auto on_success = [callback](const SendCommandResponse& response) {
+ callback.Run(response.response());
+ };
auto on_error = [callback](brillo::Error* error) {
SendCommandResponse response;
response.set_response(CreateErrorResponse(SAPI_RC_NO_RESPONSE_RECEIVED));
@@ -73,7 +76,7 @@ void TrunksProxy::SendCommand(const std::string& command,
object_proxy_,
trunks::kTrunksInterface,
trunks::kSendCommand,
- callback,
+ base::Bind(on_success),
base::Bind(on_error),
tpm_command_proto);
}