OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 // A representation of an SRPC connection. These can be either to the | 7 // A representation of an SRPC connection. These can be either to the |
8 // service runtime or to untrusted NaCl threads. | 8 // service runtime or to untrusted NaCl threads. |
9 | 9 |
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_CLIENT_H_ | 10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_CLIENT_H_ |
(...skipping 27 matching lines...) Expand all Loading... |
38 bool Init(nacl::DescWrapper* socket); | 38 bool Init(nacl::DescWrapper* socket); |
39 | 39 |
40 // The destructor closes the connection to sel_ldr. | 40 // The destructor closes the connection to sel_ldr. |
41 ~SrpcClient(); | 41 ~SrpcClient(); |
42 | 42 |
43 bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info); | 43 bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info); |
44 // Test whether the SRPC service has a given method. | 44 // Test whether the SRPC service has a given method. |
45 bool HasMethod(const nacl::string& method_name); | 45 bool HasMethod(const nacl::string& method_name); |
46 // Invoke an SRPC method. | 46 // Invoke an SRPC method. |
47 bool Invoke(const nacl::string& method_name, SrpcParams* params); | 47 bool Invoke(const nacl::string& method_name, SrpcParams* params); |
| 48 // Get the error status from that last method invocation |
| 49 NaClSrpcError GetLastError() { return last_error_; } |
48 bool InitParams(const nacl::string& method_name, SrpcParams* params); | 50 bool InitParams(const nacl::string& method_name, SrpcParams* params); |
49 | 51 |
50 // Attach a service for reverse-direction (from .nexe) RPCs. | 52 // Attach a service for reverse-direction (from .nexe) RPCs. |
51 void AttachService(NaClSrpcService* service, void* instance_data); | 53 void AttachService(NaClSrpcService* service, void* instance_data); |
52 | 54 |
53 private: | 55 private: |
54 NACL_DISALLOW_COPY_AND_ASSIGN(SrpcClient); | 56 NACL_DISALLOW_COPY_AND_ASSIGN(SrpcClient); |
55 SrpcClient(); | 57 SrpcClient(); |
56 void GetMethods(); | 58 void GetMethods(); |
57 typedef std::map<nacl::string, MethodInfo*> Methods; | 59 typedef std::map<nacl::string, MethodInfo*> Methods; |
58 Methods methods_; | 60 Methods methods_; |
59 NaClSrpcChannel srpc_channel_; | 61 NaClSrpcChannel srpc_channel_; |
60 bool srpc_channel_initialised_; | 62 bool srpc_channel_initialised_; |
| 63 NaClSrpcError last_error_; |
61 }; | 64 }; |
62 | 65 |
63 } // namespace plugin | 66 } // namespace plugin |
64 | 67 |
65 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_CLIENT_H_ | 68 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_CLIENT_H_ |
OLD | NEW |