| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ |
| 6 #define CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ | 6 #define CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_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" |
| 14 |
| 13 class Pickle; | 15 class Pickle; |
| 14 | 16 |
| 15 class UnixDomainSocket { | 17 class CONTENT_EXPORT UnixDomainSocket { |
| 16 public: | 18 public: |
| 17 // 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 |
| 18 // descriptors. Returns true if successful. | 20 // descriptors. Returns true if successful. |
| 19 static bool SendMsg(int fd, | 21 static bool SendMsg(int fd, |
| 20 const void* msg, | 22 const void* msg, |
| 21 size_t length, | 23 size_t length, |
| 22 const std::vector<int>& fds); | 24 const std::vector<int>& fds); |
| 23 | 25 |
| 24 // 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 |
| 25 // -1 on failure. Note: will read, at most, 16 descriptors. | 27 // -1 on failure. Note: will read, at most, 16 descriptors. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 // (if any) | 47 // (if any) |
| 46 // request: the bytes to send in the request | 48 // request: the bytes to send in the request |
| 47 static ssize_t SendRecvMsg(int fd, | 49 static ssize_t SendRecvMsg(int fd, |
| 48 uint8_t* reply, | 50 uint8_t* reply, |
| 49 unsigned reply_len, | 51 unsigned reply_len, |
| 50 int* result_fd, | 52 int* result_fd, |
| 51 const Pickle& request); | 53 const Pickle& request); |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 #endif // CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ | 56 #endif // CONTENT_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ |
| OLD | NEW |