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