Commit | Line | Data |
---|---|---|
6945df9a SM |
1 | /* |
2 | * The MIT License (MIT) | |
3 | * | |
4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> | |
5 | * | |
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: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | |
15 | * | |
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 | |
22 | * THE SOFTWARE. | |
23 | */ | |
24 | ||
25 | /* From plugin-const.h */ | |
26 | ||
27 | extern const bt_plugin *bt_plugin_find(const char *plugin_name); | |
28 | ||
29 | extern const bt_plugin_set *bt_plugin_find_all_from_file( | |
30 | const char *path); | |
31 | ||
32 | extern const bt_plugin_set *bt_plugin_find_all_from_dir( | |
33 | const char *path, bt_bool recurse); | |
34 | ||
35 | extern const bt_plugin_set *bt_plugin_find_all_from_static(void); | |
36 | ||
37 | extern const char *bt_plugin_get_name(const bt_plugin *plugin); | |
38 | ||
39 | extern const char *bt_plugin_get_author(const bt_plugin *plugin); | |
40 | ||
41 | extern const char *bt_plugin_get_license(const bt_plugin *plugin); | |
42 | ||
43 | extern const char *bt_plugin_get_description(const bt_plugin *plugin); | |
44 | ||
45 | extern const char *bt_plugin_get_path(const bt_plugin *plugin); | |
46 | ||
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); | |
50 | ||
51 | extern uint64_t bt_plugin_get_source_component_class_count( | |
52 | const bt_plugin *plugin); | |
53 | ||
54 | extern uint64_t bt_plugin_get_filter_component_class_count( | |
55 | const bt_plugin *plugin); | |
56 | ||
57 | extern uint64_t bt_plugin_get_sink_component_class_count( | |
58 | const bt_plugin *plugin); | |
59 | ||
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); | |
63 | ||
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); | |
67 | ||
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); | |
71 | ||
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); | |
75 | ||
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); | |
79 | ||
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); | |
83 | ||
84 | extern void bt_plugin_get_ref(const bt_plugin *plugin); | |
85 | ||
86 | extern void bt_plugin_put_ref(const bt_plugin *plugin); | |
87 | ||
88 | /* From plugin-set-const.h */ | |
89 | ||
90 | extern uint64_t bt_plugin_set_get_plugin_count( | |
91 | const bt_plugin_set *plugin_set); | |
92 | ||
93 | extern const bt_plugin *bt_plugin_set_borrow_plugin_by_index_const( | |
94 | const bt_plugin_set *plugin_set, uint64_t index); | |
95 | ||
96 | extern void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set); | |
97 | ||
98 | extern void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set); | |
fdfb7f17 SM |
99 | |
100 | /* Helpers */ | |
101 | ||
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); | |
105 | ||
106 | %{ | |
107 | ||
108 | /* | |
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 | |
113 | * memory. | |
114 | */ | |
115 | ||
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) | |
119 | { | |
120 | bt_property_availability ret; | |
121 | ||
122 | ret = bt_plugin_get_version(plugin, major, minor, patch, extra); | |
123 | ||
124 | if (ret == BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE) { | |
125 | *extra = NULL; | |
126 | } | |
127 | ||
128 | return ret; | |
129 | } | |
130 | ||
131 | %} |