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) | |
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 | |
217 // PID namespace. | |
218 static void SetGlobalPid(int pid); | |
219 #endif | |
220 | |
221 #if defined(OS_ANDROID) | 214 #if defined(OS_ANDROID) |
222 // Most tests are single process and work the same on all platforms. However | 215 // 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 | 216 // 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 | 217 // 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. | 218 // process such that it acts similar to if it was exec'd, for tests. |
226 static void NotifyProcessForkedForTesting(); | 219 static void NotifyProcessForkedForTesting(); |
227 #endif | 220 #endif |
228 | 221 |
229 }; | 222 }; |
230 | 223 |
231 #if defined(OS_POSIX) | 224 #if defined(OS_POSIX) |
232 // SocketPair() creates a pair of socket FDs suitable for using with | 225 // SocketPair() creates a pair of socket FDs suitable for using with |
233 // IPC::Channel. | 226 // IPC::Channel. |
234 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 227 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
235 #endif | 228 #endif |
236 | 229 |
237 } // namespace IPC | 230 } // namespace IPC |
238 | 231 |
239 #endif // IPC_IPC_CHANNEL_H_ | 232 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |