| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Generates a channel ID that's non-predictable and unique. | 204 // Generates a channel ID that's non-predictable and unique. |
| 205 static std::string GenerateUniqueRandomChannelID(); | 205 static std::string GenerateUniqueRandomChannelID(); |
| 206 | 206 |
| 207 // Generates a channel ID that, if passed to the client as a shared secret, | 207 // Generates a channel ID that, if passed to the client as a shared secret, |
| 208 // will validate that the client's authenticity. On platforms that do not | 208 // will validate that the client's authenticity. On platforms that do not |
| 209 // require additional this is simply calls GenerateUniqueRandomChannelID(). | 209 // require additional this is simply calls GenerateUniqueRandomChannelID(). |
| 210 // For portability the prefix should not include the \ character. | 210 // For portability the prefix should not include the \ character. |
| 211 static std::string GenerateVerifiedChannelID(const std::string& prefix); | 211 static std::string GenerateVerifiedChannelID(const std::string& prefix); |
| 212 #endif | 212 #endif |
| 213 | 213 |
| 214 #if defined(OS_LINUX) | 214 #if defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 215 // Sandboxed processes live in a PID namespace, so when sending the IPC hello | 215 // Sandboxed processes live in a PID namespace, so when sending the IPC hello |
| 216 // message from client to server we need to send the PID from the global | 216 // message from client to server we need to send the PID from the global |
| 217 // PID namespace. | 217 // PID namespace. |
| 218 static void SetGlobalPid(int pid); | 218 static void SetGlobalPid(int pid); |
| 219 #endif | 219 #endif |
| 220 | 220 |
| 221 #if defined(OS_ANDROID) | 221 #if defined(OS_ANDROID) |
| 222 // Most tests are single process and work the same on all platforms. However | 222 // Most tests are single process and work the same on all platforms. However |
| 223 // in some cases we want to test multi-process, and Android differs in that it | 223 // in some cases we want to test multi-process, and Android differs in that it |
| 224 // can't 'exec' after forking. This callback resets any data in the forked | 224 // can't 'exec' after forking. This callback resets any data in the forked |
| 225 // process such that it acts similar to if it was exec'd, for tests. | 225 // process such that it acts similar to if it was exec'd, for tests. |
| 226 static void NotifyProcessForkedForTesting(); | 226 static void NotifyProcessForkedForTesting(); |
| 227 #endif | 227 #endif |
| 228 | 228 |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 #if defined(OS_POSIX) | 231 #if defined(OS_POSIX) |
| 232 // SocketPair() creates a pair of socket FDs suitable for using with | 232 // SocketPair() creates a pair of socket FDs suitable for using with |
| 233 // IPC::Channel. | 233 // IPC::Channel. |
| 234 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 234 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 } // namespace IPC | 237 } // namespace IPC |
| 238 | 238 |
| 239 #endif // IPC_IPC_CHANNEL_H_ | 239 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |