12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci/* From private/ppb_nacl_private.idl modified Thu Sep  4 07:46:02 2014. */
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_bool.h"
12eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "ppapi/c/pp_completion_callback.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_instance.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/pp_macros.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_stdint.h"
16ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "ppapi/c/pp_var.h"
175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ppapi/c/private/ppp_pexe_stream_handler.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/**
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @file
24c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * This file contains NaCl private interfaces. This interface is not versioned
25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * and is for internal Chrome use. It may change without notice. */
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/private/pp_file_handle.h"
29a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "ppapi/c/private/ppb_instance_private.h"
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/**
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @addtogroup Enums
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @{
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)/** NaCl-specific errors that should be reported to the user.
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  These error codes are reported via UMA so, if you edit them:
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *   1) make sure you understand UMA first.
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *   2) update src/tools/metrics/histograms/histograms.xml
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  Values are explicitly specified to make sure they don't shift around when
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  edited, and also to make reading about:histograms easier.
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef enum {
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_LOAD_SUCCESS = 0,
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_LOAD_ABORTED = 1,
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_UNKNOWN = 2,
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_RESOLVE_URL = 3,
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_LOAD_URL = 4,
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_STAT = 5,
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_TOO_LARGE = 6,
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_OPEN = 7,
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC = 8,
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_READ = 9,
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_PARSING = 10,
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE = 11,
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_GET_NEXE_URL = 12,
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_LOAD_URL = 13,
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_ORIGIN_PROTOCOL = 14,
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_FH_DUP = 15,
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_STAT = 16,
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_ELF_CHECK_IO = 17,
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_ELF_CHECK_FAIL = 18,
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_INIT = 19,
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER = 20,
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_FD = 21,
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_LAUNCH = 22,
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Deprecated, safe to reuse the value because it's never logged in UMA.
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_SEND_NEXE = 24,
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_HANDLE_PASSING = 25,
70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_START_MODULE = 26,
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_START_STATUS = 27,
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SRPC_CONNECTION_FAIL = 28,
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_CHECK_PPP = 29,
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_ALLOC = 30,
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_MODULE = 31,
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_INSTANCE = 32,
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33,
78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34,
79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35,
80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36,
81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_CRASH = 37,
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38,
83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39,
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOACCESS = 40,
85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41,
86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOSPACE = 42,
87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_OTHER = 43,
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44,
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45,
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46,
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47,
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48,
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49,
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS = 50,
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51,
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER = 52,
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53,
98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54,
99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55,
100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56,
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57,
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_RESOURCE_FETCH = 58,
103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED = 59,
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS = 60,
105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER = 61,
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_THREAD_CREATE = 62,
107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LLC_SETUP = 63,
108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LD_SETUP = 64,
109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LLC_INTERNAL = 65,
110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LD_INTERNAL = 66,
111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CREATE_TEMP = 67,
112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* This entry is no longer used, but should not be removed, because UMA
113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_NOT_ENABLED = 68,
115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_NOACCESS_URL = 69,
116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_NOACCESS_URL = 70,
117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CRASH_THROTTLED = 71,
118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* If you add a code, read the enum comment above on how to update
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MAX
1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} PP_NaClError;
122f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
123f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/** Event types that NaCl may use when reporting load progress or errors. */
124f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)typedef enum {
125f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOADSTART,
126f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_PROGRESS,
127f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_ERROR,
128f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_ABORT,
129f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOAD,
130f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOADEND,
131f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_CRASH
132f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} PP_NaClEventType;
13323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
13423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)typedef enum {
13523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_CHROME_EXTENSION,
13623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_DATA,
13723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_OTHER
13823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)} PP_UrlSchemeType;
139effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
140effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochtypedef enum {
141effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The trusted plugin begins in this ready state. */
142effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_UNSENT = 0,
143effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The manifest file has been requested, but not yet received. */
144effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_OPENED = 1,
145effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The manifest file has been received and the nexe successfully requested. */
146effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_LOADING = 3,
147effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The nexe has been loaded and the proxy started, so it is ready for
148effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch   */
149effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_DONE = 4
150effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch} PP_NaClReadyState;
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/**
1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @}
1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/**
1560529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch * @addtogroup Structs
1570529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch * @{
1580529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch */
1590529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochstruct PP_PNaClOptions {
1600529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PP_Bool translate;
1610529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PP_Bool is_debug;
1620529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  int32_t opt_level;
1630529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch};
1640529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch/**
1650529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch * @}
1660529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch */
1670529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1680529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch/**
169010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @addtogroup Typedefs
170010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @{
171010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
172010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/* Callback invoked upon completion of PPP_ManifestService::OpenResource(). */
173010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)typedef void (*PP_OpenResourceCompletionCallback)(void* user_data,
174010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                                  PP_FileHandle file_handle);
175010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
176010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @}
177010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
178010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
179010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
180cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * @addtogroup Structs
181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * @{
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) */
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)/* Corresponds to NaClFileInfo in
184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * native_client/src/trusted/validator/nacl_file_info.h */
185cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)struct PP_NaClFileInfo {
186cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PP_FileHandle handle;
187cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  /* See NaClFileToken comment in nacl_file_info.h */
188cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  uint64_t token_lo;
189cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  uint64_t token_hi;
190cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
191cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)/**
192cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * @}
193cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) */
1940529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
195cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)/**
196cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * @addtogroup Interfaces
197cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * @{
198cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) */
1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* PPB_NaCl_Private */
2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct PPB_NaCl_Private_1_0 {
2012385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch  /* Launches NaCl's sel_ldr process.  Returns PP_EXTERNAL_PLUGIN_OK on success
2022385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch   * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
2032385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch   * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * returns 'Dev' interfaces to the NaCl plugin.  The |uses_ppapi| flag
2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * This implies that LaunchSelLdr is run from the main thread.  If a nexe
2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * does not need PPAPI, then it can run off the main thread.
208116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * The |nexe_file_info| is currently used only in non-SFI mode. It is the
209116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * file handle for the main nexe file, which should be initially loaded.
210116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * LaunchSelLdr takes the ownership of the file handle.
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * The |uses_irt| flag indicates whether the IRT should be loaded in this
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * NaCl process.  This is true for ABI stable nexes.
213a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   * The |uses_nonsfi_mode| flag indicates whether or not nonsfi-mode should
214a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   * be used with the binary pointed by the url.
215c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)   * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
216c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)   * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
2177d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)   * The |enable_exception_handling| flag indicates whether or not the nexe
2187d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)   * will be able to use hardware exception handling.
2193551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * The |enable_crash_throttling| flag indicates whether or not crashes of
2203551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * the nexe contribute to crash throttling statisics and whether nexe starts
2213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * are throttled by crash throttling.
2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
223116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void (*LaunchSelLdr)(PP_Instance instance,
224116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool main_service_runtime,
225116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       const char* alleged_url,
226116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       const struct PP_NaClFileInfo* nexe_file_info,
227116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool uses_irt,
228116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool uses_ppapi,
229116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool uses_nonsfi_mode,
230116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool enable_ppapi_dev,
231116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool enable_dyncode_syscalls,
232116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool enable_exception_handling,
233116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       PP_Bool enable_crash_throttling,
234116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       void* imc_handle,
235116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                       struct PP_CompletionCallback callback);
2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This function starts the IPC proxy so the nexe can communicate with the
237c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch   * browser.
2382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
239c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  PP_Bool (*StartPpapiProxy)(PP_Instance instance);
2402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* On POSIX systems, this function returns the file descriptor of
2412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * /dev/urandom.  On non-POSIX systems, this function returns 0.
2422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int32_t (*UrandomFD)(void);
2442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
2452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * proxy. This is so paranoid admins can effectively prevent untrusted shader
2462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * code to be processed by the graphics stack.
2472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PP_Bool (*Are3DInterfacesDisabled)(void);
2492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This is Windows-specific.  This is a replacement for DuplicateHandle() for
2502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * use inside the Windows sandbox.  Note that we provide this via dependency
2512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * injection only to avoid the linkage problems that occur because the NaCl
2522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * plugin is built as a separate DLL/DSO
2532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int32_t (*BrokerDuplicateHandle)(PP_FileHandle source_handle,
2562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   uint32_t process_id,
2572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   PP_FileHandle* target_handle,
2582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   uint32_t desired_access,
2592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   uint32_t options);
260116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Returns a read-only (but executable) file descriptor / file info for
261116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * a url for pnacl translator tools. Returns an invalid handle on failure.
2622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
263116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void (*GetReadExecPnaclFd)(const char* url,
264116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                             struct PP_NaClFileInfo* out_file_info);
2652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This creates a temporary file that will be deleted by the time
2662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * the last handle is closed (or earlier on POSIX systems), and
2672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * returns a posix handle to that temporary file.
2682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PP_FileHandle (*CreateTemporaryFile)(PP_Instance instance);
2705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  /* Return the number of processors in the system as reported by the OS */
2715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  int32_t (*GetNumberOfProcessors)(void);
272a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Return whether the non-SFI mode is enabled. */
273a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_Bool (*IsNonSFIModeEnabled)(void);
274eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /* Report to the browser that translation of the pexe for |instance|
275bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * has finished, or aborted with an error. If |success| is true, the
276bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * browser may then store the translation in the cache. The renderer
277bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * must first have called GetNexeFd for the same instance. (The browser is
278bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * not guaranteed to store the nexe even if |success| is true; if there is
279bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * an error on the browser side, or the file is too big for the cache, or
280bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * the browser is in incognito mode, no notification will be delivered to
281bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * the plugin.)
282eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch   */
283f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  void (*ReportTranslationFinished)(PP_Instance instance,
284f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                    PP_Bool success,
285f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                    int32_t opt_level,
286f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                    int64_t pexe_size,
287116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                    int64_t compile_time_us);
288f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /* Dispatch a progress event on the DOM element where the given instance is
289f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)   * embedded.
290f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)   */
291f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void (*DispatchEvent)(PP_Instance instance,
292f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                        PP_NaClEventType event_type,
2935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                        const char* resource_url,
294f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                        PP_Bool length_is_computable,
295f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                        uint64_t loaded_bytes,
296f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                        uint64_t total_bytes);
297e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  /* Report that the nexe loaded successfully. */
298e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  void (*ReportLoadSuccess)(PP_Instance instance,
299e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch                            uint64_t loaded_bytes,
300e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch                            uint64_t total_bytes);
301a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Report an error that occured while attempting to load a nexe. */
302a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void (*ReportLoadError)(PP_Instance instance,
303a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                          PP_NaClError error,
30446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                          const char* error_message);
305e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  /* Reports that loading a nexe was aborted. */
306e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  void (*ReportLoadAbort)(PP_Instance instance);
307effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Performs internal setup when an instance is created. */
308effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void (*InstanceCreated)(PP_Instance instance);
309a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Performs internal cleanup when an instance is destroyed. */
310a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void (*InstanceDestroyed)(PP_Instance instance);
311effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Return true if the NaCl debug stub is enabled and the app loaded from
312effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch   * alleged_nmf_url will be attached to a debugger.
313a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
314effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_Bool (*NaClDebugEnabledForURL)(const char* alleged_nmf_url);
315a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Returns the kind of SFI sandbox implemented by NaCl on this
316a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   * platform.
317a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
318a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const char* (*GetSandboxArch)(void);
31923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  /* Logs the message to the console. */
32023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  void (*LogToConsole)(PP_Instance instance, const char* message);
321effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Returns the NaCl readiness status for this instance. */
322effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NaClReadyState (*GetNaClReadyState)(PP_Instance instance);
323c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  /* Logs the message via VLOG. */
324c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void (*Vlog)(const char* message);
3250529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  /* Initializes internal state for a NaCl plugin. */
3265c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  void (*InitializePlugin)(PP_Instance instance,
3275c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                           uint32_t argc,
3285c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                           const char* argn[],
3295c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                           const char* argv[]);
330c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  /* Returns the size of the nexe. */
331c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  int64_t (*GetNexeSize)(PP_Instance instance);
33246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  /* Requests the NaCl manifest specified in the plugin arguments. */
333cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void (*RequestNaClManifest)(PP_Instance instance,
334cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                              struct PP_CompletionCallback callback);
3350529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  struct PP_Var (*GetManifestBaseURL)(PP_Instance instance);
3360529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  /* Processes the NaCl manifest once it's been retrieved.
3370529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   * TODO(teravest): Move the rest of the supporting logic out of the trusted
3380529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   * plugin.
3390529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   */
3400529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void (*ProcessNaClManifest)(PP_Instance instance, const char* program_url);
3415c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  PP_Bool (*DevInterfacesEnabled)(PP_Instance instance);
342010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Bool (*GetManifestProgramURL)(PP_Instance instance,
343010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                   struct PP_Var* full_url,
344010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                   struct PP_PNaClOptions* pnacl_options,
345010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                   PP_Bool* uses_nonsfi_mode);
346116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Returns the filenames for the llc and ld tools. */
347010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Bool (*GetPnaclResourceInfo)(PP_Instance instance,
348010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                  struct PP_Var* llc_tool_name,
349010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                  struct PP_Var* ld_tool_name);
350010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /* PP_Var string of attributes describing the CPU features supported
351010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * by the current architecture. The string is a comma-delimited list
352010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * of attributes supported by LLVM in its -mattr= option:
353010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *   http://llvm.org/docs/CommandGuide/llc.html#cmdoption-mattr */
354010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  struct PP_Var (*GetCpuFeatureAttrs)(void);
355cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  /* Downloads the .nexe file at the given URL to a file, and sets |file_info|
356cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * to information for a handle to a file containing its contents.
357cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * If metadata for identity-based validation caching is available
358cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * then it sets token information in |file_info| (otherwise left untouched).
359cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   */
360cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void (*DownloadNexe)(PP_Instance instance,
361cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                       const char* url,
362cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                       struct PP_NaClFileInfo* file_info,
363cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                       struct PP_CompletionCallback callback);
36446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  /* Reports the status of sel_ldr for UMA reporting.
36546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   * |max_status| has to be provided because the implementation of this
36646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   * interface can't access the NaClErrorCode enum.
36746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   */
36846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void (*ReportSelLdrStatus)(PP_Instance instance,
36946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                             int32_t load_status,
37046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                             int32_t max_status);
371f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  /* Logs time taken by an operation to UMA histograms.
372f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)   * This function is safe to call on any thread.
373f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)   */
374f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  void (*LogTranslateTime)(const char* histogram_name, int64_t time_us);
375116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Opens a manifest entry for the given instance. If this is for a helper
376116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * process, we consult our internal pnacl.json instead of the user-supplied
377116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * NMF.
378116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * Fails for files which require PNaCl translation.
379116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   */
380116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void (*OpenManifestEntry)(PP_Instance instance,
381116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                            PP_Bool is_helper_process,
382116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                            const char* key,
383116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                            struct PP_NaClFileInfo* file_info,
384116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                            struct PP_CompletionCallback callback);
385116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Sets the start time for PNaCl downloading and translation to the current
386116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * time.
387116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   */
388116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void (*SetPNaClStartTime)(PP_Instance instance);
3895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  /* Downloads and streams a pexe file for PNaCl translation.
3905f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * Fetches the content at |pexe_url| for the given instance and opt_level.
3915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * If a translated cached nexe is already available, |cache_hit_handle|
3925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * is set and |cache_hit_callback| is called.
3935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * Otherwise, |stream_callback| is called repeatedly with blocks of data
3945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * as they are received. |stream_finished_callback| is called after all
3955f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * data has been received and dispatched to |stream_callback|.
3965f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   */
3975f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void (*StreamPexe)(PP_Instance instance,
3985f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                     const char* pexe_url,
3995f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                     int32_t opt_level,
4005f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                     const struct PPP_PexeStreamHandler_1_0* stream_handler,
4015f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                     void* stream_handler_user_data);
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private;
4052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/**
4062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @}
4072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
4082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  /* PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ */
4102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
411