Commit | Line | Data |
---|---|---|
9245bd0e DG |
1 | /* |
2 | * Copyright (C) 2014 - Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
3 | * David Goulet <dgoulet@efficios.com> | |
4 | * | |
5 | * This library is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License, version 2.1 only, | |
7 | * as published by the Free Software Foundation. | |
8 | * | |
9 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
12 | * for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU Lesser General Public License | |
15 | * along with this library; if not, write to the Free Software Foundation, | |
16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | ||
19 | #ifndef LTTNG_LOAD_H | |
20 | #define LTTNG_LOAD_H | |
21 | ||
22 | #ifdef __cplusplus | |
23 | extern "C" { | |
24 | #endif | |
25 | ||
26 | /* | |
27 | * The lttng_load_session_attr object is opaque to the user. Use the helper | |
28 | * functions below to use them. | |
29 | */ | |
30 | struct lttng_load_session_attr; | |
31 | ||
32 | /* | |
33 | * Return a newly allocated load session attribute object or NULL on error. | |
34 | */ | |
35 | struct lttng_load_session_attr *lttng_load_session_attr_create(void); | |
36 | ||
37 | /* | |
38 | * Free a given load session attribute object. | |
39 | */ | |
40 | void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); | |
41 | ||
42 | ||
43 | /* | |
44 | * Save session attribute getter family functions. | |
45 | */ | |
46 | ||
47 | /* Return session name. NULL indicated all sessions must be loadd. */ | |
48 | const char *lttng_load_session_attr_get_session_name( | |
49 | struct lttng_load_session_attr *attr); | |
50 | /* | |
51 | * Return destination URL. A NULL value indicates the default session | |
52 | * configuration location. The URL format used is documented in lttng(1). | |
53 | * NULL indicates that the default session configuration path is used. | |
54 | */ | |
55 | const char *lttng_load_session_attr_get_input_url( | |
56 | struct lttng_load_session_attr *attr); | |
57 | ||
58 | /* | |
59 | * Return the configuration overwrite attribute. This attribute indicates | |
60 | * whether or not existing configuration files must be overwritten. | |
61 | */ | |
62 | int lttng_load_session_attr_get_overwrite( | |
63 | struct lttng_load_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 load. A NULL name means all sessions | |
74 | * known to the session daemon will be loadd. | |
75 | */ | |
76 | int lttng_load_session_attr_set_session_name( | |
77 | struct lttng_load_session_attr *attr, const char *session_name); | |
78 | ||
79 | /* | |
80 | * Set the URL of the session configuration to load. A NULL value indicates the | |
81 | * use of the default location being the session one. | |
82 | * | |
83 | * Note that file:// is the only supported URL format. | |
84 | */ | |
85 | int lttng_load_session_attr_set_input_url( | |
86 | struct lttng_load_session_attr *attr, const char *url); | |
87 | ||
88 | /* | |
89 | * Set the overwrite attribute. If set to true, files of the same name as the | |
90 | * current session configuration URL will be overwritten. | |
91 | */ | |
92 | int lttng_load_session_attr_set_overwrite( | |
93 | struct lttng_load_session_attr *attr, int overwrite); | |
94 | ||
95 | /* | |
96 | * Save session configuration(s). | |
97 | * | |
98 | * The lttng_load_session_attr object must not be NULL. No ownership of the | |
99 | * object is kept by the function; it must be released by the caller. | |
100 | * | |
101 | * Returns 0 on success or a negative LTTNG_ERR value on error. | |
102 | */ | |
103 | int lttng_load_session(struct lttng_load_session_attr *attr); | |
104 | ||
105 | #ifdef __cplusplus | |
106 | } | |
107 | #endif | |
108 | ||
109 | #endif /* LTTNG_LOAD_H */ |