Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: ipc/ipc_channel.h

Issue 320433002: IPC::Channel: Reduce POSIX specific API surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landig Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the 180 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the
181 // FD # for the client end of the socket. 181 // FD # for the client end of the socket.
182 // This method may only be called on the server side of a channel. 182 // This method may only be called on the server side of a channel.
183 // This method can be called on any thread. 183 // This method can be called on any thread.
184 virtual int GetClientFileDescriptor() const = 0; 184 virtual int GetClientFileDescriptor() const = 0;
185 185
186 // Same as GetClientFileDescriptor, but transfers the ownership of the 186 // Same as GetClientFileDescriptor, but transfers the ownership of the
187 // file descriptor to the caller. 187 // file descriptor to the caller.
188 // This method can be called on any thread. 188 // This method can be called on any thread.
189 virtual int TakeClientFileDescriptor() = 0; 189 virtual int TakeClientFileDescriptor() = 0;
190
191 // On POSIX an IPC::Channel can either wrap an established socket, or it
192 // can wrap a socket that is listening for connections. Currently an
193 // IPC::Channel that listens for connections can only accept one connection
194 // at a time.
195
196 // Returns true if the channel supports listening for connections.
197 virtual bool AcceptsConnections() const = 0;
198
199 // Returns true if the channel supports listening for connections and is
200 // currently connected.
201 virtual bool HasAcceptedConnection() const = 0;
202
203 // Returns true if the peer process' effective user id can be determined, in
204 // which case the supplied peer_euid is updated with it.
205 virtual bool GetPeerEuid(uid_t* peer_euid) const = 0;
206
207 // Closes any currently connected socket, and returns to a listening state
208 // for more connections.
209 virtual void ResetToAcceptingConnectionState() = 0;
210 #endif // defined(OS_POSIX) && !defined(OS_NACL) 190 #endif // defined(OS_POSIX) && !defined(OS_NACL)
211 191
212 // Returns true if a named server channel is initialized on the given channel 192 // Returns true if a named server channel is initialized on the given channel
213 // ID. Even if true, the server may have already accepted a connection. 193 // ID. Even if true, the server may have already accepted a connection.
214 static bool IsNamedServerInitialized(const std::string& channel_id); 194 static bool IsNamedServerInitialized(const std::string& channel_id);
215 195
216 #if !defined(OS_NACL) 196 #if !defined(OS_NACL)
217 // Generates a channel ID that's non-predictable and unique. 197 // Generates a channel ID that's non-predictable and unique.
218 static std::string GenerateUniqueRandomChannelID(); 198 static std::string GenerateUniqueRandomChannelID();
219 199
(...skipping 23 matching lines...) Expand all
243 223
244 #if defined(OS_POSIX) 224 #if defined(OS_POSIX)
245 // SocketPair() creates a pair of socket FDs suitable for using with 225 // SocketPair() creates a pair of socket FDs suitable for using with
246 // IPC::Channel. 226 // IPC::Channel.
247 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); 227 IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
248 #endif 228 #endif
249 229
250 } // namespace IPC 230 } // namespace IPC
251 231
252 #endif // IPC_IPC_CHANNEL_H_ 232 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698