Babeltrace 2 C API  2.0.4
Open-source trace manipulation framework
plugin-loading.h
1 #ifndef BABELTRACE2_PLUGIN_PLUGIN_LOADING_H
2 #define BABELTRACE2_PLUGIN_PLUGIN_LOADING_H
3 
4 /*
5  * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
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 
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
28 #endif
29 
30 #include <stdint.h>
31 #include <stddef.h>
32 
33 #include <babeltrace2/types.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
273 typedef enum bt_plugin_find_status {
278  BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK,
279 
284  BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
285 
290  BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
291 
296  BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
298 
392 extern bt_plugin_find_status bt_plugin_find(const char *plugin_name,
393  bt_bool find_in_std_env_var, bt_bool find_in_user_dir,
394  bt_bool find_in_sys_dir, bt_bool find_in_static,
395  bt_bool fail_on_load_error, const bt_plugin **plugin);
396 
406  BT_PLUGIN_FIND_ALL_STATUS_OK = __BT_FUNC_STATUS_OK,
407 
412  BT_PLUGIN_FIND_ALL_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
413 
418  BT_PLUGIN_FIND_ALL_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
419 
424  BT_PLUGIN_FIND_ALL_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
426 
517  bt_bool find_in_user_dir, bt_bool find_in_sys_dir,
518  bt_bool find_in_static, bt_bool fail_on_load_error,
519  const bt_plugin_set **plugins);
520 
531 
536  BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
537 
542  BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
543 
550 
605  const char *path, bt_bool fail_on_load_error,
606  const bt_plugin_set **plugins);
607 
618 
623  BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
624 
629  BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
630 
637 
700  const char *path, bt_bool recurse, bt_bool fail_on_load_error,
701  const bt_plugin_set **plugins);
702 
713 
719 
724  BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
725 
732 
777  bt_bool fail_on_load_error, const bt_plugin_set **plugins);
778 
804 extern const char *bt_plugin_get_name(const bt_plugin *plugin);
805 
824 extern const char *bt_plugin_get_description(const bt_plugin *plugin);
825 
844 extern const char *bt_plugin_get_author(const bt_plugin *plugin);
845 
865 extern const char *bt_plugin_get_license(const bt_plugin *plugin);
866 
890 extern const char *bt_plugin_get_path(const bt_plugin *plugin);
891 
932  const bt_plugin *plugin, unsigned int *major,
933  unsigned int *minor, unsigned int *patch, const char **extra);
934 
957  const bt_plugin *plugin);
958 
974  const bt_plugin *plugin);
975 
991  const bt_plugin *plugin);
992 
1021 extern const bt_component_class_source *
1023  const bt_plugin *plugin, uint64_t index);
1024 
1053 extern const bt_component_class_filter *
1055  const bt_plugin *plugin, uint64_t index);
1056 
1085 extern const bt_component_class_sink *
1087  const bt_plugin *plugin, uint64_t index);
1088 
1118 extern const bt_component_class_source *
1120  const bt_plugin *plugin, const char *name);
1121 
1151 extern const bt_component_class_filter *
1153  const bt_plugin *plugin, const char *name);
1154 
1184 extern const bt_component_class_sink *
1186  const bt_plugin *plugin, const char *name);
1187 
1210 extern void bt_plugin_get_ref(const bt_plugin *plugin);
1211 
1227 extern void bt_plugin_put_ref(const bt_plugin *plugin);
1228 
1243 #define BT_PLUGIN_PUT_REF_AND_RESET(_plugin) \
1244  do { \
1245  bt_plugin_put_ref(_plugin); \
1246  (_plugin) = NULL; \
1247  } while (0)
1248 
1274 #define BT_PLUGIN_MOVE_REF(_dst, _src) \
1275  do { \
1276  bt_plugin_put_ref(_dst); \
1277  (_dst) = (_src); \
1278  (_src) = NULL; \
1279  } while (0)
1280 
1301 extern uint64_t bt_plugin_set_get_plugin_count(
1302  const bt_plugin_set *plugin_set);
1303 
1329  const bt_plugin_set *plugin_set, uint64_t index);
1330 
1353 extern void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set);
1354 
1370 extern void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set);
1371 
1386 #define BT_PLUGIN_SET_PUT_REF_AND_RESET(_plugin_set) \
1387  do { \
1388  bt_plugin_set_put_ref(_plugin_set); \
1389  (_plugin_set) = NULL; \
1390  } while (0)
1391 
1417 #define BT_PLUGIN_SET_MOVE_REF(_dst, _src) \
1418  do { \
1419  bt_plugin_set_put_ref(_dst); \
1420  (_dst) = (_src); \
1421  (_src) = NULL; \
1422  } while (0)
1423 
1428 #ifdef __cplusplus
1429 }
1430 #endif
1431 
1432 #endif /* BABELTRACE2_PLUGIN_PLUGIN_LOADING_H */
Out of memory.
Definition: plugin-loading.h:542
bt_plugin_find_all_status
Status codes for bt_plugin_find_all().
Definition: plugin-loading.h:401
uint64_t bt_plugin_get_filter_component_class_count(const bt_plugin *plugin)
Returns the number of filter component classes contained in the plugin plugin.
No plugins found.
Definition: plugin-loading.h:623
struct bt_component_class_source bt_component_class_source
Source component class.
Definition: types.h:42
bt_plugin_find_status bt_plugin_find(const char *plugin_name, bt_bool find_in_std_env_var, bt_bool find_in_user_dir, bt_bool find_in_sys_dir, bt_bool find_in_static, bt_bool fail_on_load_error, const bt_plugin **plugin)
Finds and loads a single plugin which has the name plugin_name from the default plugin search directo...
bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(const char *path, bt_bool recurse, bt_bool fail_on_load_error, const bt_plugin_set **plugins)
Finds and loads all the plugins from the directory with path path, setting *plugins to the result...
Error.
Definition: plugin-loading.h:548
struct bt_plugin_set bt_plugin_set
Set of plugins.
Definition: types.h:77
const char * bt_plugin_get_name(const bt_plugin *plugin)
Returns the name of the plugin plugin.
Success.
Definition: plugin-loading.h:530
No plugins found.
Definition: plugin-loading.h:412
struct bt_component_class_filter bt_component_class_filter
Filter component class.
Definition: types.h:40
Success.
Definition: plugin-loading.h:406
void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set)
Decrements the reference count of the plugin set plugin_set.
No static plugins found.
Definition: plugin-loading.h:718
Success.
Definition: plugin-loading.h:278
Error.
Definition: plugin-loading.h:635
Out of memory.
Definition: plugin-loading.h:629
bt_property_availability
Availability of an object's property.
Definition: types.h:173
Error.
Definition: plugin-loading.h:730
No plugins found.
Definition: plugin-loading.h:536
bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(const char *path, bt_bool fail_on_load_error, const bt_plugin_set **plugins)
Finds and loads all the plugins from the file with path path, setting *plugins to the result...
const bt_component_class_sink * bt_plugin_borrow_sink_component_class_by_name_const(const bt_plugin *plugin, const char *name)
Borrows the sink component class named name from the plugin plugin.
bt_plugin_find_all_from_dir_status
Status codes for bt_plugin_find_all_from_dir().
Definition: plugin-loading.h:612
const bt_component_class_filter * bt_plugin_borrow_filter_component_class_by_index_const(const bt_plugin *plugin, uint64_t index)
Borrows the filter component class at index index from the plugin plugin.
uint64_t bt_plugin_set_get_plugin_count(const bt_plugin_set *plugin_set)
Returns the number of plugins contained in the plugin set plugin_set.
Success.
Definition: plugin-loading.h:712
bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(bt_bool fail_on_load_error, const bt_plugin_set **plugins)
Finds and loads all the static plugins, setting *plugins to the result.
Out of memory.
Definition: plugin-loading.h:418
Plugin not found.
Definition: plugin-loading.h:284
Error.
Definition: plugin-loading.h:296
void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set)
Increments the reference count of the plugin set plugin_set.
Out of memory.
Definition: plugin-loading.h:290
uint64_t bt_plugin_get_sink_component_class_count(const bt_plugin *plugin)
Returns the number of sink component classes contained in the plugin plugin.
const bt_plugin * bt_plugin_set_borrow_plugin_by_index_const(const bt_plugin_set *plugin_set, uint64_t index)
Borrows the plugin at index index from the plugin set plugin_set.
struct bt_plugin bt_plugin
Plugin.
Definition: types.h:76
Out of memory.
Definition: plugin-loading.h:724
uint64_t bt_plugin_get_source_component_class_count(const bt_plugin *plugin)
Returns the number of source component classes contained in the plugin plugin.
struct bt_component_class_sink bt_component_class_sink
Sink component class.
Definition: types.h:41
int bt_bool
Babeltrace 2 boolean type.
Definition: types.h:140
const bt_component_class_sink * bt_plugin_borrow_sink_component_class_by_index_const(const bt_plugin *plugin, uint64_t index)
Borrows the sink component class at index index from the plugin plugin.
const char * bt_plugin_get_license(const bt_plugin *plugin)
Returns the license text or the license name of the plugin plugin.
const bt_component_class_source * bt_plugin_borrow_source_component_class_by_index_const(const bt_plugin *plugin, uint64_t index)
Borrows the source component class at index index from the plugin plugin.
const char * bt_plugin_get_path(const bt_plugin *plugin)
Returns the path of the file which contains the plugin plugin.
bt_property_availability bt_plugin_get_version(const bt_plugin *plugin, unsigned int *major, unsigned int *minor, unsigned int *patch, const char **extra)
Returns the version of the plugin plugin.
bt_plugin_find_all_from_static_status
Status codes for bt_plugin_find_all_from_static().
Definition: plugin-loading.h:707
Error.
Definition: plugin-loading.h:424
bt_plugin_find_status
Status codes for bt_plugin_find().
Definition: plugin-loading.h:273
const char * bt_plugin_get_author(const bt_plugin *plugin)
Returns the name(s) of the author(s) of the plugin plugin.
bt_plugin_find_all_status bt_plugin_find_all(bt_bool find_in_std_env_var, bt_bool find_in_user_dir, bt_bool find_in_sys_dir, bt_bool find_in_static, bt_bool fail_on_load_error, const bt_plugin_set **plugins)
Finds and loads all the plugins from the default plugin search directories and static plugins...
Success.
Definition: plugin-loading.h:617
const bt_component_class_source * bt_plugin_borrow_source_component_class_by_name_const(const bt_plugin *plugin, const char *name)
Borrows the source component class named name from the plugin plugin.
void bt_plugin_get_ref(const bt_plugin *plugin)
Increments the reference count of the plugin plugin.
void bt_plugin_put_ref(const bt_plugin *plugin)
Decrements the reference count of the plugin plugin.
bt_plugin_find_all_from_file_status
Status codes for bt_plugin_find_all_from_file().
Definition: plugin-loading.h:525
const bt_component_class_filter * bt_plugin_borrow_filter_component_class_by_name_const(const bt_plugin *plugin, const char *name)
Borrows the filter component class named name from the plugin plugin.
const char * bt_plugin_get_description(const bt_plugin *plugin)
Returns the description of the plugin plugin.