| Index: src/untrusted/init/process_lib.h
|
| diff --git a/src/untrusted/init/process_lib.h b/src/untrusted/init/process_lib.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..67b0364414cddd1f5c293ac654d383d521acd581
|
| --- /dev/null
|
| +++ b/src/untrusted/init/process_lib.h
|
| @@ -0,0 +1,50 @@
|
| +// Copyright (c) 2013 The Native Client Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_PROCESS_H_
|
| +#define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_PROCESS_H_
|
| +
|
| +#include "native_client/src/shared/srpc/nacl_srpc.h"
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +// NaClErrorCode
|
| +#include "native_client/src/trusted/service_runtime/nacl_error_code.h"
|
| +
|
| +namespace nacl {
|
| +
|
| +class SrpcClientConnection {
|
| + public:
|
| + SrpcClientConnection();
|
| + virtual ~SrpcClientConnection();
|
| +
|
| + // takes ownership of desc
|
| + bool InitializeFromConnectedDesc(int desc);
|
| +
|
| + // uses cap to derive desc, but caller retains ownership
|
| + bool InitializeFromConnectionCapability(int cap);
|
| +
|
| + bool initialized() const { return initialized_; }
|
| + NaClSrpcChannel *chan() { return &chan_; }
|
| +
|
| + private:
|
| + bool initialized_;
|
| + int desc_;
|
| + NaClSrpcChannel chan_; // POD
|
| +};
|
| +
|
| +class ServiceRuntimeClient : public SrpcClientConnection {
|
| + public:
|
| + ServiceRuntimeClient() {}
|
| +
|
| + // Returns an NaClErrorCode -- LOAD_OK (0) is okay, non-zero is an error.
|
| + NaClErrorCode RunNaClModule(int module_descriptor);
|
| + // module_descriptor must be a valid descriptor.
|
| + // irt_descriptor may be -1 if no IRT is desired.
|
| +};
|
| +
|
| +} // namespace nacl
|
| +
|
| +#endif
|
|
|