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(imc_bootstrap_handle
)
21 IPC_STRUCT_TRAITS_MEMBER(irt_handle
)
22 #if defined(OS_MACOSX)
23 IPC_STRUCT_TRAITS_MEMBER(mac_shm_fd
)
26 IPC_STRUCT_TRAITS_MEMBER(debug_stub_server_bound_socket
)
28 #if defined(OS_LINUX) || defined(OS_NACL_NONSFI)
29 IPC_STRUCT_TRAITS_MEMBER(ppapi_browser_channel_handle
)
30 IPC_STRUCT_TRAITS_MEMBER(ppapi_renderer_channel_handle
)
31 IPC_STRUCT_TRAITS_MEMBER(trusted_service_channel_handle
)
32 IPC_STRUCT_TRAITS_MEMBER(manifest_service_channel_handle
)
34 IPC_STRUCT_TRAITS_MEMBER(validation_cache_enabled
)
35 IPC_STRUCT_TRAITS_MEMBER(validation_cache_key
)
36 IPC_STRUCT_TRAITS_MEMBER(version
)
37 IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub
)
38 IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy
)
39 IPC_STRUCT_TRAITS_MEMBER(process_type
)
40 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle
)
41 IPC_STRUCT_TRAITS_END()
43 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClResourcePrefetchResult
)
44 IPC_STRUCT_TRAITS_MEMBER(file
)
45 IPC_STRUCT_TRAITS_MEMBER(file_path_metadata
)
46 IPC_STRUCT_TRAITS_MEMBER(file_key
)
47 IPC_STRUCT_TRAITS_END()
49 //-----------------------------------------------------------------------------
50 // NaClProcess messages
51 // These are messages sent between the browser and the NaCl process.
53 // Sends a prefetched resource file to a NaCl loader process. This message
54 // can be sent multiple times, but all of them must be done before sending
55 // NaClProcessMsg_Start.
56 IPC_MESSAGE_CONTROL1(NaClProcessMsg_AddPrefetchedResource
,
57 nacl::NaClResourcePrefetchResult
)
59 // Tells the NaCl process to start. This message can be sent only once.
60 IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start
,
61 nacl::NaClStartParams
/* params */)
64 // Tells the NaCl broker to launch a NaCl loader process.
65 IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker
,
66 std::string
/* channel ID for the loader */)
68 // Notify the browser process that the loader was launched successfully.
69 IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched
,
70 std::string
, /* channel ID for the loader */
71 base::ProcessHandle
/* loader process handle */)
73 // Tells the NaCl broker to attach a debug exception handler to the
74 // given NaCl loader process.
75 IPC_MESSAGE_CONTROL3(NaClProcessMsg_LaunchDebugExceptionHandler
,
76 int32
/* pid of the NaCl process */,
77 base::ProcessHandle
/* handle of the NaCl process */,
78 std::string
/* NaCl internal process layout info */)
80 // Notify the browser process that the broker process finished
81 // attaching a debug exception handler to the given NaCl loader
83 IPC_MESSAGE_CONTROL2(NaClProcessMsg_DebugExceptionHandlerLaunched
,
87 // Notify the broker that all loader processes have been terminated and it
89 IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker
)
91 // Used by the NaCl process to request that a Windows debug exception
92 // handler be attached to it.
93 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_AttachDebugExceptionHandler
,
94 std::string
, /* Internal process info */
97 // Notify the browser process that the NaCl process has bound the given
98 // TCP port number to use for the GDB debug stub.
99 IPC_MESSAGE_CONTROL1(NaClProcessHostMsg_DebugStubPortSelected
,
100 uint16_t /* debug_stub_port */)
103 // Used by the NaCl process to query a database in the browser. The database
104 // contains the signatures of previously validated code chunks.
105 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_QueryKnownToValidate
,
106 std::string
, /* A validation signature */
107 bool /* Can validation be skipped? */)
109 // Used by the NaCl process to add a validation signature to the validation
110 // database in the browser.
111 IPC_MESSAGE_CONTROL1(NaClProcessMsg_SetKnownToValidate
,
112 std::string
/* A validation signature */)
114 // Used by the NaCl process to acquire trusted information about a file directly
115 // from the browser, including the file's path as well as a fresh version of the
117 IPC_MESSAGE_CONTROL2(NaClProcessMsg_ResolveFileToken
,
118 uint64
, /* file_token_lo */
119 uint64
/* file_token_hi */)
120 IPC_MESSAGE_CONTROL4(NaClProcessMsg_ResolveFileTokenReply
,
121 uint64
, /* file_token_lo */
122 uint64
, /* file_token_hi */
123 IPC::PlatformFileForTransit
, /* fd */
124 base::FilePath
/* Path opened to get fd */)
126 // Notify the browser process that the server side of the PPAPI channel was
127 // created successfully.
128 // This is used for SFI mode only. Non-SFI mode passes channel handles in
129 // NaClStartParams instead.
130 IPC_MESSAGE_CONTROL4(NaClProcessHostMsg_PpapiChannelsCreated
,
131 IPC::ChannelHandle
, /* browser_channel_handle */
132 IPC::ChannelHandle
, /* ppapi_renderer_channel_handle */
133 IPC::ChannelHandle
, /* trusted_renderer_channel_handle */
134 IPC::ChannelHandle
/* manifest_service_channel_handle */)