| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_SRPC_LIB_H_ | |
| 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_SRPC_LIB_H_ | |
| 7 | |
| 8 // Routines to simplify SRPC invocations. | |
| 9 | |
| 10 #include <stdarg.h> | |
| 11 #include "native_client/src/include/nacl_macros.h" | |
| 12 #include "native_client/src/include/nacl_string.h" | |
| 13 #include "native_client/src/include/portability.h" | |
| 14 | |
| 15 namespace plugin { | |
| 16 | |
| 17 class BrowserInterface; | |
| 18 class NaClSubprocess; | |
| 19 class SrpcParams; | |
| 20 | |
| 21 // TODO(jvoung): See if anything can be shared between this and | |
| 22 // src/shared/srpc/invoke.c | |
| 23 | |
| 24 // This is just a namespace to collect methods for setting up and invoking | |
| 25 // SPRC methods against a NaClSubprocess. | |
| 26 class PnaclSrpcLib { | |
| 27 public: | |
| 28 // Invoke an Srpc Method on the NaCl subprocess |subprocess|. | |
| 29 // |out_params| must be allocated and cleaned up outside of this function, | |
| 30 // but it will be initialized by this function, and on success | |
| 31 // any out-params (if any) will be placed in |out_params|. | |
| 32 // Input types must be listed in |input_signature|, with the actual | |
| 33 // arguments passed in as var-args. | |
| 34 // Returns |true| on success. | |
| 35 static bool InvokeSrpcMethod(BrowserInterface* browser_interface, | |
| 36 const NaClSubprocess* subprocess, | |
| 37 const nacl::string& method_name, | |
| 38 const nacl::string& input_signature, | |
| 39 SrpcParams* out_params, | |
| 40 ...); | |
| 41 | |
| 42 private: | |
| 43 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclSrpcLib); | |
| 44 | |
| 45 static bool SetupSrpcInvocation(BrowserInterface* browser_interface, | |
| 46 const NaClSubprocess* subprocess, | |
| 47 const nacl::string& method_name, | |
| 48 SrpcParams* params, | |
| 49 uintptr_t* kMethodIdent); | |
| 50 | |
| 51 static bool VInvokeSrpcMethod(BrowserInterface* browser_interface, | |
| 52 const NaClSubprocess* subprocess, | |
| 53 const nacl::string& method_name, | |
| 54 const nacl::string& signature, | |
| 55 SrpcParams* params, | |
| 56 va_list vl); | |
| 57 }; | |
| 58 | |
| 59 } // namespace plugin; | |
| 60 | |
| 61 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_SRPC_LIB_H_ | |
| OLD | NEW |