| 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 struct NaClSecureService; | |
| 19 | |
| 20 /* | |
| 21 * Trusted SRPC server that proxies name service lookups to the | |
| 22 * browser plugin. This is Pepper2-specific code that could, in | |
| 23 * principle, be generalized. | |
| 24 * | |
| 25 * Manifest names are "short names". These are often sonames for | |
| 26 * dynamic libraries, but may be any read-only resource that the NaCl | |
| 27 * application needs, e.g., level data files, audio samples, etc. | |
| 28 */ | |
| 29 | |
| 30 struct NaClManifestProxy { | |
| 31 struct NaClSimpleService base NACL_IS_REFCOUNT_SUBCLASS; | |
| 32 | |
| 33 struct NaClSecureService *server; | |
| 34 }; | |
| 35 | |
| 36 struct NaClManifestProxyConnection { | |
| 37 struct NaClSimpleServiceConnection base NACL_IS_REFCOUNT_SUBCLASS; | |
| 38 | |
| 39 struct NaClMutex mu; | |
| 40 struct NaClCondVar cv; | |
| 41 int channel_initialized; | |
| 42 struct NaClSrpcChannel client_channel; | |
| 43 }; | |
| 44 | |
| 45 extern struct NaClSimpleServiceVtbl const kNaClManifestProxyVtbl; | |
| 46 | |
| 47 /* | |
| 48 * The client reference is used by the connection factory to initiate a | |
| 49 * reverse connection: the connection factory enqueue a callback via | |
| 50 * the NaClSecureReverseClientCtor that wakes up the connection | |
| 51 * factory which issues an upcall on the existing reverse connection | |
| 52 * to ask for a new one. When the new connection arrives, the | |
| 53 * NaClManifestProxyConnectionFactory can wrap the reverse channel in | |
| 54 * the NaClManifestConnection object, and subsequent RPC handlers use | |
| 55 * the connection object's reverse channel to forward RPC requests. | |
| 56 */ | |
| 57 int NaClManifestProxyCtor(struct NaClManifestProxy *self, | |
| 58 NaClThreadIfFactoryFunction thread_factory_fn, | |
| 59 void *thread_factory_data, | |
| 60 struct NaClSecureService *service); | |
| 61 | |
| 62 int NaClManifestProxyConnectionCtor(struct NaClManifestProxyConnection *self, | |
| 63 struct NaClManifestProxy *server, | |
| 64 struct NaClDesc *conn); | |
| 65 | |
| 66 int NaClManifestProxyConnectionFactory( | |
| 67 struct NaClSimpleService *vself, | |
| 68 struct NaClDesc *conn, | |
| 69 struct NaClSimpleServiceConnection **out); | |
| 70 | |
| 71 extern struct NaClSimpleServiceConnectionVtbl | |
| 72 const kNaClManifestProxyConnectionVtbl; | |
| 73 | |
| 74 EXTERN_C_END | |
| 75 | |
| 76 #endif | |
| OLD | NEW |