OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "remoting/host/security_key/gnubby_auth_handler.h" | 14 #include "remoting/host/security_key/security_key_auth_handler.h" |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 | 17 |
18 class RemoteSecurityKeyIpcServerFactory; | 18 class SecurityKeyIpcServerFactory; |
19 | 19 |
20 // Responsible for handing the server end of the IPC channel between the | 20 // Responsible for handing the server end of the IPC channel between the |
21 // network process (server) and the remote_security_key process (client). | 21 // network process (server) and the remote_security_key process (client). |
22 class RemoteSecurityKeyIpcServer { | 22 class SecurityKeyIpcServer { |
23 public: | 23 public: |
24 virtual ~RemoteSecurityKeyIpcServer() {} | 24 virtual ~SecurityKeyIpcServer() {} |
25 | 25 |
26 // Creates a new RemoteSecurityKeyIpcServer instance. | 26 // Creates a new SecurityKeyIpcServer instance. |
27 static std::unique_ptr<RemoteSecurityKeyIpcServer> Create( | 27 static std::unique_ptr<SecurityKeyIpcServer> Create( |
28 int connection_id, | 28 int connection_id, |
29 uint32_t peer_session_id, | 29 uint32_t peer_session_id, |
30 base::TimeDelta initial_connect_timeout, | 30 base::TimeDelta initial_connect_timeout, |
31 const GnubbyAuthHandler::SendMessageCallback& message_callback, | 31 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
32 const base::Closure& done_callback); | 32 const base::Closure& done_callback); |
33 | 33 |
34 // Used to set a Factory to generate fake/mock RemoteSecurityKeyIpcServer | 34 // Used to set a Factory to generate fake/mock SecurityKeyIpcServer |
35 // instances for testing. | 35 // instances for testing. |
36 static void SetFactoryForTest(RemoteSecurityKeyIpcServerFactory* factory); | 36 static void SetFactoryForTest(SecurityKeyIpcServerFactory* factory); |
37 | 37 |
38 // Creates and starts listening on an IPC channel with the given name. | 38 // Creates and starts listening on an IPC channel with the given name. |
39 virtual bool CreateChannel(const std::string& channel_name, | 39 virtual bool CreateChannel(const std::string& channel_name, |
40 base::TimeDelta request_timeout) = 0; | 40 base::TimeDelta request_timeout) = 0; |
41 | 41 |
42 // Sends a security key response IPC message via the IPC channel. | 42 // Sends a security key response IPC message via the IPC channel. |
43 virtual bool SendResponse(const std::string& message_data) = 0; | 43 virtual bool SendResponse(const std::string& message_data) = 0; |
44 }; | 44 }; |
45 | 45 |
46 // Used to allow for creating Fake/Mock RemoteSecurityKeyIpcServer for testing. | 46 // Used to allow for creating Fake/Mock SecurityKeyIpcServer for testing. |
47 class RemoteSecurityKeyIpcServerFactory { | 47 class SecurityKeyIpcServerFactory { |
48 public: | 48 public: |
49 virtual ~RemoteSecurityKeyIpcServerFactory() {} | 49 virtual ~SecurityKeyIpcServerFactory() {} |
50 | 50 |
51 virtual std::unique_ptr<RemoteSecurityKeyIpcServer> Create( | 51 virtual std::unique_ptr<SecurityKeyIpcServer> Create( |
52 int connection_id, | 52 int connection_id, |
53 uint32_t peer_session_id, | 53 uint32_t peer_session_id, |
54 base::TimeDelta connect_timeout, | 54 base::TimeDelta connect_timeout, |
55 const GnubbyAuthHandler::SendMessageCallback& message_callback, | 55 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
56 const base::Closure& done_callback) = 0; | 56 const base::Closure& done_callback) = 0; |
57 }; | 57 }; |
58 | 58 |
59 } // namespace remoting | 59 } // namespace remoting |
60 | 60 |
61 #endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_H_ | 61 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_IPC_SERVER_H_ |
OLD | NEW |