1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_IPC_CHANNEL_HANDLE_H_
6 #define IPC_IPC_CHANNEL_HANDLE_H_
8 #include "build/build_config.h"
11 #include "base/file_descriptor_posix.h"
14 // On Windows, any process can create an IPC channel and others can fetch
15 // it by name. We pass around the channel names over IPC.
16 // On POSIX, we instead pass around handles to channel endpoints via IPC.
17 // When it's time to IPC a new channel endpoint around, we send both the
18 // channel name as well as a base::FileDescriptor, which is itself a special
19 // type that knows how to copy a socket endpoint over IPC.
21 // In sum, when passing a handle to a channel over IPC, use this data structure
22 // to work on both Windows and POSIX.
26 struct ChannelHandle
{
27 // Note that serialization for this object is defined in the ParamTraits
28 // template specialization in ipc_message_utils.h.
31 base::FileDescriptor socket
;
36 ChannelHandle(const std::string
& n
, const base::FileDescriptor
& s
)
37 : name(n
), socket(s
) {}
39 ChannelHandle(const std::string
& n
) : name(n
) {}
45 #endif // IPC_IPC_CHANNEL_HANDLE_H_