OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IPC_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
7 | 7 |
| 8 #include <stddef.h> |
8 #include <stdint.h> | 9 #include <stdint.h> |
9 | 10 |
10 #include <string> | 11 #include <string> |
11 | 12 |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/files/scoped_file.h" |
| 15 #include "base/process/process.h" |
| 16 #include "build/build_config.h" |
| 17 #include "ipc/ipc_channel_handle.h" |
| 18 #include "ipc/ipc_endpoint.h" |
| 19 #include "ipc/ipc_message.h" |
| 20 |
12 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
13 #include <sys/types.h> | 22 #include <sys/types.h> |
14 #endif | 23 #endif |
15 | 24 |
16 #include "base/compiler_specific.h" | |
17 #include "base/files/scoped_file.h" | |
18 #include "base/process/process.h" | |
19 #include "ipc/ipc_channel_handle.h" | |
20 #include "ipc/ipc_endpoint.h" | |
21 #include "ipc/ipc_message.h" | |
22 | |
23 namespace IPC { | 25 namespace IPC { |
24 | 26 |
25 class Listener; | 27 class Listener; |
26 | 28 |
27 //------------------------------------------------------------------------------ | 29 //------------------------------------------------------------------------------ |
28 // See | 30 // See |
29 // http://www.chromium.org/developers/design-documents/inter-process-communicati
on | 31 // http://www.chromium.org/developers/design-documents/inter-process-communicati
on |
30 // for overview of IPC in Chromium. | 32 // for overview of IPC in Chromium. |
31 | 33 |
32 // Channels are implemented using named pipes on Windows, and | 34 // Channels are implemented using named pipes on Windows, and |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 MODE_CLIENT = MODE_CLIENT_FLAG, | 68 MODE_CLIENT = MODE_CLIENT_FLAG, |
67 MODE_NAMED_SERVER = MODE_SERVER_FLAG | MODE_NAMED_FLAG, | 69 MODE_NAMED_SERVER = MODE_SERVER_FLAG | MODE_NAMED_FLAG, |
68 MODE_NAMED_CLIENT = MODE_CLIENT_FLAG | MODE_NAMED_FLAG, | 70 MODE_NAMED_CLIENT = MODE_CLIENT_FLAG | MODE_NAMED_FLAG, |
69 #if defined(OS_POSIX) | 71 #if defined(OS_POSIX) |
70 MODE_OPEN_NAMED_SERVER = MODE_OPEN_ACCESS_FLAG | MODE_SERVER_FLAG | | 72 MODE_OPEN_NAMED_SERVER = MODE_OPEN_ACCESS_FLAG | MODE_SERVER_FLAG | |
71 MODE_NAMED_FLAG | 73 MODE_NAMED_FLAG |
72 #endif | 74 #endif |
73 }; | 75 }; |
74 | 76 |
75 // Messages internal to the IPC implementation are defined here. | 77 // Messages internal to the IPC implementation are defined here. |
76 // Uses Maximum value of message type (uint16), to avoid conflicting | 78 // Uses Maximum value of message type (uint16_t), to avoid conflicting |
77 // with normal message types, which are enumeration constants starting from 0. | 79 // with normal message types, which are enumeration constants starting from 0. |
78 enum { | 80 enum { |
79 // The Hello message is sent by the peer when the channel is connected. | 81 // The Hello message is sent by the peer when the channel is connected. |
80 // The message contains just the process id (pid). | 82 // The message contains just the process id (pid). |
81 // The message has a special routing_id (MSG_ROUTING_NONE) | 83 // The message has a special routing_id (MSG_ROUTING_NONE) |
82 // and type (HELLO_MESSAGE_TYPE). | 84 // and type (HELLO_MESSAGE_TYPE). |
83 HELLO_MESSAGE_TYPE = UINT16_MAX, | 85 HELLO_MESSAGE_TYPE = UINT16_MAX, |
84 // The CLOSE_FD_MESSAGE_TYPE is used in the IPC class to | 86 // The CLOSE_FD_MESSAGE_TYPE is used in the IPC class to |
85 // work around a bug in sendmsg() on Mac. When an FD is sent | 87 // work around a bug in sendmsg() on Mac. When an FD is sent |
86 // over the socket, a CLOSE_FD_MESSAGE is sent with hops = 2. | 88 // over the socket, a CLOSE_FD_MESSAGE is sent with hops = 2. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 262 |
261 #if defined(OS_POSIX) | 263 #if defined(OS_POSIX) |
262 // SocketPair() creates a pair of socket FDs suitable for using with | 264 // SocketPair() creates a pair of socket FDs suitable for using with |
263 // IPC::Channel. | 265 // IPC::Channel. |
264 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 266 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
265 #endif | 267 #endif |
266 | 268 |
267 } // namespace IPC | 269 } // namespace IPC |
268 | 270 |
269 #endif // IPC_IPC_CHANNEL_H_ | 271 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |