Commit | Line | Data |
---|---|---|
92fed4e1 PP |
1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_CONST_H |
2 | #define BABELTRACE_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 | ||
544d0515 | 29 | #include <stdint.h> |
33b34c43 | 30 | #include <stddef.h> |
9d408fca | 31 | |
b19ff26f PP |
32 | /* |
33 | * For bt_bool, bt_plugin, bt_plugin_set, bt_component_class, | |
34 | * bt_component_class_source, bt_component_class_filter, | |
35 | * bt_component_class_sink | |
36 | */ | |
c55a9f58 | 37 | #include <babeltrace/types.h> |
33b34c43 | 38 | |
9d408fca PP |
39 | /* For enum bt_component_class_type */ |
40 | #include <babeltrace/graph/component-class.h> | |
41 | ||
d94d92ac PP |
42 | /* For enum bt_component_class_source */ |
43 | #include <babeltrace/graph/component-class-source.h> | |
44 | ||
45 | /* For enum bt_component_class_filter */ | |
46 | #include <babeltrace/graph/component-class-filter.h> | |
47 | ||
48 | /* For enum bt_component_class_sink */ | |
49 | #include <babeltrace/graph/component-class-sink.h> | |
50 | ||
51 | /* For enum bt_property_availability */ | |
52 | #include <babeltrace/property.h> | |
53 | ||
38b48196 JG |
54 | #ifdef __cplusplus |
55 | extern "C" { | |
56 | #endif | |
633edee0 | 57 | |
33b34c43 | 58 | enum bt_plugin_status { |
33b34c43 | 59 | BT_PLUGIN_STATUS_OK = 0, |
33b34c43 | 60 | BT_PLUGIN_STATUS_ERROR = -1, |
d94d92ac | 61 | BT_PLUGIN_STATUS_NOMEM = -12, |
33b34c43 PP |
62 | }; |
63 | ||
b19ff26f | 64 | extern const bt_plugin *bt_plugin_find(const char *plugin_name); |
2b43acf9 | 65 | |
b19ff26f | 66 | extern const bt_plugin_set *bt_plugin_create_all_from_file( |
92fed4e1 | 67 | const char *path); |
33b34c43 | 68 | |
b19ff26f | 69 | extern const bt_plugin_set *bt_plugin_create_all_from_dir( |
92fed4e1 | 70 | const char *path, bt_bool recurse); |
33b34c43 | 71 | |
b19ff26f | 72 | extern const bt_plugin_set *bt_plugin_create_all_from_static(void); |
73299554 | 73 | |
b19ff26f | 74 | extern const char *bt_plugin_get_name(const bt_plugin *plugin); |
633edee0 | 75 | |
b19ff26f | 76 | extern const char *bt_plugin_get_author(const bt_plugin *plugin); |
633edee0 | 77 | |
b19ff26f | 78 | extern const char *bt_plugin_get_license(const bt_plugin *plugin); |
633edee0 | 79 | |
b19ff26f | 80 | extern const char *bt_plugin_get_description(const bt_plugin *plugin); |
f3bc2010 | 81 | |
b19ff26f | 82 | extern const char *bt_plugin_get_path(const bt_plugin *plugin); |
7c7c0433 | 83 | |
d94d92ac | 84 | extern enum bt_property_availability bt_plugin_get_version( |
b19ff26f | 85 | const bt_plugin *plugin, unsigned int *major, |
d94d92ac PP |
86 | unsigned int *minor, unsigned int *patch, const char **extra); |
87 | ||
88 | extern uint64_t bt_plugin_get_source_component_class_count( | |
b19ff26f | 89 | const bt_plugin *plugin); |
d94d92ac PP |
90 | |
91 | extern uint64_t bt_plugin_get_filter_component_class_count( | |
b19ff26f | 92 | const bt_plugin *plugin); |
b6de043b | 93 | |
d94d92ac | 94 | extern uint64_t bt_plugin_get_sink_component_class_count( |
b19ff26f | 95 | const bt_plugin *plugin); |
33b34c43 | 96 | |
b19ff26f | 97 | extern const bt_component_class_source * |
92fed4e1 | 98 | bt_plugin_borrow_source_component_class_by_index_const_const( |
b19ff26f | 99 | const bt_plugin *plugin, uint64_t index); |
33b34c43 | 100 | |
b19ff26f | 101 | extern const bt_component_class_filter * |
92fed4e1 | 102 | bt_plugin_borrow_filter_component_class_by_index_const( |
b19ff26f | 103 | const bt_plugin *plugin, uint64_t index); |
d94d92ac | 104 | |
b19ff26f | 105 | extern const bt_component_class_sink * |
92fed4e1 | 106 | bt_plugin_borrow_sink_component_class_by_index_const( |
b19ff26f | 107 | const bt_plugin *plugin, uint64_t index); |
d94d92ac | 108 | |
b19ff26f | 109 | extern const bt_component_class_source * |
0d72b8c3 | 110 | bt_plugin_borrow_source_component_class_by_name_const( |
b19ff26f | 111 | const bt_plugin *plugin, const char *name); |
d94d92ac | 112 | |
b19ff26f | 113 | extern const bt_component_class_filter * |
0d72b8c3 | 114 | bt_plugin_borrow_filter_component_class_by_name_const( |
b19ff26f | 115 | const bt_plugin *plugin, const char *name); |
d94d92ac | 116 | |
b19ff26f | 117 | extern const bt_component_class_sink * |
0d72b8c3 | 118 | bt_plugin_borrow_sink_component_class_by_name_const( |
b19ff26f | 119 | const bt_plugin *plugin, const char *name); |
33b34c43 | 120 | |
b19ff26f | 121 | extern void bt_plugin_get_ref(const bt_plugin *plugin); |
c5b9b441 | 122 | |
b19ff26f | 123 | extern void bt_plugin_put_ref(const bt_plugin *plugin); |
c5b9b441 PP |
124 | |
125 | #define BT_PLUGIN_PUT_REF_AND_RESET(_var) \ | |
126 | do { \ | |
127 | bt_plugin_put_ref(_var); \ | |
128 | (_var) = NULL; \ | |
129 | } while (0) | |
130 | ||
131 | #define BT_PLUGIN_MOVE_REF(_var_dst, _var_src) \ | |
132 | do { \ | |
133 | bt_plugin_put_ref(_var_dst); \ | |
134 | (_var_dst) = (_var_src); \ | |
135 | (_var_src) = NULL; \ | |
136 | } while (0) | |
137 | ||
38b48196 JG |
138 | #ifdef __cplusplus |
139 | } | |
140 | #endif | |
90354d3a | 141 | |
92fed4e1 | 142 | #endif /* BABELTRACE_PLUGIN_PLUGIN_CONST_H */ |