| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #if defined(OS_POSIX) | 11 #if defined(OS_POSIX) |
| 12 #include <sys/types.h> | 12 #include <sys/types.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/process.h" | 16 #include "base/process.h" |
| 17 #include "ipc/ipc_channel_handle.h" | 17 #include "ipc/ipc_channel_handle.h" |
| 18 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 19 #include "ipc/ipc_sender.h" | 19 #include "ipc/ipc_sender.h" |
| 20 | 20 |
| 21 // TODO(brettw) remove this when the "typedef Sender" is removed below. | 21 // TODO(brettw) remove this and update files that depend on this being included |
| 22 // from here. |
| 22 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
| 23 | 24 |
| 24 namespace IPC { | 25 namespace IPC { |
| 25 | 26 |
| 26 class Listener; | 27 class Listener; |
| 27 | 28 |
| 28 //------------------------------------------------------------------------------ | 29 //------------------------------------------------------------------------------ |
| 29 // See | 30 // See |
| 30 // http://www.chromium.org/developers/design-documents/inter-process-communicati
on | 31 // http://www.chromium.org/developers/design-documents/inter-process-communicati
on |
| 31 // for overview of IPC in Chromium. | 32 // for overview of IPC in Chromium. |
| 32 | 33 |
| 33 // Channels are implemented using named pipes on Windows, and | 34 // Channels are implemented using named pipes on Windows, and |
| 34 // socket pairs (or in some special cases unix domain sockets) on POSIX. | 35 // socket pairs (or in some special cases unix domain sockets) on POSIX. |
| 35 // On Windows we access pipes in various processes by name. | 36 // On Windows we access pipes in various processes by name. |
| 36 // On POSIX we pass file descriptors to child processes and assign names to them | 37 // On POSIX we pass file descriptors to child processes and assign names to them |
| 37 // in a lookup table. | 38 // in a lookup table. |
| 38 // In general on POSIX we do not use unix domain sockets due to security | 39 // In general on POSIX we do not use unix domain sockets due to security |
| 39 // concerns and the fact that they can leave garbage around the file system | 40 // concerns and the fact that they can leave garbage around the file system |
| 40 // (MacOS does not support abstract named unix domain sockets). | 41 // (MacOS does not support abstract named unix domain sockets). |
| 41 // You can use unix domain sockets if you like on POSIX by constructing the | 42 // You can use unix domain sockets if you like on POSIX by constructing the |
| 42 // the channel with the mode set to one of the NAMED modes. NAMED modes are | 43 // the channel with the mode set to one of the NAMED modes. NAMED modes are |
| 43 // currently used by automation and service processes. | 44 // currently used by automation and service processes. |
| 44 | 45 |
| 45 class IPC_EXPORT Channel : public Sender { | 46 class IPC_EXPORT Channel : public Sender { |
| 46 // Security tests need access to the pipe handle. | 47 // Security tests need access to the pipe handle. |
| 47 friend class ChannelTest; | 48 friend class ChannelTest; |
| 48 | 49 |
| 49 public: | 50 public: |
| 50 // IPC::Listener used to be IPC::Channel::Listener which prevented forward | |
| 51 // declarations. To keep existing code compiling, we provide this | |
| 52 // backwards-compatible definition. New code should use IPC::Listener. | |
| 53 // TODO(brettw) convert users of this and delete. | |
| 54 typedef IPC::Listener Listener; | |
| 55 | |
| 56 // Flags to test modes | 51 // Flags to test modes |
| 57 enum ModeFlags { | 52 enum ModeFlags { |
| 58 MODE_NO_FLAG = 0x0, | 53 MODE_NO_FLAG = 0x0, |
| 59 MODE_SERVER_FLAG = 0x1, | 54 MODE_SERVER_FLAG = 0x1, |
| 60 MODE_CLIENT_FLAG = 0x2, | 55 MODE_CLIENT_FLAG = 0x2, |
| 61 MODE_NAMED_FLAG = 0x4, | 56 MODE_NAMED_FLAG = 0x4, |
| 62 #if defined(OS_POSIX) | 57 #if defined(OS_POSIX) |
| 63 MODE_OPEN_ACCESS_FLAG = 0x8, // Don't restrict access based on client UID. | 58 MODE_OPEN_ACCESS_FLAG = 0x8, // Don't restrict access based on client UID. |
| 64 #endif | 59 #endif |
| 65 }; | 60 }; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 205 |
| 211 private: | 206 private: |
| 212 // PIMPL to which all channel calls are delegated. | 207 // PIMPL to which all channel calls are delegated. |
| 213 class ChannelImpl; | 208 class ChannelImpl; |
| 214 ChannelImpl *channel_impl_; | 209 ChannelImpl *channel_impl_; |
| 215 }; | 210 }; |
| 216 | 211 |
| 217 } // namespace IPC | 212 } // namespace IPC |
| 218 | 213 |
| 219 #endif // IPC_IPC_CHANNEL_H_ | 214 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |