Commit | Line | Data |
---|---|---|
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 | |
3fadfbc0 | 36 | #include <babeltrace2/types.h> |
3fadfbc0 | 37 | #include <babeltrace2/property.h> |
d94d92ac | 38 | |
38b48196 JG |
39 | #ifdef __cplusplus |
40 | extern "C" { | |
41 | #endif | |
633edee0 | 42 | |
d24d5663 PP |
43 | typedef enum bt_plugin_find_status { |
44 | BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK, | |
45 | BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND, | |
46 | BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
47 | BT_PLUGIN_FIND_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR, | |
48 | BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
49 | } bt_plugin_find_status; | |
2b43acf9 | 50 | |
d24d5663 | 51 | extern bt_plugin_find_status bt_plugin_find(const char *plugin_name, |
9736d991 | 52 | bt_bool fail_on_load_error, const bt_plugin **plugin); |
33b34c43 | 53 | |
d24d5663 PP |
54 | typedef enum bt_plugin_find_all_from_file_status { |
55 | BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK = __BT_FUNC_STATUS_OK, | |
56 | BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND, | |
57 | BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
58 | BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR, | |
59 | BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
60 | } bt_plugin_find_all_from_file_status; | |
61 | ||
62 | extern bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file( | |
9736d991 PP |
63 | const char *path, bt_bool fail_on_load_error, |
64 | const bt_plugin_set **plugin_set); | |
33b34c43 | 65 | |
d24d5663 PP |
66 | typedef enum bt_plugin_find_all_from_dir_status { |
67 | BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK = __BT_FUNC_STATUS_OK, | |
68 | BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND, | |
69 | BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
70 | BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR, | |
71 | BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
72 | } bt_plugin_find_all_from_dir_status; | |
73 | ||
74 | extern bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir( | |
9736d991 PP |
75 | const char *path, bt_bool recurse, bt_bool fail_on_load_error, |
76 | const bt_plugin_set **plugin_set); | |
77 | ||
d24d5663 PP |
78 | typedef enum bt_plugin_find_all_from_static_status { |
79 | BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK = __BT_FUNC_STATUS_OK, | |
80 | BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND, | |
81 | BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
82 | BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR, | |
83 | BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
84 | } bt_plugin_find_all_from_static_status; | |
85 | ||
86 | extern bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static( | |
87 | bt_bool fail_on_load_error, const bt_plugin_set **plugin_set); | |
73299554 | 88 | |
b19ff26f | 89 | extern const char *bt_plugin_get_name(const bt_plugin *plugin); |
633edee0 | 90 | |
b19ff26f | 91 | extern const char *bt_plugin_get_author(const bt_plugin *plugin); |
633edee0 | 92 | |
b19ff26f | 93 | extern const char *bt_plugin_get_license(const bt_plugin *plugin); |
633edee0 | 94 | |
b19ff26f | 95 | extern const char *bt_plugin_get_description(const bt_plugin *plugin); |
f3bc2010 | 96 | |
b19ff26f | 97 | extern const char *bt_plugin_get_path(const bt_plugin *plugin); |
7c7c0433 | 98 | |
4cdfc5e8 | 99 | extern bt_property_availability bt_plugin_get_version( |
b19ff26f | 100 | const bt_plugin *plugin, unsigned int *major, |
d94d92ac PP |
101 | unsigned int *minor, unsigned int *patch, const char **extra); |
102 | ||
103 | extern uint64_t bt_plugin_get_source_component_class_count( | |
b19ff26f | 104 | const bt_plugin *plugin); |
d94d92ac PP |
105 | |
106 | extern uint64_t bt_plugin_get_filter_component_class_count( | |
b19ff26f | 107 | const bt_plugin *plugin); |
b6de043b | 108 | |
d94d92ac | 109 | extern uint64_t bt_plugin_get_sink_component_class_count( |
b19ff26f | 110 | const bt_plugin *plugin); |
33b34c43 | 111 | |
b19ff26f | 112 | extern const bt_component_class_source * |
3f79b5cf | 113 | bt_plugin_borrow_source_component_class_by_index_const( |
b19ff26f | 114 | const bt_plugin *plugin, uint64_t index); |
33b34c43 | 115 | |
b19ff26f | 116 | extern const bt_component_class_filter * |
92fed4e1 | 117 | bt_plugin_borrow_filter_component_class_by_index_const( |
b19ff26f | 118 | const bt_plugin *plugin, uint64_t index); |
d94d92ac | 119 | |
b19ff26f | 120 | extern const bt_component_class_sink * |
92fed4e1 | 121 | bt_plugin_borrow_sink_component_class_by_index_const( |
b19ff26f | 122 | const bt_plugin *plugin, uint64_t index); |
d94d92ac | 123 | |
b19ff26f | 124 | extern const bt_component_class_source * |
0d72b8c3 | 125 | bt_plugin_borrow_source_component_class_by_name_const( |
b19ff26f | 126 | const bt_plugin *plugin, const char *name); |
d94d92ac | 127 | |
b19ff26f | 128 | extern const bt_component_class_filter * |
0d72b8c3 | 129 | bt_plugin_borrow_filter_component_class_by_name_const( |
b19ff26f | 130 | const bt_plugin *plugin, const char *name); |
d94d92ac | 131 | |
b19ff26f | 132 | extern const bt_component_class_sink * |
0d72b8c3 | 133 | bt_plugin_borrow_sink_component_class_by_name_const( |
b19ff26f | 134 | const bt_plugin *plugin, const char *name); |
33b34c43 | 135 | |
b19ff26f | 136 | extern void bt_plugin_get_ref(const bt_plugin *plugin); |
c5b9b441 | 137 | |
b19ff26f | 138 | extern void bt_plugin_put_ref(const bt_plugin *plugin); |
c5b9b441 PP |
139 | |
140 | #define BT_PLUGIN_PUT_REF_AND_RESET(_var) \ | |
141 | do { \ | |
142 | bt_plugin_put_ref(_var); \ | |
143 | (_var) = NULL; \ | |
144 | } while (0) | |
145 | ||
146 | #define BT_PLUGIN_MOVE_REF(_var_dst, _var_src) \ | |
147 | do { \ | |
148 | bt_plugin_put_ref(_var_dst); \ | |
149 | (_var_dst) = (_var_src); \ | |
150 | (_var_src) = NULL; \ | |
151 | } while (0) | |
152 | ||
38b48196 JG |
153 | #ifdef __cplusplus |
154 | } | |
155 | #endif | |
90354d3a | 156 | |
924dc299 | 157 | #endif /* BABELTRACE2_PLUGIN_PLUGIN_CONST_H */ |