| 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 BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 5 #ifndef BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
| 6 #define BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 6 #define BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // reply_len: size of |reply| | 65 // reply_len: size of |reply| |
| 66 // result_fd: (may be NULL) the file descriptor returned in the reply | 66 // result_fd: (may be NULL) the file descriptor returned in the reply |
| 67 // (if any) | 67 // (if any) |
| 68 // request: the bytes to send in the request | 68 // request: the bytes to send in the request |
| 69 static ssize_t SendRecvMsg(int fd, | 69 static ssize_t SendRecvMsg(int fd, |
| 70 uint8_t* reply, | 70 uint8_t* reply, |
| 71 unsigned reply_len, | 71 unsigned reply_len, |
| 72 int* result_fd, | 72 int* result_fd, |
| 73 const Pickle& request); | 73 const Pickle& request); |
| 74 | 74 |
| 75 // Same as SendRecvMsg, but sends an extra file descriptor with the request |
| 76 // message. |
| 77 static ssize_t SendRecvMsgWithFD(int fd, |
| 78 uint8_t* reply, |
| 79 unsigned reply_len, |
| 80 int* result_fd, |
| 81 const Pickle& request, |
| 82 int request_fd); |
| 83 |
| 75 // Similar to SendRecvMsg(), but |recvmsg_flags| allows to control the flags | 84 // Similar to SendRecvMsg(), but |recvmsg_flags| allows to control the flags |
| 76 // of the recvmsg(2) call. | 85 // of the recvmsg(2) call. |
| 77 static ssize_t SendRecvMsgWithFlags(int fd, | 86 static ssize_t SendRecvMsgWithFlags(int fd, |
| 78 uint8_t* reply, | 87 uint8_t* reply, |
| 79 unsigned reply_len, | 88 unsigned reply_len, |
| 80 int recvmsg_flags, | 89 int recvmsg_flags, |
| 81 int* result_fd, | 90 int* result_fd, |
| 82 const Pickle& request); | 91 const Pickle& request); |
| 92 |
| 83 private: | 93 private: |
| 84 // Similar to RecvMsg, but allows to specify |flags| for recvmsg(2). | 94 // Similar to RecvMsg, but allows to specify |flags| for recvmsg(2). |
| 85 static ssize_t RecvMsgWithFlags(int fd, | 95 static ssize_t RecvMsgWithFlags(int fd, |
| 86 void* msg, | 96 void* msg, |
| 87 size_t length, | 97 size_t length, |
| 88 int flags, | 98 int flags, |
| 89 std::vector<int>* fds, | 99 std::vector<int>* fds, |
| 90 base::ProcessId* pid); | 100 base::ProcessId* pid); |
| 101 |
| 102 static ssize_t SendRecvMsgImpl(int fd, |
| 103 uint8_t* reply, |
| 104 unsigned max_reply_len, |
| 105 int recvmsg_flags, |
| 106 int* result_fd, |
| 107 const Pickle& request, |
| 108 int request_fd); |
| 91 }; | 109 }; |
| 92 | 110 |
| 93 #endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ | 111 #endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_LINUX_H_ |
| OLD | NEW |