1 /* Copyright (c) 2012 The Chromium 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.
6 /* From private/ppb_nacl_private.idl modified Thu Jan 10 15:59:03 2013. */
8 #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
9 #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h"
16 #define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
17 #define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
21 * This file contains NaCl private interfaces. */
24 #include "ppapi/c/private/pp_file_handle.h"
31 * The <code>PP_NaClResult</code> enum contains NaCl result codes.
34 /** Successful NaCl call */
36 /** Unspecified NaCl error */
38 /** Error creating the module */
39 PP_NACL_ERROR_MODULE
= 2,
40 /** Error creating and initializing the instance */
41 PP_NACL_ERROR_INSTANCE
= 3
43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult
, 4);
45 /** NaCl-specific errors that should be reported to the user */
48 * The manifest program element does not contain a program usable on the
51 PP_NACL_MANIFEST_MISSING_ARCH
= 0
58 * @addtogroup Interfaces
61 /* PPB_NaCl_Private */
62 struct PPB_NaCl_Private_1_0
{
63 /* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and
64 * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
65 * The |enable_ppapi_dev| parameter controls whether GetInterface
66 * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
67 * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
68 * This implies that LaunchSelLdr is run from the main thread. If a nexe
69 * does not need PPAPI, then it can run off the main thread.
70 * The |uses_irt| flag indicates whether the IRT should be loaded in this
71 * NaCl process. This is true for ABI stable nexes.
73 PP_NaClResult (*LaunchSelLdr
)(PP_Instance instance
,
74 const char* alleged_url
,
77 PP_Bool enable_ppapi_dev
,
79 /* This function starts the IPC proxy so the nexe can communicate with the
80 * browser. Returns PP_NACL_OK on success, otherwise a result code indicating
81 * the failure. PP_NACL_FAILED is returned if LaunchSelLdr wasn't called with
82 * the instance. PP_NACL_ERROR_MODULE is returned if the module can't be
83 * initialized. PP_NACL_ERROR_INSTANCE is returned if the instance can't be
84 * initialized. PP_NACL_USE_SRPC is returned if the plugin should use SRPC.
86 PP_NaClResult (*StartPpapiProxy
)(PP_Instance instance
);
87 /* On POSIX systems, this function returns the file descriptor of
88 * /dev/urandom. On non-POSIX systems, this function returns 0.
90 int32_t (*UrandomFD
)(void);
91 /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
92 * proxy. This is so paranoid admins can effectively prevent untrusted shader
93 * code to be processed by the graphics stack.
95 PP_Bool (*Are3DInterfacesDisabled
)(void);
96 /* Enables the creation of sel_ldr processes off of the main thread.
98 void (*EnableBackgroundSelLdrLaunch
)(void);
99 /* This is Windows-specific. This is a replacement for DuplicateHandle() for
100 * use inside the Windows sandbox. Note that we provide this via dependency
101 * injection only to avoid the linkage problems that occur because the NaCl
102 * plugin is built as a separate DLL/DSO
103 * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
105 int32_t (*BrokerDuplicateHandle
)(PP_FileHandle source_handle
,
107 PP_FileHandle
* target_handle
,
108 uint32_t desired_access
,
110 /* Returns a read-only file descriptor of a file rooted in the Pnacl
111 * component directory, or -1 on error.
112 * Do we want this to take a completion callback and be async, or
113 * could we make this happen on another thread?
115 PP_FileHandle (*GetReadonlyPnaclFd
)(const char* filename
);
116 /* This creates a temporary file that will be deleted by the time
117 * the last handle is closed (or earlier on POSIX systems), and
118 * returns a posix handle to that temporary file.
120 PP_FileHandle (*CreateTemporaryFile
)(PP_Instance instance
);
121 /* Return true if we are off the record.
123 PP_Bool (*IsOffTheRecord
)(void);
124 /* Return true if PNaCl is turned on.
126 PP_Bool (*IsPnaclEnabled
)(void);
127 /* Display a UI message to the user. */
128 PP_NaClResult (*ReportNaClError
)(PP_Instance instance
,
129 PP_NaClError message_id
);
132 typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private
;
137 #endif /* PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ */