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)
247d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(render_view_id)
257d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(permission_bits)
267d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(uses_irt)
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(uses_nonsfi_mode)
287d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(enable_dyncode_syscalls)
297d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(enable_exception_handling)
303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(enable_crash_throttling)
317d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_STRUCT_TRAITS_END()
327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
33ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult)
34ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(imc_channel_handle)
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(ppapi_ipc_channel_handle)
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(trusted_ipc_channel_handle)
370529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle)
38ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(plugin_pid)
39ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(plugin_child_id)
40ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_STRUCT_TRAITS_END()
41ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
427dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo)
437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(pexe_url)
447dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(abi_version)
457dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(opt_level)
467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(last_modified)
477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  IPC_STRUCT_TRAITS_MEMBER(etag)
4858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(has_no_store_header)
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(sandbox_isa)
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(extra_flags)
517dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_STRUCT_TRAITS_END()
527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
537d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to start
547d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// a new instance of the Native Client process. The browser will launch
557d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// the process and return an IPC channel handle. This handle will only
567d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// be valid if the NaCl IPC proxy is enabled.
57ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl,
587d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            nacl::NaClLaunchParams /* launch_params */,
59ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch                            nacl::NaClLaunchResult /* launch_result */,
60ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch                            std::string /* error_message */)
617d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to
637d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// open a file for from the Pnacl component directory.
647d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_GetReadonlyPnaclFD,
657d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            std::string /* name of requested PNaCl file */,
667d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            IPC::PlatformFileForTransit /* output file */)
677d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
687d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to
697d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// create a temporary file.
707d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClCreateTemporaryFile,
717d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            IPC::PlatformFileForTransit /* out file */)
727d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
737dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// A renderer sends this to the browser to request a file descriptor for
747dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// a translated nexe.
75ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochIPC_MESSAGE_CONTROL3(NaClHostMsg_NexeTempFileRequest,
767dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                     int /* render_view_id */,
77ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch                     int /* instance */,
787dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                     nacl::PnaclCacheInfo /* cache info */)
797dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The browser replies to a renderer's temp file request with output_file,
817dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// which is either a writeable temp file to use for translation, or a
827dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// read-only file containing the translated nexe from the cache.
837dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_MESSAGE_CONTROL3(NaClViewMsg_NexeTempFileReply,
84ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch                     int /* instance */,
857dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                     bool /* is_cache_hit */,
867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                     IPC::PlatformFileForTransit /* output file */)
877dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
887dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// A renderer sends this to the browser to report that its translation has
897dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// finished and its temp file contains the translated nexe.
90bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben MurdochIPC_MESSAGE_CONTROL2(NaClHostMsg_ReportTranslationFinished,
91bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                     int /* instance */,
92bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                     bool /* success */)
937dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// A renderer sends this to the browser process to report when the client
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// architecture is not listed in the manifest.
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)IPC_MESSAGE_CONTROL1(NaClHostMsg_MissingArchError,
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                     int /* render_view_id */)
987d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
997d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// A renderer sends this to the browser process when it wants to
1007d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// open a NaCl executable file from an installed application directory.
1017d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_OpenNaClExecutable,
1027d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            int /* render_view_id */,
1037d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            GURL /* URL of NaCl executable file */,
1047d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            IPC::PlatformFileForTransit /* output file */,
1057d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            uint64 /* file_token_lo */,
1067d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                            uint64 /* file_token_hi */)
1075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
108effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// A renderer sends this to the browser process to determine how many
109effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// processors are online.
1105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClGetNumProcessors,
1115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                            int /* Number of processors */)
112effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
113effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// A renderer sends this to the browser process to determine if the
114effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// NaCl application started from the given NMF URL will be debugged.
115effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// If not (filtered out by commandline flags), it sets should_debug to false.
116effb81e5f8246d0db0270817048dc992db66e9fbBen MurdochIPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_NaClDebugEnabledForURL,
117effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                            GURL /* alleged URL of NMF file */,
118effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                            bool /* should debug */)
119