| 1 | /* |
| 2 | * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License, version 2 only, as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along with |
| 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 |
| 15 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _LTTCOMM_UNIX_H |
| 19 | #define _LTTCOMM_UNIX_H |
| 20 | |
| 21 | #include <limits.h> |
| 22 | #include <sys/un.h> |
| 23 | |
| 24 | #include <common/compat/socket.h> |
| 25 | #include <common/macros.h> |
| 26 | |
| 27 | #include "sessiond-comm.h" |
| 28 | |
| 29 | LTTNG_HIDDEN |
| 30 | int lttcomm_create_unix_sock(const char *pathname); |
| 31 | LTTNG_HIDDEN |
| 32 | int lttcomm_create_anon_unix_socketpair(int *fds); |
| 33 | LTTNG_HIDDEN |
| 34 | int lttcomm_connect_unix_sock(const char *pathname); |
| 35 | LTTNG_HIDDEN |
| 36 | int lttcomm_accept_unix_sock(int sock); |
| 37 | LTTNG_HIDDEN |
| 38 | int lttcomm_listen_unix_sock(int sock); |
| 39 | LTTNG_HIDDEN |
| 40 | int lttcomm_close_unix_sock(int sock); |
| 41 | |
| 42 | /* Send a message accompanied by fd(s) over a unix socket. */ |
| 43 | LTTNG_HIDDEN |
| 44 | ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd); |
| 45 | /* Recv a message accompanied by fd(s) from a unix socket */ |
| 46 | LTTNG_HIDDEN |
| 47 | ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd); |
| 48 | |
| 49 | LTTNG_HIDDEN |
| 50 | ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len); |
| 51 | LTTNG_HIDDEN |
| 52 | ssize_t lttcomm_send_unix_sock(int sock, const void *buf, size_t len); |
| 53 | |
| 54 | LTTNG_HIDDEN |
| 55 | ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len); |
| 56 | LTTNG_HIDDEN |
| 57 | ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, |
| 58 | lttng_sock_cred *creds); |
| 59 | |
| 60 | LTTNG_HIDDEN |
| 61 | int lttcomm_setsockopt_creds_unix_sock(int sock); |
| 62 | |
| 63 | #endif /* _LTTCOMM_UNIX_H */ |