diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-10 04:35:10 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-10 04:35:10 +0000 |
commit | 9ffa78a227091e9bcdd8cecb5e7dec707e04591d (patch) | |
tree | 2fed1f38d5e162fc3c7b7fe9394ffcbd191fa529 | |
parent | 391550bf4a604da8aeacbd1d9f54b33a87062691 (diff) | |
download | chromium_src-9ffa78a227091e9bcdd8cecb5e7dec707e04591d.zip chromium_src-9ffa78a227091e9bcdd8cecb5e7dec707e04591d.tar.gz chromium_src-9ffa78a227091e9bcdd8cecb5e7dec707e04591d.tar.bz2 |
Protocol-level changes required to support PIN-less authentication.
This CL adds the protocol messages needed to support PIN-less authentication,
and the C++ glue to route them as far as the HostStub and get the reply back
to a client callback.
BUG=156182
Review URL: https://chromiumcodereview.appspot.com/14715012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199371 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/proto/control.proto | 13 | ||||
-rw-r--r-- | remoting/proto/internal.proto | 2 | ||||
-rw-r--r-- | remoting/protocol/client_control_dispatcher.cc | 9 | ||||
-rw-r--r-- | remoting/protocol/client_control_dispatcher.h | 1 | ||||
-rw-r--r-- | remoting/protocol/client_stub.h | 6 | ||||
-rw-r--r-- | remoting/protocol/host_control_dispatcher.cc | 9 | ||||
-rw-r--r-- | remoting/protocol/host_control_dispatcher.h | 4 | ||||
-rw-r--r-- | remoting/protocol/host_stub.h | 9 | ||||
-rw-r--r-- | remoting/protocol/protocol_mock_objects.h | 4 |
9 files changed, 55 insertions, 2 deletions
diff --git a/remoting/proto/control.proto b/remoting/proto/control.proto index 88eda00..888c0b0 100644 --- a/remoting/proto/control.proto +++ b/remoting/proto/control.proto @@ -53,3 +53,16 @@ message Capabilities { // are separated by spaces). optional string capabilities = 1; } + +message PairingRequest { + // Human-readable name of the client. + optional string client_name = 1; +} + +message PairingResponse { + // Unique identifier for this client. + optional string client_id = 1; + + // Shared secret for this client. + optional string shared_secret = 2; +} diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto index 5775798..219e3ef 100644 --- a/remoting/proto/internal.proto +++ b/remoting/proto/internal.proto @@ -22,6 +22,8 @@ message ControlMessage { optional VideoControl video_control = 3; optional AudioControl audio_control = 5; optional Capabilities capabilities = 6; + optional PairingRequest pairing_request = 7; + optional PairingResponse pairing_response = 8; } // Defines an event message on the event channel. diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc index 580ea28..b261380 100644 --- a/remoting/protocol/client_control_dispatcher.cc +++ b/remoting/protocol/client_control_dispatcher.cc @@ -67,6 +67,13 @@ void ClientControlDispatcher::SetCapabilities( writer_.Write(SerializeAndFrameMessage(message), base::Closure()); } +void ClientControlDispatcher::RequestPairing( + const PairingRequest& pairing_request) { + ControlMessage message; + message.mutable_pairing_request()->CopyFrom(pairing_request); + writer_.Write(SerializeAndFrameMessage(message), base::Closure()); +} + void ClientControlDispatcher::OnMessageReceived( scoped_ptr<ControlMessage> message, const base::Closure& done_task) { DCHECK(client_stub_); @@ -79,6 +86,8 @@ void ClientControlDispatcher::OnMessageReceived( client_stub_->SetCapabilities(message->capabilities()); } else if (message->has_cursor_shape()) { client_stub_->SetCursorShape(message->cursor_shape()); + } else if (message->has_pairing_response()) { + client_stub_->SetPairingResponse(message->pairing_response()); } else { LOG(WARNING) << "Unknown control message received."; } diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h index dce4d9b..b2a0bfa 100644 --- a/remoting/protocol/client_control_dispatcher.h +++ b/remoting/protocol/client_control_dispatcher.h @@ -39,6 +39,7 @@ class ClientControlDispatcher : public ChannelDispatcherBase, virtual void ControlVideo(const VideoControl& video_control) OVERRIDE; virtual void ControlAudio(const AudioControl& audio_control) OVERRIDE; virtual void SetCapabilities(const Capabilities& capabilities) OVERRIDE; + virtual void RequestPairing(const PairingRequest& pairing_request) OVERRIDE; // Sets the ClientStub that will be called for each incoming control // message. |client_stub| must outlive this object. diff --git a/remoting/protocol/client_stub.h b/remoting/protocol/client_stub.h index e357448..09a83c5 100644 --- a/remoting/protocol/client_stub.h +++ b/remoting/protocol/client_stub.h @@ -18,6 +18,7 @@ namespace remoting { namespace protocol { class Capabilities; +class PairingResponse; class ClientStub : public ClipboardStub, public CursorShapeStub { @@ -28,6 +29,11 @@ class ClientStub : public ClipboardStub, // Passes the set of capabilities supported by the host to the client. virtual void SetCapabilities(const Capabilities& capabilities) = 0; + // Passes a pairing response message to the client. + // TODO(jamiewalch): Make this pure virtual once the PIN-less authentication + // implementation CLs have landed. + virtual void SetPairingResponse(const PairingResponse& pairing_response) {} + private: DISALLOW_COPY_AND_ASSIGN(ClientStub); }; diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc index a213ac6..0c44cc2 100644 --- a/remoting/protocol/host_control_dispatcher.cc +++ b/remoting/protocol/host_control_dispatcher.cc @@ -39,6 +39,13 @@ void HostControlDispatcher::SetCapabilities( writer_.Write(SerializeAndFrameMessage(message), base::Closure()); } +void HostControlDispatcher::SetPairingResponse( + const PairingResponse& pairing_response) { + ControlMessage message; + message.mutable_pairing_response()->CopyFrom(pairing_response); + writer_.Write(SerializeAndFrameMessage(message), base::Closure()); +} + void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) { ControlMessage message; message.mutable_clipboard_event()->CopyFrom(event); @@ -69,6 +76,8 @@ void HostControlDispatcher::OnMessageReceived( host_stub_->ControlAudio(message->audio_control()); } else if (message->has_capabilities()) { host_stub_->SetCapabilities(message->capabilities()); + } else if (message->has_pairing_request()) { + host_stub_->RequestPairing(message->pairing_request()); } else { LOG(WARNING) << "Unknown control message received."; } diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h index ff0fc34..4620be1 100644 --- a/remoting/protocol/host_control_dispatcher.h +++ b/remoting/protocol/host_control_dispatcher.h @@ -5,7 +5,6 @@ #ifndef REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ #define REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_ -#include "base/memory/ref_counted.h" #include "remoting/protocol/buffered_socket_writer.h" #include "remoting/protocol/channel_dispatcher_base.h" #include "remoting/protocol/client_stub.h" @@ -22,6 +21,7 @@ namespace protocol { class ControlMessage; class HostStub; +class PairingResponse; class Session; // HostControlDispatcher dispatches incoming messages on the control @@ -35,6 +35,8 @@ class HostControlDispatcher : public ChannelDispatcherBase, // ClientStub implementation. virtual void SetCapabilities(const Capabilities& capabilities) OVERRIDE; + virtual void SetPairingResponse( + const PairingResponse& pairing_response) OVERRIDE; // ClipboardStub implementation for sending clipboard data to client. virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; diff --git a/remoting/protocol/host_stub.h b/remoting/protocol/host_stub.h index 03f3b08..d7d5475 100644 --- a/remoting/protocol/host_stub.h +++ b/remoting/protocol/host_stub.h @@ -14,10 +14,12 @@ namespace remoting { namespace protocol { +class AudioControl; class Capabilities; class ClientResolution; +class PairingResponse; +class PairingRequest; class VideoControl; -class AudioControl; class HostStub { public: @@ -38,6 +40,11 @@ class HostStub { // Passes the set of capabilities supported by the client to the host. virtual void SetCapabilities(const Capabilities& capabilities) = 0; + // Requests pairing between the host and client for PIN-less authentication. + // TODO(jamiewalch): Make this pure virtual once the PIN-less authentication + // implementation CLs have landed. + virtual void RequestPairing(const PairingRequest& pairing_request) {} + protected: virtual ~HostStub() {} diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h index 7ccf664..54dc150 100644 --- a/remoting/protocol/protocol_mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h @@ -107,6 +107,8 @@ class MockHostStub : public HostStub { MOCK_METHOD1(ControlVideo, void(const VideoControl& video_control)); MOCK_METHOD1(ControlAudio, void(const AudioControl& audio_control)); MOCK_METHOD1(SetCapabilities, void(const Capabilities& capabilities)); + MOCK_METHOD1(RequestPairing, + void(const PairingRequest& pairing_request)); private: DISALLOW_COPY_AND_ASSIGN(MockHostStub); @@ -119,6 +121,8 @@ class MockClientStub : public ClientStub { // ClientStub mock implementation. MOCK_METHOD1(SetCapabilities, void(const Capabilities& capabilities)); + MOCK_METHOD1(SetPairingResponse, + void(const PairingResponse& pairing_response)); // ClipboardStub mock implementation. MOCK_METHOD1(InjectClipboardEvent, void(const ClipboardEvent& event)); |