| 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 <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Generates a channel ID that's non-predictable and unique. | 216 // Generates a channel ID that's non-predictable and unique. |
| 217 static std::string GenerateUniqueRandomChannelID(); | 217 static std::string GenerateUniqueRandomChannelID(); |
| 218 | 218 |
| 219 // Generates a channel ID that, if passed to the client as a shared secret, | 219 // Generates a channel ID that, if passed to the client as a shared secret, |
| 220 // will validate that the client's authenticity. On platforms that do not | 220 // will validate that the client's authenticity. On platforms that do not |
| 221 // require additional this is simply calls GenerateUniqueRandomChannelID(). | 221 // require additional this is simply calls GenerateUniqueRandomChannelID(). |
| 222 // For portability the prefix should not include the \ character. | 222 // For portability the prefix should not include the \ character. |
| 223 static std::string GenerateVerifiedChannelID(const std::string& prefix); | 223 static std::string GenerateVerifiedChannelID(const std::string& prefix); |
| 224 #endif | 224 #endif |
| 225 | 225 |
| 226 // Generates a pair of channel handles that can be used as the client and |
| 227 // server ends of a ChannelMojo. |name_postfix| is appended to the end of the |
| 228 // handle name to help identify the handles. |
| 229 // |
| 230 // Note, when using ChannelMojo, |ChannelHandle::name| serves no functional |
| 231 // purpose other than to identify the channel in logging. |
| 232 static void GenerateMojoChannelHandlePair( |
| 233 const std::string& name_postfix, |
| 234 IPC::ChannelHandle* handle0, |
| 235 IPC::ChannelHandle* handle1); |
| 236 |
| 226 #if defined(OS_LINUX) | 237 #if defined(OS_LINUX) |
| 227 // Sandboxed processes live in a PID namespace, so when sending the IPC hello | 238 // Sandboxed processes live in a PID namespace, so when sending the IPC hello |
| 228 // message from client to server we need to send the PID from the global | 239 // message from client to server we need to send the PID from the global |
| 229 // PID namespace. | 240 // PID namespace. |
| 230 static void SetGlobalPid(int pid); | 241 static void SetGlobalPid(int pid); |
| 231 static int GetGlobalPid(); | 242 static int GetGlobalPid(); |
| 232 #endif | 243 #endif |
| 233 | 244 |
| 234 #if defined(OS_ANDROID) | 245 #if defined(OS_ANDROID) |
| 235 // Most tests are single process and work the same on all platforms. However | 246 // Most tests are single process and work the same on all platforms. However |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 284 |
| 274 #if defined(OS_POSIX) | 285 #if defined(OS_POSIX) |
| 275 // SocketPair() creates a pair of socket FDs suitable for using with | 286 // SocketPair() creates a pair of socket FDs suitable for using with |
| 276 // IPC::Channel. | 287 // IPC::Channel. |
| 277 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 288 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 278 #endif | 289 #endif |
| 279 | 290 |
| 280 } // namespace IPC | 291 } // namespace IPC |
| 281 | 292 |
| 282 #endif // IPC_IPC_CHANNEL_H_ | 293 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |