OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2008 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can | |
4 * be found in the LICENSE file. | |
5 */ | |
6 | |
7 // A representation of an SRPC connection. These can be either to the | |
8 // service runtime or to untrusted NaCl threads. | |
9 | |
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SRPC_CLIENT_H_ | |
11 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SRPC_CLIENT_H_ | |
12 | |
13 #include <map> | |
14 #include "native_client/src/include/nacl_macros.h" | |
15 #include "native_client/src/trusted/plugin/srpc/utility.h" | |
16 | |
17 namespace plugin { | |
18 | |
19 class ConnectedSocket; | |
20 class MethodInfo; | |
21 | |
22 // SrpcClient represents an SRPC connection to a client. | |
23 class SrpcClient { | |
24 public: | |
25 // Init is passed a ConnectedSocket. It performs service | |
26 // discovery and provides the interface for future rpcs. | |
27 bool Init(BrowserInterface* browser_interface, ConnectedSocket* socket); | |
28 | |
29 explicit SrpcClient(); | |
30 // The destructor closes the connection to sel_ldr. | |
31 ~SrpcClient(); | |
32 | |
33 void StartJSObjectProxy(Plugin* plugin); | |
34 // Test whether the SRPC service has a given method. | |
35 bool HasMethod(uintptr_t method_id); | |
36 // Invoke an SRPC method. | |
37 bool Invoke(uintptr_t method_id, SrpcParams* params); | |
38 bool InitParams(uintptr_t method_id, SrpcParams* params); | |
39 | |
40 private: | |
41 NACL_DISALLOW_COPY_AND_ASSIGN(SrpcClient); | |
42 void GetMethods(); | |
43 typedef std::map<uintptr_t, MethodInfo*> Methods; | |
44 Methods methods_; | |
45 NaClSrpcChannel srpc_channel_; | |
46 BrowserInterface* browser_interface_; | |
47 }; | |
48 | |
49 } // namespace plugin | |
50 | |
51 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SRPC_CLIENT_H_ | |
OLD | NEW |