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