OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_POSIX_H_ | 5 #ifndef IPC_IPC_CHANNEL_POSIX_H_ |
6 #define IPC_IPC_CHANNEL_POSIX_H_ | 6 #define IPC_IPC_CHANNEL_POSIX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual ~ChannelImpl(); | 55 virtual ~ChannelImpl(); |
56 bool Connect(); | 56 bool Connect(); |
57 void Close(); | 57 void Close(); |
58 void set_listener(Listener* listener) { listener_ = listener; } | 58 void set_listener(Listener* listener) { listener_ = listener; } |
59 bool Send(Message* message); | 59 bool Send(Message* message); |
60 int GetClientFileDescriptor() const; | 60 int GetClientFileDescriptor() const; |
61 bool AcceptsConnections() const; | 61 bool AcceptsConnections() const; |
62 bool HasAcceptedConnection() const; | 62 bool HasAcceptedConnection() const; |
63 bool GetClientEuid(uid_t* client_euid) const; | 63 bool GetClientEuid(uid_t* client_euid) const; |
64 void ResetToAcceptingConnectionState(); | 64 void ResetToAcceptingConnectionState(); |
65 #if defined(OS_LINUX) | |
66 void SetNeedsOverridePeerPid(); | |
67 void OverridePeerPid(int32 peer_pid); | |
68 #endif // defined(OS_LINUX) | |
69 static bool IsNamedServerInitialized(const std::string& channel_id); | 65 static bool IsNamedServerInitialized(const std::string& channel_id); |
70 | 66 |
71 private: | 67 private: |
72 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 68 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
73 | 69 |
74 bool ProcessIncomingMessages(); | 70 bool ProcessIncomingMessages(); |
75 bool ProcessOutgoingMessages(); | 71 bool ProcessOutgoingMessages(); |
76 | 72 |
77 bool AcceptConnection(); | 73 bool AcceptConnection(); |
78 void ClosePipeOnError(); | 74 void ClosePipeOnError(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 #endif | 140 #endif |
145 | 141 |
146 // Large messages that span multiple pipe buffers, get built-up using | 142 // Large messages that span multiple pipe buffers, get built-up using |
147 // this buffer. | 143 // this buffer. |
148 std::string input_overflow_buf_; | 144 std::string input_overflow_buf_; |
149 std::vector<int> input_overflow_fds_; | 145 std::vector<int> input_overflow_fds_; |
150 | 146 |
151 // True if we are responsible for unlinking the unix domain socket file. | 147 // True if we are responsible for unlinking the unix domain socket file. |
152 bool must_unlink_; | 148 bool must_unlink_; |
153 | 149 |
154 // See IPC::Channel::SetNeedsOverridePeerPid() header comment for details. | |
155 bool needs_override_peer_pid_; | |
156 int32 override_peer_pid_; | |
157 | |
158 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); | 150 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); |
159 }; | 151 }; |
160 | 152 |
161 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or | 153 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or |
162 // MODE_NAMED_CLIENT if you want to pass in your own socket. | 154 // MODE_NAMED_CLIENT if you want to pass in your own socket. |
163 // The standard size on linux is 108, mac is 104. To maintain consistency | 155 // The standard size on linux is 108, mac is 104. To maintain consistency |
164 // across platforms we standardize on the smaller value. | 156 // across platforms we standardize on the smaller value. |
165 static const size_t kMaxPipeNameLength = 104; | 157 static const size_t kMaxPipeNameLength = 104; |
166 | 158 |
167 } // namespace IPC | 159 } // namespace IPC |
168 | 160 |
169 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 161 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
OLD | NEW |