| 1 | /* |
| 2 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU Lesser General Public License, version 2.1 only, |
| 6 | * as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This library 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 Lesser General Public License |
| 11 | * for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this library; if not, write to the Free Software Foundation, |
| 15 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ |
| 17 | |
| 18 | #ifndef LTTNG_CTL_HELPER_H |
| 19 | #define LTTNG_CTL_HELPER_H |
| 20 | |
| 21 | #define _GNU_SOURCE |
| 22 | #include <stdio.h> |
| 23 | |
| 24 | #include <common/sessiond-comm/sessiond-comm.h> |
| 25 | #include <lttng/lttng.h> |
| 26 | |
| 27 | /* |
| 28 | * NOTE: Every symbol in this helper header MUST be set to hidden so not to |
| 29 | * polute the library name space. Use LTTNG_HIDDEN macro before declaring the |
| 30 | * function in the C file. |
| 31 | */ |
| 32 | |
| 33 | /* Copy helper functions. */ |
| 34 | void lttng_ctl_copy_string(char *dst, const char *src, size_t len); |
| 35 | void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst, |
| 36 | struct lttng_domain *src); |
| 37 | |
| 38 | /* |
| 39 | * Sends the lttcomm message to the session daemon and fills buf of the |
| 40 | * returned data is not NULL. |
| 41 | * |
| 42 | * Return the size of the received data on success or else a negative lttng |
| 43 | * error code. If buf is NULL, 0 is returned on success. |
| 44 | */ |
| 45 | int lttng_ctl_ask_sessiond_varlen(struct lttcomm_session_msg *lsm, |
| 46 | void *vardata, size_t varlen, void **buf); |
| 47 | |
| 48 | /* |
| 49 | * Use this if no variable length data needs to be sent. |
| 50 | */ |
| 51 | static inline |
| 52 | int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf) |
| 53 | { |
| 54 | return lttng_ctl_ask_sessiond_varlen(lsm, NULL, 0, buf); |
| 55 | } |
| 56 | |
| 57 | int lttng_check_tracing_group(void); |
| 58 | |
| 59 | #endif /* LTTNG_CTL_HELPER_H */ |