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