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 CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ | 5 #ifndef BASE_POSIX_UNIX_DOMAIN_SOCKET_H_ |
6 #define CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ | 6 #define BASE_POSIX_UNIX_DOMAIN_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "content/common/content_export.h" | 13 #include "base/base_export.h" |
14 | 14 |
15 class Pickle; | 15 class Pickle; |
16 | 16 |
17 class CONTENT_EXPORT UnixDomainSocket { | 17 class BASE_EXPORT UnixDomainSocket { |
18 public: | 18 public: |
19 // Use sendmsg to write the given msg and include a vector of file | 19 // Use sendmsg to write the given msg and include a vector of file |
20 // descriptors. Returns true if successful. | 20 // descriptors. Returns true if successful. |
21 static bool SendMsg(int fd, | 21 static bool SendMsg(int fd, |
22 const void* msg, | 22 const void* msg, |
23 size_t length, | 23 size_t length, |
24 const std::vector<int>& fds); | 24 const std::vector<int>& fds); |
25 | 25 |
26 // Use recvmsg to read a message and an array of file descriptors. Returns | 26 // Use recvmsg to read a message and an array of file descriptors. Returns |
27 // -1 on failure. Note: will read, at most, 16 descriptors. | 27 // -1 on failure. Note: will read, at most, 16 descriptors. |
(...skipping 18 matching lines...) Expand all Loading... |
46 // result_fd: (may be NULL) the file descriptor returned in the reply | 46 // result_fd: (may be NULL) the file descriptor returned in the reply |
47 // (if any) | 47 // (if any) |
48 // request: the bytes to send in the request | 48 // request: the bytes to send in the request |
49 static ssize_t SendRecvMsg(int fd, | 49 static ssize_t SendRecvMsg(int fd, |
50 uint8_t* reply, | 50 uint8_t* reply, |
51 unsigned reply_len, | 51 unsigned reply_len, |
52 int* result_fd, | 52 int* result_fd, |
53 const Pickle& request); | 53 const Pickle& request); |
54 }; | 54 }; |
55 | 55 |
56 #endif // CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ | 56 #endif // BASE_POSIX_UNIX_DOMAIN_SOCKET_POSIX_H_ |
OLD | NEW |