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(handles
)
22 IPC_STRUCT_TRAITS_MEMBER(debug_stub_server_bound_socket
)
23 IPC_STRUCT_TRAITS_MEMBER(validation_cache_enabled
)
24 IPC_STRUCT_TRAITS_MEMBER(validation_cache_key
)
25 IPC_STRUCT_TRAITS_MEMBER(version
)
26 IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub
)
27 IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy
)
28 IPC_STRUCT_TRAITS_MEMBER(enable_mojo
)
29 IPC_STRUCT_TRAITS_MEMBER(process_type
)
30 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle
)
31 IPC_STRUCT_TRAITS_END()
33 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClResourceFileInfo
)
34 IPC_STRUCT_TRAITS_MEMBER(file
)
35 IPC_STRUCT_TRAITS_MEMBER(file_path_metadata
)
36 IPC_STRUCT_TRAITS_MEMBER(file_key
)
37 IPC_STRUCT_TRAITS_END()
39 //-----------------------------------------------------------------------------
40 // NaClProcess messages
41 // These are messages sent between the browser and the NaCl process.
42 // Tells the NaCl process to start.
43 IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start
,
44 nacl::NaClStartParams
/* params */)
47 // Tells the NaCl broker to launch a NaCl loader process.
48 IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker
,
49 std::string
/* channel ID for the loader */)
51 // Notify the browser process that the loader was launched successfully.
52 IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched
,
53 std::string
, /* channel ID for the loader */
54 base::ProcessHandle
/* loader process handle */)
56 // Tells the NaCl broker to attach a debug exception handler to the
57 // given NaCl loader process.
58 IPC_MESSAGE_CONTROL3(NaClProcessMsg_LaunchDebugExceptionHandler
,
59 int32
/* pid of the NaCl process */,
60 base::ProcessHandle
/* handle of the NaCl process */,
61 std::string
/* NaCl internal process layout info */)
63 // Notify the browser process that the broker process finished
64 // attaching a debug exception handler to the given NaCl loader
66 IPC_MESSAGE_CONTROL2(NaClProcessMsg_DebugExceptionHandlerLaunched
,
70 // Notify the broker that all loader processes have been terminated and it
72 IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker
)
74 // Used by the NaCl process to request that a Windows debug exception
75 // handler be attached to it.
76 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_AttachDebugExceptionHandler
,
77 std::string
, /* Internal process info */
80 // Notify the browser process that the NaCl process has bound the given
81 // TCP port number to use for the GDB debug stub.
82 IPC_MESSAGE_CONTROL1(NaClProcessHostMsg_DebugStubPortSelected
,
83 uint16_t /* debug_stub_port */)
86 // Used by the NaCl process to query a database in the browser. The database
87 // contains the signatures of previously validated code chunks.
88 IPC_SYNC_MESSAGE_CONTROL1_1(NaClProcessMsg_QueryKnownToValidate
,
89 std::string
, /* A validation signature */
90 bool /* Can validation be skipped? */)
92 // Used by the NaCl process to add a validation signature to the validation
93 // database in the browser.
94 IPC_MESSAGE_CONTROL1(NaClProcessMsg_SetKnownToValidate
,
95 std::string
/* A validation signature */)
97 // Used by the NaCl process to acquire trusted information about a file directly
98 // from the browser, including the file's path as well as a fresh version of the
100 IPC_MESSAGE_CONTROL2(NaClProcessMsg_ResolveFileToken
,
101 uint64
, /* file_token_lo */
102 uint64
/* file_token_hi */)
103 IPC_MESSAGE_CONTROL4(NaClProcessMsg_ResolveFileTokenReply
,
104 uint64
, /* file_token_lo */
105 uint64
, /* file_token_hi */
106 IPC::PlatformFileForTransit
, /* fd */
107 base::FilePath
/* Path opened to get fd */)
109 // Notify the browser process that the server side of the PPAPI channel was
110 // created successfully.
111 IPC_MESSAGE_CONTROL4(NaClProcessHostMsg_PpapiChannelsCreated
,
112 IPC::ChannelHandle
, /* browser_channel_handle */
113 IPC::ChannelHandle
, /* ppapi_renderer_channel_handle */
114 IPC::ChannelHandle
, /* trusted_renderer_channel_handle */
115 IPC::ChannelHandle
/* manifest_service_channel_handle */)