| 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 <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #if defined(OS_POSIX) | 12 #if defined(OS_POSIX) |
| 11 #include <sys/types.h> | 13 #include <sys/types.h> |
| 12 #endif | 14 #endif |
| 13 | 15 |
| 14 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 15 #include "base/files/scoped_file.h" | 17 #include "base/files/scoped_file.h" |
| 16 #include "base/process/process.h" | 18 #include "base/process/process.h" |
| 17 #include "ipc/ipc_channel_handle.h" | 19 #include "ipc/ipc_channel_handle.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 // Messages internal to the IPC implementation are defined here. | 76 // Messages internal to the IPC implementation are defined here. |
| 75 // Uses Maximum value of message type (uint16), to avoid conflicting | 77 // Uses Maximum value of message type (uint16), to avoid conflicting |
| 76 // with normal message types, which are enumeration constants starting from 0. | 78 // with normal message types, which are enumeration constants starting from 0. |
| 77 enum { | 79 enum { |
| 78 // The Hello message is sent by the peer when the channel is connected. | 80 // The Hello message is sent by the peer when the channel is connected. |
| 79 // The message contains just the process id (pid). | 81 // The message contains just the process id (pid). |
| 80 // The message has a special routing_id (MSG_ROUTING_NONE) | 82 // The message has a special routing_id (MSG_ROUTING_NONE) |
| 81 // and type (HELLO_MESSAGE_TYPE). | 83 // and type (HELLO_MESSAGE_TYPE). |
| 82 HELLO_MESSAGE_TYPE = kuint16max, | 84 HELLO_MESSAGE_TYPE = UINT16_MAX, |
| 83 // The CLOSE_FD_MESSAGE_TYPE is used in the IPC class to | 85 // The CLOSE_FD_MESSAGE_TYPE is used in the IPC class to |
| 84 // work around a bug in sendmsg() on Mac. When an FD is sent | 86 // work around a bug in sendmsg() on Mac. When an FD is sent |
| 85 // over the socket, a CLOSE_FD_MESSAGE is sent with hops = 2. | 87 // over the socket, a CLOSE_FD_MESSAGE is sent with hops = 2. |
| 86 // The client will return the message with hops = 1, *after* it | 88 // The client will return the message with hops = 1, *after* it |
| 87 // has received the message that contains the FD. When we | 89 // has received the message that contains the FD. When we |
| 88 // receive it again on the sender side, we close the FD. | 90 // receive it again on the sender side, we close the FD. |
| 89 CLOSE_FD_MESSAGE_TYPE = HELLO_MESSAGE_TYPE - 1 | 91 CLOSE_FD_MESSAGE_TYPE = HELLO_MESSAGE_TYPE - 1 |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 // The maximum message size in bytes. Attempting to receive a message of this | 94 // The maximum message size in bytes. Attempting to receive a message of this |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 246 |
| 245 #if defined(OS_POSIX) | 247 #if defined(OS_POSIX) |
| 246 // SocketPair() creates a pair of socket FDs suitable for using with | 248 // SocketPair() creates a pair of socket FDs suitable for using with |
| 247 // IPC::Channel. | 249 // IPC::Channel. |
| 248 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 250 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 249 #endif | 251 #endif |
| 250 | 252 |
| 251 } // namespace IPC | 253 } // namespace IPC |
| 252 | 254 |
| 253 #endif // IPC_IPC_CHANNEL_H_ | 255 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |