Commit | Line | Data |
---|---|---|
3a2cb327 PP |
1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_CONST_H |
2 | #define BABELTRACE_PLUGIN_PLUGIN_CONST_H | |
90354d3a JG |
3 | |
4 | /* | |
f2b0325d | 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> |
e0831b38 | 31 | |
8eee8ea2 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 | */ | |
71c5da58 | 37 | #include <babeltrace2/types.h> |
33b34c43 | 38 | |
ee78f405 | 39 | /* For bt_property_availability */ |
71c5da58 | 40 | #include <babeltrace2/property.h> |
834e9996 | 41 | |
38b48196 JG |
42 | #ifdef __cplusplus |
43 | extern "C" { | |
44 | #endif | |
633edee0 | 45 | |
01f50d54 PP |
46 | typedef enum bt_plugin_status { |
47 | BT_PLUGIN_STATUS_OK = 0, | |
48 | BT_PLUGIN_STATUS_NOT_FOUND = 2, | |
49 | BT_PLUGIN_STATUS_ERROR = -1, | |
50 | BT_PLUGIN_STATUS_LOADING_ERROR = -2, | |
51 | BT_PLUGIN_STATUS_NOMEM = -12, | |
52 | } bt_plugin_status; | |
2b43acf9 | 53 | |
01f50d54 PP |
54 | extern bt_plugin_status bt_plugin_find(const char *plugin_name, |
55 | bt_bool fail_on_load_error, const bt_plugin **plugin); | |
33b34c43 | 56 | |
01f50d54 PP |
57 | extern bt_plugin_status bt_plugin_find_all_from_file( |
58 | const char *path, bt_bool fail_on_load_error, | |
59 | const bt_plugin_set **plugin_set); | |
33b34c43 | 60 | |
01f50d54 PP |
61 | extern bt_plugin_status bt_plugin_find_all_from_dir( |
62 | const char *path, bt_bool recurse, bt_bool fail_on_load_error, | |
63 | const bt_plugin_set **plugin_set); | |
64 | ||
65 | extern bt_plugin_status bt_plugin_find_all_from_static( | |
66 | bt_bool fail_on_load_error, | |
67 | const bt_plugin_set **plugin_set); | |
73299554 | 68 | |
8eee8ea2 | 69 | extern const char *bt_plugin_get_name(const bt_plugin *plugin); |
633edee0 | 70 | |
8eee8ea2 | 71 | extern const char *bt_plugin_get_author(const bt_plugin *plugin); |
633edee0 | 72 | |
8eee8ea2 | 73 | extern const char *bt_plugin_get_license(const bt_plugin *plugin); |
633edee0 | 74 | |
8eee8ea2 | 75 | extern const char *bt_plugin_get_description(const bt_plugin *plugin); |
f3bc2010 | 76 | |
8eee8ea2 | 77 | extern const char *bt_plugin_get_path(const bt_plugin *plugin); |
7c7c0433 | 78 | |
ee78f405 | 79 | extern bt_property_availability bt_plugin_get_version( |
8eee8ea2 | 80 | const bt_plugin *plugin, unsigned int *major, |
834e9996 PP |
81 | unsigned int *minor, unsigned int *patch, const char **extra); |
82 | ||
83 | extern uint64_t bt_plugin_get_source_component_class_count( | |
8eee8ea2 | 84 | const bt_plugin *plugin); |
834e9996 PP |
85 | |
86 | extern uint64_t bt_plugin_get_filter_component_class_count( | |
8eee8ea2 | 87 | const bt_plugin *plugin); |
b6de043b | 88 | |
834e9996 | 89 | extern uint64_t bt_plugin_get_sink_component_class_count( |
8eee8ea2 | 90 | const bt_plugin *plugin); |
33b34c43 | 91 | |
8eee8ea2 | 92 | extern const bt_component_class_source * |
3eff3102 | 93 | bt_plugin_borrow_source_component_class_by_index_const( |
8eee8ea2 | 94 | const bt_plugin *plugin, uint64_t index); |
33b34c43 | 95 | |
8eee8ea2 | 96 | extern const bt_component_class_filter * |
3a2cb327 | 97 | bt_plugin_borrow_filter_component_class_by_index_const( |
8eee8ea2 | 98 | const bt_plugin *plugin, uint64_t index); |
834e9996 | 99 | |
8eee8ea2 | 100 | extern const bt_component_class_sink * |
3a2cb327 | 101 | bt_plugin_borrow_sink_component_class_by_index_const( |
8eee8ea2 | 102 | const bt_plugin *plugin, uint64_t index); |
834e9996 | 103 | |
8eee8ea2 | 104 | extern const bt_component_class_source * |
7b53201c | 105 | bt_plugin_borrow_source_component_class_by_name_const( |
8eee8ea2 | 106 | const bt_plugin *plugin, const char *name); |
834e9996 | 107 | |
8eee8ea2 | 108 | extern const bt_component_class_filter * |
7b53201c | 109 | bt_plugin_borrow_filter_component_class_by_name_const( |
8eee8ea2 | 110 | const bt_plugin *plugin, const char *name); |
834e9996 | 111 | |
8eee8ea2 | 112 | extern const bt_component_class_sink * |
7b53201c | 113 | bt_plugin_borrow_sink_component_class_by_name_const( |
8eee8ea2 | 114 | const bt_plugin *plugin, const char *name); |
33b34c43 | 115 | |
8eee8ea2 | 116 | extern void bt_plugin_get_ref(const bt_plugin *plugin); |
8c6884d9 | 117 | |
8eee8ea2 | 118 | extern void bt_plugin_put_ref(const bt_plugin *plugin); |
8c6884d9 PP |
119 | |
120 | #define BT_PLUGIN_PUT_REF_AND_RESET(_var) \ | |
121 | do { \ | |
122 | bt_plugin_put_ref(_var); \ | |
123 | (_var) = NULL; \ | |
124 | } while (0) | |
125 | ||
126 | #define BT_PLUGIN_MOVE_REF(_var_dst, _var_src) \ | |
127 | do { \ | |
128 | bt_plugin_put_ref(_var_dst); \ | |
129 | (_var_dst) = (_var_src); \ | |
130 | (_var_src) = NULL; \ | |
131 | } while (0) | |
132 | ||
38b48196 JG |
133 | #ifdef __cplusplus |
134 | } | |
135 | #endif | |
90354d3a | 136 | |
3a2cb327 | 137 | #endif /* BABELTRACE_PLUGIN_PLUGIN_CONST_H */ |