OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_MANIFEST_NAME_SERVICE_PROXY_MANIFEST_PROXY_H_ |
| 8 #define NATIVE_CLIENT_SRC_TRUSTED_MANIFEST_NAME_SERVICE_PROXY_MANIFEST_PROXY_H_ |
| 9 |
| 10 #include "native_client/src/include/nacl_base.h" |
| 11 |
| 12 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 13 #include "native_client/src/trusted/service_runtime/sel_ldr_thread_interface.h" |
| 14 #include "native_client/src/trusted/simple_service/nacl_simple_service.h" |
| 15 |
| 16 EXTERN_C_BEGIN |
| 17 |
| 18 /* |
| 19 * Trusted SRPC server that proxies name service lookups to the |
| 20 * browser plugin. This is Pepper2-specific code that could, in |
| 21 * principle, be generalized. |
| 22 * |
| 23 * Manifest names are "short names". These are often sonames for |
| 24 * dynamic libraries, but may be any read-only resource that the NaCl |
| 25 * application needs, e.g., level data files, audio samples, etc. |
| 26 */ |
| 27 |
| 28 struct NaClManifestProxy { |
| 29 struct NaClSimpleService base NACL_IS_REFCOUNT_SUBCLASS; |
| 30 |
| 31 struct NaClApp *nap; |
| 32 }; |
| 33 |
| 34 struct NaClManifestProxyConnection { |
| 35 struct NaClSimpleServiceConnection base NACL_IS_REFCOUNT_SUBCLASS; |
| 36 |
| 37 struct NaClMutex mu; |
| 38 struct NaClCondVar cv; |
| 39 int channel_initialized; |
| 40 struct NaClSrpcChannel client_channel; |
| 41 }; |
| 42 |
| 43 extern struct NaClSimpleServiceVtbl const kNaClManifestProxyVtbl; |
| 44 |
| 45 /* |
| 46 * The nap reference is used by the connection factory to initiate a |
| 47 * reverse connection: the connection factory enqueue a callback via |
| 48 * the NaClSecureReverseClientCtor that wakes up the connection |
| 49 * factory which issues an upcall on the existing reverse connection |
| 50 * to ask for a new one. When the new connection arrives, the |
| 51 * NaClManifestProxyConnectionFactory can wrap the reverse channel in |
| 52 * the NaClManifestConnection object, and subsequent RPC handlers use |
| 53 * the connection object's reverse channel to forward RPC requests. |
| 54 */ |
| 55 int NaClManifestProxyCtor(struct NaClManifestProxy *self, |
| 56 NaClThreadIfFactoryFunction thread_factory_fn, |
| 57 void *thread_factory_data, |
| 58 struct NaClApp *nap); |
| 59 |
| 60 void NaClManifestProxyDtor(struct NaClRefCount *vself); |
| 61 |
| 62 int NaClManifestProxyConnectionCtor(struct NaClManifestProxyConnection *self, |
| 63 struct NaClManifestProxy *server, |
| 64 struct NaClDesc *conn); |
| 65 |
| 66 void NaClMaifestProxyConnectionDtor(struct NaClRefCount *vself); |
| 67 |
| 68 int NaClManifestProxyConnectionFactory( |
| 69 struct NaClSimpleService *vself, |
| 70 struct NaClDesc *conn, |
| 71 struct NaClSimpleServiceConnection **out); |
| 72 |
| 73 extern struct NaClSimpleServiceConnectionVtbl |
| 74 const kNaClManifestProxyConnectionVtbl; |
| 75 |
| 76 EXTERN_C_END |
| 77 |
| 78 #endif |
OLD | NEW |