OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 // IPC messages used by the attachment broker. | |
6 // Multiply-included message file, hence no include guard. | |
7 | |
8 #include "base/process/process_handle.h" | |
9 #include "build/build_config.h" | |
10 #include "ipc/brokerable_attachment.h" | |
11 #include "ipc/ipc_export.h" | |
12 #include "ipc/ipc_message_macros.h" | |
13 | |
14 #if defined(OS_WIN) | |
15 #include "ipc/handle_attachment_win.h" | |
16 #endif // defined(OS_WIN) | |
17 | |
18 #if defined(OS_MACOSX) | |
19 #include "ipc/mach_port_attachment_mac.h" | |
20 #endif // defined(OS_MACOSX) | |
21 | |
22 // ---------------------------------------------------------------------------- | |
23 // Serialization of structs. | |
24 // ---------------------------------------------------------------------------- | |
25 | |
26 #if defined(OS_WIN) | |
27 // Define the serialization for Permissions. | |
28 IPC_ENUM_TRAITS_MAX_VALUE(HandleWin::Permissions, HandleWin::MAX_PERMISSIONS); | |
29 | |
30 IPC_STRUCT_TRAITS_BEGIN(IPC::internal::HandleAttachmentWin::WireFormat) | |
31 IPC_STRUCT_TRAITS_MEMBER(handle) | |
32 IPC_STRUCT_TRAITS_MEMBER(destination_process) | |
33 IPC_STRUCT_TRAITS_MEMBER(permissions) | |
34 IPC_STRUCT_TRAITS_MEMBER(attachment_id) | |
35 IPC_STRUCT_TRAITS_END() | |
36 #endif // defined(OS_WIN) | |
37 | |
38 #if defined(OS_MACOSX) | |
39 IPC_STRUCT_TRAITS_BEGIN(IPC::internal::MachPortAttachmentMac::WireFormat) | |
40 IPC_STRUCT_TRAITS_MEMBER(mach_port) | |
41 IPC_STRUCT_TRAITS_MEMBER(destination_process) | |
42 IPC_STRUCT_TRAITS_MEMBER(attachment_id) | |
43 IPC_STRUCT_TRAITS_END() | |
44 #endif // defined(OS_MACOSX) | |
45 | |
46 #undef IPC_MESSAGE_EXPORT | |
47 #define IPC_MESSAGE_EXPORT IPC_EXPORT | |
48 #define IPC_MESSAGE_START AttachmentBrokerMsgStart | |
49 | |
50 // ---------------------------------------------------------------------------- | |
51 // Messages sent from the broker to a non-broker process. | |
52 // ---------------------------------------------------------------------------- | |
53 | |
54 #if defined(OS_WIN) | |
55 // Sent from a broker to a non-broker to indicate that a windows HANDLE has been | |
56 // brokered. Contains all information necessary for the non-broker to translate | |
57 // a BrokerAttachment::AttachmentId to a BrokerAttachment. | |
58 IPC_MESSAGE_CONTROL1( | |
59 AttachmentBrokerMsg_WinHandleHasBeenDuplicated, | |
60 IPC::internal::HandleAttachmentWin::WireFormat /* wire_format */) | |
61 #endif // defined(OS_WIN) | |
62 | |
63 #if defined(OS_MACOSX) | |
64 // Sent from a broker process to a non-broker process to indicate that an OSX | |
65 // Mach port has been duplicated. Contains all information necessary for the | |
66 // non-broker process to translate a BrokerAttachment::AttachmentId to a | |
67 // BrokerAttachment. | |
68 IPC_MESSAGE_CONTROL1( | |
69 AttachmentBrokerMsg_MachPortHasBeenDuplicated, | |
70 IPC::internal::MachPortAttachmentMac::WireFormat /* wire_format */) | |
71 #endif // defined(OS_MACOSX) | |
72 | |
73 // ---------------------------------------------------------------------------- | |
74 // Messages sent from a non-broker process to a broker process. | |
75 // ---------------------------------------------------------------------------- | |
76 | |
77 #if defined(OS_WIN) | |
78 // Sent from a non-broker to a broker to request the duplication of a HANDLE | |
79 // into a different process (possibly the broker process, or even the original | |
80 // process). | |
81 IPC_MESSAGE_CONTROL1( | |
82 AttachmentBrokerMsg_DuplicateWinHandle, | |
83 IPC::internal::HandleAttachmentWin::WireFormat /* wire_format */) | |
84 #endif // defined(OS_WIN) | |
85 | |
86 #if defined(OS_MACOSX) | |
87 // Sent from a non-broker process to a broker process to request the duplication | |
88 // of a Mach port into a different process (possibly the broker process, or even | |
89 // the original process). | |
90 IPC_MESSAGE_CONTROL1( | |
91 AttachmentBrokerMsg_DuplicateMachPort, | |
92 IPC::internal::MachPortAttachmentMac::WireFormat /* wire_format */) | |
93 #endif // defined(OS_MACOSX) | |
OLD | NEW |