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

Side by Side Diff: ipc/unix_domain_socket_util.h

Issue 12386010: Implement IPC::ChannelFactory, a class that accept()s on a UNIX socket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix GetPeerEuid usage on client. Created 7 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #ifndef IPC_UNIX_DOMAIN_SOCKET_UTIL_H_
6 #define IPC_UNIX_DOMAIN_SOCKET_UTIL_H_
7
8 #include <string>
9 #include <sys/types.h>
10
11 namespace base {
12 class FilePath;
13 } // namespace base
14
15 namespace IPC {
16
17 // Creates a UNIX-domain socket at |pipe_name| and bind()s it, then listen()s
18 // on it. If successful, |server_listen_fd| will be set to the new file
19 // descriptor, and the function will return true. Otherwise returns false.
20 bool CreateServerUnixDomainSocket(const base::FilePath& pipe_name,
21 int* server_listen_fd);
22
23 // Creates a UNIX-domain socket at |pipe_name| and connect()s to it. If
palmer 2013/03/05 00:12:31 NIT: I'd say "opens" here instead of "creates".
jeremya 2013/03/05 03:27:19 Done.
24 // successful, |client_socket| will be set to the new file descriptor, and
25 // the function will return true. Otherwise returns false.
26 bool CreateClientUnixDomainSocket(const base::FilePath& pipe_name,
27 int* client_socket);
28
29 // Gets the effective user ID of the other end of the UNIX-domain socket
30 // specified by |fd|. If successful, sets |client_euid| to the uid, and returns
31 // true. Otherwise returns false.
32 bool GetPeerEuid(int fd, uid_t* client_euid);
33
34 // Accepts a client attempting to connect to |server_listen_fd|, storing the
35 // new file descriptor for the connection in |server_socket| and returning true
36 // if successful.
37 bool ServerAcceptConnection(int server_listen_fd, int* server_socket);
38
39 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or
40 // MODE_NAMED_CLIENT if you want to pass in your own socket.
41 // The standard size on linux is 108, mac is 104. To maintain consistency
42 // across platforms we standardize on the smaller value.
43 static const size_t kMaxPipeNameLength = 104;
44
45 } // namespace IPC
46
47 #endif // IPC_UNIX_DOMAIN_SOCKET_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698