1// Copyright 2013 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. 4 5// Defines messages between the browser and NaCl process. 6 7// Multiply-included message file, no traditional include guard. 8#include "base/process/process.h" 9#include "components/nacl/common/nacl_types.h" 10#include "ipc/ipc_channel_handle.h" 11#include "ipc/ipc_message_macros.h" 12#include "ipc/ipc_platform_file.h" 13 14#define IPC_MESSAGE_START NaClMsgStart 15 16IPC_STRUCT_TRAITS_BEGIN(nacl::NaClStartParams) 17 IPC_STRUCT_TRAITS_MEMBER(nexe_file) 18 IPC_STRUCT_TRAITS_MEMBER(nexe_token_lo) 19 IPC_STRUCT_TRAITS_MEMBER(nexe_token_hi) 20 IPC_STRUCT_TRAITS_MEMBER(handles) 21 IPC_STRUCT_TRAITS_MEMBER(debug_stub_server_bound_socket) 22 IPC_STRUCT_TRAITS_MEMBER(validation_cache_enabled) 23 IPC_STRUCT_TRAITS_MEMBER(validation_cache_key) 24 IPC_STRUCT_TRAITS_MEMBER(version) 25 IPC_STRUCT_TRAITS_MEMBER(enable_exception_handling) 26 IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub) 27 IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy) 28 IPC_STRUCT_TRAITS_MEMBER(uses_irt) 29 IPC_STRUCT_TRAITS_MEMBER(enable_dyncode_syscalls) 30 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle) 31IPC_STRUCT_TRAITS_END() 32 33//----------------------------------------------------------------------------- 34// NaClProcess messages 35// These are messages sent between the browser and the NaCl process. 36// Tells the NaCl process to start. 37IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start, 38 nacl::NaClStartParams /* params */) 39 40#if defined(OS_WIN) 41// Tells the NaCl broker to launch a NaCl loader process. 42IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker, 43 std::string /* channel ID for the loader */) 44 45// Notify the browser process that the loader was launched successfully. 46IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched, 47 std::string, /* channel ID for the loader */ 48 base::ProcessHandle /* loader process handle */) 49 50// Tells the NaCl broker to attach a debug exception handler to the 51// given NaCl loader process. 52IPC_MESSAGE_CONTROL3(NaClProcessMsg_LaunchDebugExceptionHandler, 53 int32 /* pid of the NaCl process */, 54 base::ProcessHandle /* handle of the NaCl process */, 55 std::string /* NaCl internal process layout info */) 56 57// Notify the browser process that the broker process finished 58// attaching a debug exception handler to the given NaCl loader 59// process. 60IPC_MESSAGE_CONTROL2(NaClProcessMsg_DebugExceptionHandlerLaunched, 61 int32 /* pid */, 62 bool /* success */) 63 64// Notify the broker that all loader processes have been terminated and it 65// should shutdown. 66IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker) 67 68// Used by the NaCl process to request that a Windows debug exception 69// handler be attached to it. 70IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_AttachDebugExceptionHandler, 71 std::string, /* Internal process info */ 72 bool /* Result */) 73 74// Notify the browser process that the NaCl process has bound the given 75// TCP port number to use for the GDB debug stub. 76IPC_MESSAGE_CONTROL1(NaClProcessHostMsg_DebugStubPortSelected, 77 uint16_t /* debug_stub_port */) 78#endif 79 80// Used by the NaCl process to query a database in the browser. The database 81// contains the signatures of previously validated code chunks. 82IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_QueryKnownToValidate, 83 std::string, /* A validation signature */ 84 bool /* Can validation be skipped? */) 85 86// Used by the NaCl process to add a validation signature to the validation 87// database in the browser. 88IPC_MESSAGE_CONTROL1(NaClProcessMsg_SetKnownToValidate, 89 std::string /* A validation signature */) 90 91// Used by the NaCl process to acquire trusted information about a file directly 92// from the browser, including the file's path as well as a fresh version of the 93// file handle. 94// TODO(teravest): Remove the synchronous version of this message once initial 95// nexe validation caching stops using this. 96IPC_SYNC_MESSAGE_CONTROL2_2(NaClProcessMsg_ResolveFileToken, 97 uint64, /* file_token_lo */ 98 uint64, /* file_token_hi */ 99 IPC::PlatformFileForTransit, /* fd */ 100 base::FilePath /* Path opened to get fd */) 101 102IPC_MESSAGE_CONTROL2(NaClProcessMsg_ResolveFileTokenAsync, 103 uint64, /* file_token_lo */ 104 uint64 /* file_token_hi */) 105IPC_MESSAGE_CONTROL4(NaClProcessMsg_ResolveFileTokenAsyncReply, 106 uint64, /* file_token_lo */ 107 uint64, /* file_token_hi */ 108 IPC::PlatformFileForTransit, /* fd */ 109 base::FilePath /* Path opened to get fd */) 110 111// Notify the browser process that the server side of the PPAPI channel was 112// created successfully. 113IPC_MESSAGE_CONTROL4(NaClProcessHostMsg_PpapiChannelsCreated, 114 IPC::ChannelHandle, /* browser_channel_handle */ 115 IPC::ChannelHandle, /* ppapi_renderer_channel_handle */ 116 IPC::ChannelHandle, /* trusted_renderer_channel_handle */ 117 IPC::ChannelHandle /* manifest_service_channel_handle */) 118