OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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_UNTRUSTED_INIT_PROCESS_H_ |
| 6 #define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_PROCESS_H_ |
| 7 |
| 8 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 9 |
| 10 #include <string> |
| 11 #include <vector> |
| 12 |
| 13 // NaClErrorCode |
| 14 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
| 15 |
| 16 namespace nacl { |
| 17 |
| 18 class SrpcClientConnection { |
| 19 public: |
| 20 SrpcClientConnection(); |
| 21 virtual ~SrpcClientConnection(); |
| 22 |
| 23 // takes ownership of desc |
| 24 bool InitializeFromConnectedDesc(int desc); |
| 25 |
| 26 // uses cap to derive desc, but caller retains ownership |
| 27 bool InitializeFromConnectionCapability(int cap); |
| 28 |
| 29 bool initialized() const { return initialized_; } |
| 30 NaClSrpcChannel *chan() { return &chan_; } |
| 31 |
| 32 private: |
| 33 bool initialized_; |
| 34 int desc_; |
| 35 NaClSrpcChannel chan_; // POD |
| 36 }; |
| 37 |
| 38 class ServiceRuntimeClient : public SrpcClientConnection { |
| 39 public: |
| 40 ServiceRuntimeClient() {} |
| 41 |
| 42 // Returns an NaClErrorCode -- LOAD_OK (0) is okay, non-zero is an error. |
| 43 NaClErrorCode RunNaClModule(int module_descriptor); |
| 44 // module_descriptor must be a valid descriptor. |
| 45 // irt_descriptor may be -1 if no IRT is desired. |
| 46 }; |
| 47 |
| 48 } // namespace nacl |
| 49 |
| 50 #endif |
OLD | NEW |