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