2 * The MIT License (MIT)
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 /* From plugin-const.h */
27 extern const bt_plugin *bt_plugin_find(const char *plugin_name);
29 extern const bt_plugin_set *bt_plugin_find_all_from_file(
32 extern const bt_plugin_set *bt_plugin_find_all_from_dir(
33 const char *path, bt_bool recurse);
35 extern const bt_plugin_set *bt_plugin_find_all_from_static(void);
37 extern const char *bt_plugin_get_name(const bt_plugin *plugin);
39 extern const char *bt_plugin_get_author(const bt_plugin *plugin);
41 extern const char *bt_plugin_get_license(const bt_plugin *plugin);
43 extern const char *bt_plugin_get_description(const bt_plugin *plugin);
45 extern const char *bt_plugin_get_path(const bt_plugin *plugin);
47 extern bt_property_availability bt_plugin_get_version(
48 const bt_plugin *plugin, unsigned int *OUT,
49 unsigned int *OUT, unsigned int *OUT, const char **OUT);
51 extern uint64_t bt_plugin_get_source_component_class_count(
52 const bt_plugin *plugin);
54 extern uint64_t bt_plugin_get_filter_component_class_count(
55 const bt_plugin *plugin);
57 extern uint64_t bt_plugin_get_sink_component_class_count(
58 const bt_plugin *plugin);
60 extern const bt_component_class_source *
61 bt_plugin_borrow_source_component_class_by_index_const(
62 const bt_plugin *plugin, uint64_t index);
64 extern const bt_component_class_filter *
65 bt_plugin_borrow_filter_component_class_by_index_const(
66 const bt_plugin *plugin, uint64_t index);
68 extern const bt_component_class_sink *
69 bt_plugin_borrow_sink_component_class_by_index_const(
70 const bt_plugin *plugin, uint64_t index);
72 extern const bt_component_class_source *
73 bt_plugin_borrow_source_component_class_by_name_const(
74 const bt_plugin *plugin, const char *name);
76 extern const bt_component_class_filter *
77 bt_plugin_borrow_filter_component_class_by_name_const(
78 const bt_plugin *plugin, const char *name);
80 extern const bt_component_class_sink *
81 bt_plugin_borrow_sink_component_class_by_name_const(
82 const bt_plugin *plugin, const char *name);
84 extern void bt_plugin_get_ref(const bt_plugin *plugin);
86 extern void bt_plugin_put_ref(const bt_plugin *plugin);
88 /* From plugin-set-const.h */
90 extern uint64_t bt_plugin_set_get_plugin_count(
91 const bt_plugin_set *plugin_set);
93 extern const bt_plugin *bt_plugin_set_borrow_plugin_by_index_const(
94 const bt_plugin_set *plugin_set, uint64_t index);
96 extern void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set);
98 extern void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set);
102 bt_property_availability bt_plugin_get_version_wrapper(
103 const bt_plugin *plugin, unsigned int *OUT,
104 unsigned int *OUT, unsigned int *OUT, const char **OUT);
109 * This wrapper ensures that when the API function fails, the `*extra` output
110 * parameter is set to NULL. This is necessary because the epilogue of the
111 * "char **OUT" typemap will use that value to make a Python str object. We
112 * can't rely on the initial value of `*extra`, it could point to unreadable
116 bt_property_availability bt_plugin_get_version_wrapper(
117 const bt_plugin *plugin, unsigned int *major,
118 unsigned int *minor, unsigned int *patch, const char **extra)
120 bt_property_availability ret;
122 ret = bt_plugin_get_version(plugin, major, minor, patch, extra);
124 if (ret == BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE) {