Commit | Line | Data |
---|---|---|
0d37f2bc | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2012 David Goulet <dgoulet@efficios.com> |
0d37f2bc | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
0d37f2bc | 5 | * |
0d37f2bc DG |
6 | */ |
7 | ||
8 | #ifndef _LTTCOMM_UNIX_H | |
9 | #define _LTTCOMM_UNIX_H | |
10 | ||
0d37f2bc DG |
11 | #include <limits.h> |
12 | #include <sys/un.h> | |
13 | ||
14 | #include <common/compat/socket.h> | |
8d9eb6d8 | 15 | #include <common/macros.h> |
fe489250 JG |
16 | #include <common/payload.h> |
17 | #include <common/payload-view.h> | |
0d37f2bc | 18 | |
7966af57 SM |
19 | #ifdef __cplusplus |
20 | extern "C" { | |
21 | #endif | |
22 | ||
8d9eb6d8 | 23 | int lttcomm_create_unix_sock(const char *pathname); |
8d9eb6d8 | 24 | int lttcomm_create_anon_unix_socketpair(int *fds); |
8d9eb6d8 | 25 | int lttcomm_connect_unix_sock(const char *pathname); |
8d9eb6d8 | 26 | int lttcomm_accept_unix_sock(int sock); |
8d9eb6d8 | 27 | int lttcomm_listen_unix_sock(int sock); |
8d9eb6d8 | 28 | int lttcomm_close_unix_sock(int sock); |
0d37f2bc DG |
29 | |
30 | /* Send a message accompanied by fd(s) over a unix socket. */ | |
ac2f30af | 31 | ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd); |
fe489250 JG |
32 | ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock, |
33 | struct lttng_payload_view *view); | |
b72ce630 JR |
34 | ssize_t lttcomm_send_fds_unix_sock_non_block( |
35 | int sock, const int *fds, size_t nb_fd); | |
fe489250 JG |
36 | ssize_t lttcomm_send_payload_view_fds_unix_sock_non_block(int sock, |
37 | struct lttng_payload_view *view); | |
38 | ||
0d37f2bc | 39 | /* Recv a message accompanied by fd(s) from a unix socket */ |
8d9eb6d8 | 40 | ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd); |
fe489250 JG |
41 | ssize_t lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd, |
42 | struct lttng_payload *payload); | |
b72ce630 | 43 | ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_fd); |
fe489250 JG |
44 | ssize_t lttcomm_recv_payload_fds_unix_sock_non_block(int sock, size_t nb_fd, |
45 | struct lttng_payload *payload); | |
0d37f2bc | 46 | |
8d9eb6d8 | 47 | ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len); |
c72435ad | 48 | ssize_t lttcomm_recv_unix_sock_non_block(int sock, void *buf, size_t len); |
c2d69327 | 49 | ssize_t lttcomm_send_unix_sock(int sock, const void *buf, size_t len); |
c72435ad | 50 | ssize_t lttcomm_send_unix_sock_non_block(int sock, const void *buf, size_t len); |
0d37f2bc | 51 | |
e368fb43 | 52 | ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len); |
8d9eb6d8 | 53 | ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, |
0d37f2bc DG |
54 | lttng_sock_cred *creds); |
55 | ||
8d9eb6d8 | 56 | int lttcomm_setsockopt_creds_unix_sock(int sock); |
0d37f2bc | 57 | |
7966af57 SM |
58 | #ifdef __cplusplus |
59 | } | |
60 | #endif | |
61 | ||
0d37f2bc | 62 | #endif /* _LTTCOMM_UNIX_H */ |