ppb_nacl_private.h revision c5cede9ae108bb15f6b7a8aea21c7e1fefa2834c
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) 6c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch/* From private/ppb_nacl_private.idl modified Mon Apr 7 13:43:24 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" 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0" 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @file 23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * This file contains NaCl private interfaces. This interface is not versioned 24c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * and is for internal Chrome use. It may change without notice. */ 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/private/pp_file_handle.h" 28a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "ppapi/c/private/ppb_instance_private.h" 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @addtogroup Enums 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @{ 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)/** NaCl-specific errors that should be reported to the user. 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * These error codes are reported via UMA so, if you edit them: 36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * 1) make sure you understand UMA first. 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * 2) update src/tools/metrics/histograms/histograms.xml 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * Values are explicitly specified to make sure they don't shift around when 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * edited, and also to make reading about:histograms easier. 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef enum { 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_LOAD_SUCCESS = 0, 43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_LOAD_ABORTED = 1, 44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_UNKNOWN = 2, 45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_RESOLVE_URL = 3, 46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_LOAD_URL = 4, 47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_STAT = 5, 48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_TOO_LARGE = 6, 49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_OPEN = 7, 50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC = 8, 51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_READ = 9, 52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_PARSING = 10, 53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE = 11, 54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_GET_NEXE_URL = 12, 55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_NEXE_LOAD_URL = 13, 56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_NEXE_ORIGIN_PROTOCOL = 14, 57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_NEXE_FH_DUP = 15, 58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_NEXE_STAT = 16, 59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_ELF_CHECK_IO = 17, 60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_ELF_CHECK_FAIL = 18, 61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_INIT = 19, 62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER = 20, 63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_FD = 21, 64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_LAUNCH = 22, 65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* Deprecated, safe to reuse the value because it's never logged in UMA. 66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_SEND_NEXE = 24, 68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_HANDLE_PASSING = 25, 69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_START_MODULE = 26, 70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_START_STATUS = 27, 71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SRPC_CONNECTION_FAIL = 28, 72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_START_PROXY_CHECK_PPP = 29, 73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_START_PROXY_ALLOC = 30, 74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_START_PROXY_MODULE = 31, 75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_START_PROXY_INSTANCE = 32, 76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33, 77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34, 78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35, 79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36, 80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_START_PROXY_CRASH = 37, 81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38, 82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39, 83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_OPEN_NOACCESS = 40, 84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41, 85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_OPEN_NOSPACE = 42, 86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_OPEN_OTHER = 43, 87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44, 88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45, 89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46, 90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47, 91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48, 92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49, 93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS = 50, 94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51, 95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER = 52, 96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53, 97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54, 98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55, 99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56, 100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57, 101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_RESOURCE_FETCH = 58, 102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED = 59, 103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS = 60, 104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER = 61, 105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_THREAD_CREATE = 62, 106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_LLC_SETUP = 63, 107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_LD_SETUP = 64, 108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_LLC_INTERNAL = 65, 109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_LD_INTERNAL = 66, 110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CREATE_TEMP = 67, 111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* This entry is no longer used, but should not be removed, because UMA 112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_NOT_ENABLED = 68, 114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MANIFEST_NOACCESS_URL = 69, 115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_NEXE_NOACCESS_URL = 70, 116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_PNACL_CRASH_THROTTLED = 71, 117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* If you add a code, read the enum comment above on how to update 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NACL_ERROR_MAX 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} PP_NaClError; 121f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 122f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/** Event types that NaCl may use when reporting load progress or errors. */ 123f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)typedef enum { 124f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_LOADSTART, 125f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_PROGRESS, 126f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_ERROR, 127f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_ABORT, 128f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_LOAD, 129f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_LOADEND, 130f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NACL_EVENT_CRASH 131f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} PP_NaClEventType; 13223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) 13323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)typedef enum { 13423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) PP_SCHEME_CHROME_EXTENSION, 13523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) PP_SCHEME_DATA, 13623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) PP_SCHEME_OTHER 13723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)} PP_UrlSchemeType; 138effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 139effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochtypedef enum { 140effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* The trusted plugin begins in this ready state. */ 141effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NACL_READY_STATE_UNSENT = 0, 142effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* The manifest file has been requested, but not yet received. */ 143effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NACL_READY_STATE_OPENED = 1, 144effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* The manifest file has been received and the nexe successfully requested. */ 145effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NACL_READY_STATE_LOADING = 3, 146effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* The nexe has been loaded and the proxy started, so it is ready for 147effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch */ 148effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NACL_READY_STATE_DONE = 4 149effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch} PP_NaClReadyState; 1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @} 1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @addtogroup Interfaces 1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @{ 1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* PPB_NaCl_Private */ 1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct PPB_NaCl_Private_1_0 { 1602385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch /* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success 1612385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on 1622385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch * failure. The |enable_ppapi_dev| parameter controls whether GetInterface 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * indicates that the nexe run by sel_ldr will use the PPAPI APIs. 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * This implies that LaunchSelLdr is run from the main thread. If a nexe 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * does not need PPAPI, then it can run off the main thread. 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * The |uses_irt| flag indicates whether the IRT should be loaded in this 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * NaCl process. This is true for ABI stable nexes. 169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * The |uses_nonsfi_mode| flag indicates whether or not nonsfi-mode should 170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * be used with the binary pointed by the url. 171c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * The |enable_dyncode_syscalls| flag indicates whether or not the nexe 172c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC). 1737d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) * The |enable_exception_handling| flag indicates whether or not the nexe 1747d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) * will be able to use hardware exception handling. 1753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) * The |enable_crash_throttling| flag indicates whether or not crashes of 1763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) * the nexe contribute to crash throttling statisics and whether nexe starts 1773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) * are throttled by crash throttling. 1782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 1795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void (*LaunchSelLdr)(PP_Instance instance, 1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* alleged_url, 1815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool uses_irt, 1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool uses_ppapi, 183a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_Bool uses_nonsfi_mode, 1845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool enable_ppapi_dev, 1855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool enable_dyncode_syscalls, 1865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool enable_exception_handling, 1875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool enable_crash_throttling, 1885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void* imc_handle, 1895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var* error_message, 1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_CompletionCallback callback); 1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* This function starts the IPC proxy so the nexe can communicate with the 192c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch * browser. 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 194c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch PP_Bool (*StartPpapiProxy)(PP_Instance instance); 1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* On POSIX systems, this function returns the file descriptor of 1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * /dev/urandom. On non-POSIX systems, this function returns 0. 1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int32_t (*UrandomFD)(void); 1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI 2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * proxy. This is so paranoid admins can effectively prevent untrusted shader 2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * code to be processed by the graphics stack. 2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) PP_Bool (*Are3DInterfacesDisabled)(void); 2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* This is Windows-specific. This is a replacement for DuplicateHandle() for 2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * use inside the Windows sandbox. Note that we provide this via dependency 2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * injection only to avoid the linkage problems that occur because the NaCl 2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * plugin is built as a separate DLL/DSO 2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8). 2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int32_t (*BrokerDuplicateHandle)(PP_FileHandle source_handle, 2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint32_t process_id, 2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) PP_FileHandle* target_handle, 2132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint32_t desired_access, 2142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint32_t options); 2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* Returns a read-only file descriptor of a file rooted in the Pnacl 216c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * component directory, or an invalid handle on failure. 2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_FileHandle (*GetReadonlyPnaclFd)(const char* filename); 2192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /* This creates a temporary file that will be deleted by the time 2202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * the last handle is closed (or earlier on POSIX systems), and 2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * returns a posix handle to that temporary file. 2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_FileHandle (*CreateTemporaryFile)(PP_Instance instance); 2245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /* Return the number of processors in the system as reported by the OS */ 2255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int32_t (*GetNumberOfProcessors)(void); 226a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* Return whether the non-SFI mode is enabled. */ 227a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_Bool (*IsNonSFIModeEnabled)(void); 22858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) /* Create a temporary file, which will be deleted by the time the 22958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * last handle is closed (or earlier on POSIX systems), to use for 23058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * the nexe with the cache information given by |pexe_url|, 23158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * |abi_version|, |opt_level|, |last_modified|, |etag|, and 23258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * |has_no_store_header|. If the nexe is already present in the 23358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * cache, |is_hit| is set to PP_TRUE and the contents of the nexe 23458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * will be copied into the temporary file. Otherwise |is_hit| is set 23558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * to PP_FALSE and the temporary file will be writeable. Currently 23658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * the implementation is a stub, which always sets is_hit to false 23758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * and calls the implementation of CreateTemporaryFile. In a 23858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * subsequent CL it will call into the browser which will remember 23958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * the association between the cache key and the fd, and copy the 24058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * nexe into the cache after the translation finishes. 241eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch */ 242eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch int32_t (*GetNexeFd)(PP_Instance instance, 2437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const char* pexe_url, 2447dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint32_t abi_version, 2457dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint32_t opt_level, 2467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const char* last_modified, 2477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch const char* etag, 24858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) PP_Bool has_no_store_header, 2495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* sandbox_isa, 2505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* extra_flags, 251eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch PP_Bool* is_hit, 252eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch PP_FileHandle* nexe_handle, 253eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch struct PP_CompletionCallback callback); 254eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch /* Report to the browser that translation of the pexe for |instance| 255bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * has finished, or aborted with an error. If |success| is true, the 256bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * browser may then store the translation in the cache. The renderer 257bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * must first have called GetNexeFd for the same instance. (The browser is 258bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * not guaranteed to store the nexe even if |success| is true; if there is 259bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * an error on the browser side, or the file is too big for the cache, or 260bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * the browser is in incognito mode, no notification will be delivered to 261bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch * the plugin.) 262eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch */ 263bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch void (*ReportTranslationFinished)(PP_Instance instance, PP_Bool success); 264c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /* Opens a NaCl executable file in the application's extension directory 265c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * corresponding to the file URL and returns a file descriptor, or an invalid 266c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * handle on failure. |metadata| is left unchanged on failure. 267c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) */ 26890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) PP_FileHandle (*OpenNaClExecutable)(PP_Instance instance, 26990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const char* file_url, 27090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) uint64_t* file_token_lo, 27190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) uint64_t* file_token_hi); 272f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /* Dispatch a progress event on the DOM element where the given instance is 273f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * embedded. 274f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 275f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) void (*DispatchEvent)(PP_Instance instance, 276f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_NaClEventType event_type, 2775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const char* resource_url, 278f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) PP_Bool length_is_computable, 279f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) uint64_t loaded_bytes, 280f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) uint64_t total_bytes); 281e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch /* Report that the nexe loaded successfully. */ 282e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch void (*ReportLoadSuccess)(PP_Instance instance, 283e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch const char* url, 284e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch uint64_t loaded_bytes, 285e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch uint64_t total_bytes); 286a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* Report an error that occured while attempting to load a nexe. */ 287a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void (*ReportLoadError)(PP_Instance instance, 288a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PP_NaClError error, 28923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) const char* error_message, 290effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch const char* console_message); 291e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch /* Reports that loading a nexe was aborted. */ 292e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch void (*ReportLoadAbort)(PP_Instance instance); 293c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Reports that the nexe has crashed. */ 294c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*NexeDidCrash)(PP_Instance instance, const char* crash_log); 295effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Performs internal setup when an instance is created. */ 296effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void (*InstanceCreated)(PP_Instance instance); 297a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* Performs internal cleanup when an instance is destroyed. */ 298a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void (*InstanceDestroyed)(PP_Instance instance); 299effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Return true if the NaCl debug stub is enabled and the app loaded from 300effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch * alleged_nmf_url will be attached to a debugger. 301a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 302effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_Bool (*NaClDebugEnabledForURL)(const char* alleged_nmf_url); 303a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /* Returns the kind of SFI sandbox implemented by NaCl on this 304a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * platform. 305a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 306a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const char* (*GetSandboxArch)(void); 30723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) /* Returns the scheme type for a given url. */ 30823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) PP_UrlSchemeType (*GetUrlScheme)(struct PP_Var url); 30923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) /* Logs the message to the console. */ 31023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) void (*LogToConsole)(PP_Instance instance, const char* message); 311effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Returns the NaCl readiness status for this instance. */ 312effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NaClReadyState (*GetNaClReadyState)(PP_Instance instance); 313effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Sets the NaCl readiness status for this instance. */ 314effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void (*SetNaClReadyState)(PP_Instance instance, 315effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_NaClReadyState ready_state); 316effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Returns true if the plugin is an installed app. */ 317effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch PP_Bool (*GetIsInstalled)(PP_Instance instance); 318effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch /* Sets whether the plugin is an installed app. */ 319effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void (*SetIsInstalled)(PP_Instance instance, PP_Bool is_installed); 320e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch /* Sets the time the nexe became ready. */ 321c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*SetReadyTime)(PP_Instance instance); 322c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Returns the exit status of the plugin process. */ 323c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch int32_t (*GetExitStatus)(PP_Instance instance); 324c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Sets the exit status of the plugin process. */ 325c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*SetExitStatus)(PP_Instance instance, int32_t exit_status); 326c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Logs the message via VLOG. */ 327c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*Vlog)(const char* message); 328c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Sets the time the plugin was initialized. */ 329c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*SetInitTime)(PP_Instance instance); 330c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Returns the size of the nexe. */ 331c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch int64_t (*GetNexeSize)(PP_Instance instance); 332c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch /* Sets the size of the nexe. */ 333c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch void (*SetNexeSize)(PP_Instance instance, int64_t nexe_size); 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; 3372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 3382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * @} 3392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 3402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif /* PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ */ 3422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 343