| 1 | /* |
| 2 | * Copyright (C) 2013 - Jérémie Galarneau <jeremie.galarneau@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_SAVE_H |
| 19 | #define LTTNG_SAVE_H |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | /* |
| 26 | * The lttng_save_session_attr object is opaque to the user. Use the helper |
| 27 | * functions below to use them. |
| 28 | */ |
| 29 | struct lttng_save_session_attr; |
| 30 | |
| 31 | /* |
| 32 | * Return a newly allocated save session attribute object or NULL on error. |
| 33 | */ |
| 34 | struct lttng_save_session_attr *lttng_save_session_attr_create(void); |
| 35 | |
| 36 | /* |
| 37 | * Free a given save session attribute object. |
| 38 | */ |
| 39 | void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output); |
| 40 | |
| 41 | |
| 42 | /* |
| 43 | * Save session attribute getter family functions. |
| 44 | */ |
| 45 | |
| 46 | /* Return session name. NULL indicated all sessions must be saved. */ |
| 47 | const char *lttng_save_session_attr_get_session_name( |
| 48 | struct lttng_save_session_attr *attr); |
| 49 | /* |
| 50 | * Return destination URL. A NULL value indicates the default session |
| 51 | * configuration location. The URL format used is documented in lttng(1). |
| 52 | * NULL indicates that the default session configuration path is used. |
| 53 | */ |
| 54 | const char *lttng_save_session_attr_get_output_url( |
| 55 | struct lttng_save_session_attr *attr); |
| 56 | /* |
| 57 | * Return the configuration overwrite attribute. This attribute indicates |
| 58 | * whether or not existing configuration files must be overwritten. |
| 59 | */ |
| 60 | int lttng_save_session_attr_get_overwrite( |
| 61 | struct lttng_save_session_attr *attr); |
| 62 | |
| 63 | /* |
| 64 | * Save session attribute setter family functions. |
| 65 | * |
| 66 | * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is |
| 67 | * returned indicating that at least one given parameter is invalid. |
| 68 | */ |
| 69 | |
| 70 | /* |
| 71 | * Set the name of the session to save. A NULL name means all sessions |
| 72 | * known to the session daemon will be saved. |
| 73 | */ |
| 74 | int lttng_save_session_attr_set_session_name( |
| 75 | struct lttng_save_session_attr *attr, const char *session_name); |
| 76 | /* |
| 77 | * Set the URL of the session configuration to save. A NULL value indicates the |
| 78 | * use of the default location being the session one. The URL's format is is |
| 79 | * documented in lttng(1). |
| 80 | */ |
| 81 | int lttng_save_session_attr_set_output_url( |
| 82 | struct lttng_save_session_attr *attr, const char *url); |
| 83 | /* |
| 84 | * Set the overwrite attribute. If set to true, files of the same name as the |
| 85 | * current session configuration URL will be overwritten. |
| 86 | */ |
| 87 | int lttng_save_session_attr_set_overwrite( |
| 88 | struct lttng_save_session_attr *attr, int overwrite); |
| 89 | |
| 90 | /* |
| 91 | * Save session configuration(s). |
| 92 | * |
| 93 | * The lttng_save_session_attr object must not be NULL. No ownership of the |
| 94 | * object is kept by the function; it must be released by the caller. |
| 95 | * |
| 96 | * Returns 0 on success or a negative LTTNG_ERR value on error. |
| 97 | */ |
| 98 | int lttng_save_session(struct lttng_save_session_attr *attr); |
| 99 | |
| 100 | #ifdef __cplusplus |
| 101 | } |
| 102 | #endif |
| 103 | |
| 104 | #endif /* LTTNG_SAVE_H */ |