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.
5 // Defines messages between the browser and NaCl process.
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 "components/nacl/common/nacl_types_param_traits.h"
11 #include "ipc/ipc_channel_handle.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_platform_file.h"
15 #define IPC_MESSAGE_START NaClMsgStart
17 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClStartParams
)
18 IPC_STRUCT_TRAITS_MEMBER(nexe_file
)
19 IPC_STRUCT_TRAITS_MEMBER(nexe_file_path_metadata
)
20 IPC_STRUCT_TRAITS_MEMBER(prefetched_resource_files
)
21 IPC_STRUCT_TRAITS_MEMBER(imc_bootstrap_handle
)
22 IPC_STRUCT_TRAITS_MEMBER(irt_handle
)
23 #if defined(OS_MACOSX)
24 IPC_STRUCT_TRAITS_MEMBER(mac_shm_fd
)
27 IPC_STRUCT_TRAITS_MEMBER(debug_stub_server_bound_socket
)
29 IPC_STRUCT_TRAITS_MEMBER(validation_cache_enabled
)
30 IPC_STRUCT_TRAITS_MEMBER(validation_cache_key
)
31 IPC_STRUCT_TRAITS_MEMBER(version
)
32 IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub
)
33 IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy
)
34 IPC_STRUCT_TRAITS_MEMBER(process_type
)
35 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle
)
36 IPC_STRUCT_TRAITS_END()
38 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClResourcePrefetchResult
)
39 IPC_STRUCT_TRAITS_MEMBER(file
)
40 IPC_STRUCT_TRAITS_MEMBER(file_path_metadata
)
41 IPC_STRUCT_TRAITS_MEMBER(file_key
)
42 IPC_STRUCT_TRAITS_END()
44 //-----------------------------------------------------------------------------
45 // NaClProcess messages
46 // These are messages sent between the browser and the NaCl process.
47 // Tells the NaCl process to start.
48 IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start
,
49 nacl::NaClStartParams
/* params */)
52 // Tells the NaCl broker to launch a NaCl loader process.
53 IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker
,
54 std::string
/* channel ID for the loader */)
56 // Notify the browser process that the loader was launched successfully.
57 IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched
,
58 std::string
, /* channel ID for the loader */
59 base::ProcessHandle
/* loader process handle */)
61 // Tells the NaCl broker to attach a debug exception handler to the
62 // given NaCl loader process.
63 IPC_MESSAGE_CONTROL3(NaClProcessMsg_LaunchDebugExceptionHandler
,
64 int32
/* pid of the NaCl process */,
65 base::ProcessHandle
/* handle of the NaCl process */,
66 std::string
/* NaCl internal process layout info */)
68 // Notify the browser process that the broker process finished
69 // attaching a debug exception handler to the given NaCl loader
71 IPC_MESSAGE_CONTROL2(NaClProcessMsg_DebugExceptionHandlerLaunched
,
75 // Notify the broker that all loader processes have been terminated and it
77 IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker
)
79 // Used by the NaCl process to request that a Windows debug exception
80 // handler be attached to it.
81 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_AttachDebugExceptionHandler
,
82 std::string
, /* Internal process info */
85 // Notify the browser process that the NaCl process has bound the given
86 // TCP port number to use for the GDB debug stub.
87 IPC_MESSAGE_CONTROL1(NaClProcessHostMsg_DebugStubPortSelected
,
88 uint16_t /* debug_stub_port */)
91 // Used by the NaCl process to query a database in the browser. The database
92 // contains the signatures of previously validated code chunks.
93 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_QueryKnownToValidate
,
94 std::string
, /* A validation signature */
95 bool /* Can validation be skipped? */)
97 // Used by the NaCl process to add a validation signature to the validation
98 // database in the browser.
99 IPC_MESSAGE_CONTROL1(NaClProcessMsg_SetKnownToValidate
,
100 std::string
/* A validation signature */)
102 // Used by the NaCl process to acquire trusted information about a file directly
103 // from the browser, including the file's path as well as a fresh version of the
105 IPC_MESSAGE_CONTROL2(NaClProcessMsg_ResolveFileToken
,
106 uint64
, /* file_token_lo */
107 uint64
/* file_token_hi */)
108 IPC_MESSAGE_CONTROL4(NaClProcessMsg_ResolveFileTokenReply
,
109 uint64
, /* file_token_lo */
110 uint64
, /* file_token_hi */
111 IPC::PlatformFileForTransit
, /* fd */
112 base::FilePath
/* Path opened to get fd */)
114 // Notify the browser process that the server side of the PPAPI channel was
115 // created successfully.
116 IPC_MESSAGE_CONTROL4(NaClProcessHostMsg_PpapiChannelsCreated
,
117 IPC::ChannelHandle
, /* browser_channel_handle */
118 IPC::ChannelHandle
, /* ppapi_renderer_channel_handle */
119 IPC::ChannelHandle
, /* trusted_renderer_channel_handle */
120 IPC::ChannelHandle
/* manifest_service_channel_handle */)