lib: force user to include `<babeltrace2/babeltrace.h>`
[babeltrace.git] / include / babeltrace2 / plugin / plugin-const.h
CommitLineData
924dc299
PP
1#ifndef BABELTRACE2_PLUGIN_PLUGIN_CONST_H
2#define BABELTRACE2_PLUGIN_PLUGIN_CONST_H
90354d3a
JG
3
4/*
e2f7325d 5 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
38b48196 6 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
90354d3a
JG
7 *
8 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * SOFTWARE.
27 */
28
4fa90f32
PP
29#ifndef __BT_IN_BABELTRACE_H
30# error "Please include <babeltrace2/babeltrace.h> instead."
31#endif
32
544d0515 33#include <stdint.h>
33b34c43 34#include <stddef.h>
9d408fca 35
b19ff26f
PP
36/*
37 * For bt_bool, bt_plugin, bt_plugin_set, bt_component_class,
38 * bt_component_class_source, bt_component_class_filter,
39 * bt_component_class_sink
40 */
3fadfbc0 41#include <babeltrace2/types.h>
33b34c43 42
4cdfc5e8 43/* For bt_property_availability */
3fadfbc0 44#include <babeltrace2/property.h>
d94d92ac 45
38b48196
JG
46#ifdef __cplusplus
47extern "C" {
48#endif
633edee0 49
d24d5663
PP
50typedef enum bt_plugin_find_status {
51 BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK,
52 BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
53 BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
54 BT_PLUGIN_FIND_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
55 BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
56} bt_plugin_find_status;
2b43acf9 57
d24d5663 58extern bt_plugin_find_status bt_plugin_find(const char *plugin_name,
9736d991 59 bt_bool fail_on_load_error, const bt_plugin **plugin);
33b34c43 60
d24d5663
PP
61typedef enum bt_plugin_find_all_from_file_status {
62 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK = __BT_FUNC_STATUS_OK,
63 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
64 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
65 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
66 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
67} bt_plugin_find_all_from_file_status;
68
69extern bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
9736d991
PP
70 const char *path, bt_bool fail_on_load_error,
71 const bt_plugin_set **plugin_set);
33b34c43 72
d24d5663
PP
73typedef enum bt_plugin_find_all_from_dir_status {
74 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK = __BT_FUNC_STATUS_OK,
75 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
76 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
77 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
78 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
79} bt_plugin_find_all_from_dir_status;
80
81extern bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
9736d991
PP
82 const char *path, bt_bool recurse, bt_bool fail_on_load_error,
83 const bt_plugin_set **plugin_set);
84
d24d5663
PP
85typedef enum bt_plugin_find_all_from_static_status {
86 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK = __BT_FUNC_STATUS_OK,
87 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
88 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
89 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
90 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
91} bt_plugin_find_all_from_static_status;
92
93extern bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
94 bt_bool fail_on_load_error, const bt_plugin_set **plugin_set);
73299554 95
b19ff26f 96extern const char *bt_plugin_get_name(const bt_plugin *plugin);
633edee0 97
b19ff26f 98extern const char *bt_plugin_get_author(const bt_plugin *plugin);
633edee0 99
b19ff26f 100extern const char *bt_plugin_get_license(const bt_plugin *plugin);
633edee0 101
b19ff26f 102extern const char *bt_plugin_get_description(const bt_plugin *plugin);
f3bc2010 103
b19ff26f 104extern const char *bt_plugin_get_path(const bt_plugin *plugin);
7c7c0433 105
4cdfc5e8 106extern bt_property_availability bt_plugin_get_version(
b19ff26f 107 const bt_plugin *plugin, unsigned int *major,
d94d92ac
PP
108 unsigned int *minor, unsigned int *patch, const char **extra);
109
110extern uint64_t bt_plugin_get_source_component_class_count(
b19ff26f 111 const bt_plugin *plugin);
d94d92ac
PP
112
113extern uint64_t bt_plugin_get_filter_component_class_count(
b19ff26f 114 const bt_plugin *plugin);
b6de043b 115
d94d92ac 116extern uint64_t bt_plugin_get_sink_component_class_count(
b19ff26f 117 const bt_plugin *plugin);
33b34c43 118
b19ff26f 119extern const bt_component_class_source *
3f79b5cf 120bt_plugin_borrow_source_component_class_by_index_const(
b19ff26f 121 const bt_plugin *plugin, uint64_t index);
33b34c43 122
b19ff26f 123extern const bt_component_class_filter *
92fed4e1 124bt_plugin_borrow_filter_component_class_by_index_const(
b19ff26f 125 const bt_plugin *plugin, uint64_t index);
d94d92ac 126
b19ff26f 127extern const bt_component_class_sink *
92fed4e1 128bt_plugin_borrow_sink_component_class_by_index_const(
b19ff26f 129 const bt_plugin *plugin, uint64_t index);
d94d92ac 130
b19ff26f 131extern const bt_component_class_source *
0d72b8c3 132bt_plugin_borrow_source_component_class_by_name_const(
b19ff26f 133 const bt_plugin *plugin, const char *name);
d94d92ac 134
b19ff26f 135extern const bt_component_class_filter *
0d72b8c3 136bt_plugin_borrow_filter_component_class_by_name_const(
b19ff26f 137 const bt_plugin *plugin, const char *name);
d94d92ac 138
b19ff26f 139extern const bt_component_class_sink *
0d72b8c3 140bt_plugin_borrow_sink_component_class_by_name_const(
b19ff26f 141 const bt_plugin *plugin, const char *name);
33b34c43 142
b19ff26f 143extern void bt_plugin_get_ref(const bt_plugin *plugin);
c5b9b441 144
b19ff26f 145extern void bt_plugin_put_ref(const bt_plugin *plugin);
c5b9b441
PP
146
147#define BT_PLUGIN_PUT_REF_AND_RESET(_var) \
148 do { \
149 bt_plugin_put_ref(_var); \
150 (_var) = NULL; \
151 } while (0)
152
153#define BT_PLUGIN_MOVE_REF(_var_dst, _var_src) \
154 do { \
155 bt_plugin_put_ref(_var_dst); \
156 (_var_dst) = (_var_src); \
157 (_var_src) = NULL; \
158 } while (0)
159
38b48196
JG
160#ifdef __cplusplus
161}
162#endif
90354d3a 163
924dc299 164#endif /* BABELTRACE2_PLUGIN_PLUGIN_CONST_H */
This page took 0.054075 seconds and 4 git commands to generate.