xref: /aosp_15_r20/external/virglrenderer/src/proxy/proxy_socket.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1 /*
2  * Copyright 2021 Google LLC
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef PROXY_SOCKET_H
7 #define PROXY_SOCKET_H
8 
9 #include "proxy_common.h"
10 
11 struct proxy_socket {
12    int fd;
13 };
14 
15 bool
16 proxy_socket_pair(int out_fds[static 2]);
17 
18 bool
19 proxy_socket_is_seqpacket(int fd);
20 
21 void
22 proxy_socket_init(struct proxy_socket *socket, int fd);
23 
24 void
25 proxy_socket_fini(struct proxy_socket *socket);
26 
27 bool
28 proxy_socket_is_connected(const struct proxy_socket *socket);
29 
30 bool
31 proxy_socket_receive_reply(struct proxy_socket *socket, void *data, size_t size);
32 
33 bool
34 proxy_socket_receive_reply_with_fds(struct proxy_socket *socket,
35                                     void *data,
36                                     size_t size,
37                                     int *fds,
38                                     int max_fd_count,
39                                     int *out_fd_count);
40 
41 bool
42 proxy_socket_send_request(struct proxy_socket *socket, const void *data, size_t size);
43 
44 bool
45 proxy_socket_send_request_with_fds(struct proxy_socket *socket,
46                                    const void *data,
47                                    size_t size,
48                                    const int *fds,
49                                    int fd_count);
50 
51 #endif /* PROXY_SOCKET_H */
52