| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_UNIX_DOMAIN_SOCKET_UTIL_H_ | 5 #ifndef IPC_UNIX_DOMAIN_SOCKET_UTIL_H_ |
| 6 #define IPC_UNIX_DOMAIN_SOCKET_UTIL_H_ | 6 #define IPC_UNIX_DOMAIN_SOCKET_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // represented by |peer_fd| shares the same EUID as this process. | 42 // represented by |peer_fd| shares the same EUID as this process. |
| 43 IPC_EXPORT bool IsPeerAuthorized(int peer_fd); | 43 IPC_EXPORT bool IsPeerAuthorized(int peer_fd); |
| 44 | 44 |
| 45 // Accepts a client attempting to connect to |server_listen_fd|, storing the | 45 // Accepts a client attempting to connect to |server_listen_fd|, storing the |
| 46 // new file descriptor for the connection in |server_socket|. | 46 // new file descriptor for the connection in |server_socket|. |
| 47 // | 47 // |
| 48 // Returns false if |server_listen_fd| encounters an unrecoverable error. | 48 // Returns false if |server_listen_fd| encounters an unrecoverable error. |
| 49 // Returns true if it's valid to keep listening on |server_listen_fd|. In this | 49 // Returns true if it's valid to keep listening on |server_listen_fd|. In this |
| 50 // case, it's possible that a connection wasn't successfully established; then, | 50 // case, it's possible that a connection wasn't successfully established; then, |
| 51 // |server_socket| will be set to -1. | 51 // |server_socket| will be set to -1. |
| 52 IPC_EXPORT bool ServerAcceptConnection(int server_listen_fd, | 52 IPC_EXPORT bool ServerOnConnect(int server_listen_fd, |
| 53 int* server_socket); | 53 int* server_socket); |
| 54 | 54 |
| 55 // The maximum length of the name of a socket for MODE_NAMED_SERVER or | 55 // The maximum length of the name of a socket for MODE_NAMED_SERVER or |
| 56 // MODE_NAMED_CLIENT if you want to pass in your own socket. | 56 // MODE_NAMED_CLIENT if you want to pass in your own socket. |
| 57 // The standard size on linux is 108, mac is 104. To maintain consistency | 57 // The standard size on linux is 108, mac is 104. To maintain consistency |
| 58 // across platforms we standardize on the smaller value. | 58 // across platforms we standardize on the smaller value. |
| 59 static const size_t kMaxSocketNameLength = 104; | 59 static const size_t kMaxSocketNameLength = 104; |
| 60 | 60 |
| 61 } // namespace IPC | 61 } // namespace IPC |
| 62 | 62 |
| 63 #endif // IPC_UNIX_DOMAIN_SOCKET_UTIL_H_ | 63 #endif // IPC_UNIX_DOMAIN_SOCKET_UTIL_H_ |
| OLD | NEW |