17d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 27d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 37d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// found in the LICENSE file. 47d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Multiply-included file, no traditional include guard. 67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 77d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include <string> 87d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 97d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "base/basictypes.h" 10a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "base/process/process.h" 117d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "build/build_config.h" 12a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "components/nacl/common/nacl_types.h" 13a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "components/nacl/common/pnacl_types.h" 147d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "content/public/common/common_param_traits.h" 157d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "ipc/ipc_channel_handle.h" 167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "ipc/ipc_message_macros.h" 177d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "ipc/ipc_platform_file.h" 187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h" 197d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 207d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#define IPC_MESSAGE_START NaClHostMsgStart 217d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 227d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchParams) 237d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(manifest_url) 24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(nexe_file) 255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(nexe_token_lo) 265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(nexe_token_hi) 277d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(render_view_id) 287d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(permission_bits) 297d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(uses_irt) 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(uses_nonsfi_mode) 317d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(enable_dyncode_syscalls) 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(enable_exception_handling) 333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(enable_crash_throttling) 347d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_STRUCT_TRAITS_END() 357d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 36ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult) 37ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(imc_channel_handle) 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(ppapi_ipc_channel_handle) 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(trusted_ipc_channel_handle) 400529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle) 41ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(plugin_pid) 42ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(plugin_child_id) 4303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle) 44ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_STRUCT_TRAITS_END() 45ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 467dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo) 477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(pexe_url) 487dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(abi_version) 497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(opt_level) 507dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(last_modified) 517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC_STRUCT_TRAITS_MEMBER(etag) 5258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(has_no_store_header) 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(sandbox_isa) 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) IPC_STRUCT_TRAITS_MEMBER(extra_flags) 557dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_STRUCT_TRAITS_END() 567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 577d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to start 587d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// a new instance of the Native Client process. The browser will launch 597d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// the process and return an IPC channel handle. This handle will only 607d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// be valid if the NaCl IPC proxy is enabled. 61ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl, 627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) nacl::NaClLaunchParams /* launch_params */, 63ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch nacl::NaClLaunchResult /* launch_result */, 64ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch std::string /* error_message */) 657d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 667d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to 677d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// open a file for from the Pnacl component directory. 68116680a4aac90f2aa7413d9095a592090648e557Ben MurdochIPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_GetReadonlyPnaclFD, 697d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) std::string /* name of requested PNaCl file */, 70116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool /* is_executable */, 71116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch IPC::PlatformFileForTransit /* output file */, 72116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch uint64_t /* file_token_lo */, 73116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch uint64_t /* file_token_hi */) 747d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 757d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to 767d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// create a temporary file. 777d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClCreateTemporaryFile, 787d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC::PlatformFileForTransit /* out file */) 797d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// A renderer sends this to the browser to request a file descriptor for 817dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// a translated nexe. 82ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_MESSAGE_CONTROL3(NaClHostMsg_NexeTempFileRequest, 837dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch int /* render_view_id */, 84ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch int /* instance */, 857dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch nacl::PnaclCacheInfo /* cache info */) 867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 877dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The browser replies to a renderer's temp file request with output_file, 887dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// which is either a writeable temp file to use for translation, or a 897dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// read-only file containing the translated nexe from the cache. 907dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_MESSAGE_CONTROL3(NaClViewMsg_NexeTempFileReply, 91ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch int /* instance */, 927dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch bool /* is_cache_hit */, 937dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch IPC::PlatformFileForTransit /* output file */) 947dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 957dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// A renderer sends this to the browser to report that its translation has 967dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// finished and its temp file contains the translated nexe. 97bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben MurdochIPC_MESSAGE_CONTROL2(NaClHostMsg_ReportTranslationFinished, 98bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch int /* instance */, 99bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch bool /* success */) 1007dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// A renderer sends this to the browser process to report when the client 102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// architecture is not listed in the manifest. 103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)IPC_MESSAGE_CONTROL1(NaClHostMsg_MissingArchError, 104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int /* render_view_id */) 1057d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 1067d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to 1077d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// open a NaCl executable file from an installed application directory. 1087d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_OpenNaClExecutable, 1097d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) int /* render_view_id */, 1107d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) GURL /* URL of NaCl executable file */, 1117d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) IPC::PlatformFileForTransit /* output file */, 1127d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) uint64 /* file_token_lo */, 1137d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) uint64 /* file_token_hi */) 1145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 115effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// A renderer sends this to the browser process to determine how many 116effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// processors are online. 1175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClGetNumProcessors, 1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int /* Number of processors */) 119effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 120effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// A renderer sends this to the browser process to determine if the 121effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// NaCl application started from the given NMF URL will be debugged. 122effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// If not (filtered out by commandline flags), it sets should_debug to false. 123effb81e5f8246d0db0270817048dc992db66e9fbBen MurdochIPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_NaClDebugEnabledForURL, 124effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch GURL /* alleged URL of NMF file */, 125effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch bool /* should debug */) 126