Babeltrace 2 C API  2.1.1
Open-source trace manipulation framework
plugin-loading.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 #ifndef BABELTRACE2_PLUGIN_PLUGIN_LOADING_H
8 #define BABELTRACE2_PLUGIN_PLUGIN_LOADING_H
9 
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdint.h>
17 #include <stddef.h>
18 
19 #include <babeltrace2/types.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
258 typedef enum bt_plugin_find_status {
263  BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK,
264 
269  BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
270 
275  BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
276 
281  BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
283 
377 extern bt_plugin_find_status bt_plugin_find(const char *plugin_name,
378  bt_bool find_in_std_env_var, bt_bool find_in_user_dir,
379  bt_bool find_in_sys_dir, bt_bool find_in_static,
380  bt_bool fail_on_load_error, const bt_plugin **plugin)
381  __BT_NOEXCEPT;
382 
392  BT_PLUGIN_FIND_ALL_STATUS_OK = __BT_FUNC_STATUS_OK,
393 
398  BT_PLUGIN_FIND_ALL_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
399 
404  BT_PLUGIN_FIND_ALL_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
405 
410  BT_PLUGIN_FIND_ALL_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
412 
503  bt_bool find_in_user_dir, bt_bool find_in_sys_dir,
504  bt_bool find_in_static, bt_bool fail_on_load_error,
505  const bt_plugin_set **plugins) __BT_NOEXCEPT;
506 
517 
522  BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
523 
528  BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
529 
536 
591  const char *path, bt_bool fail_on_load_error,
592  const bt_plugin_set **plugins) __BT_NOEXCEPT;
593 
604 
609  BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
610 
615  BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
616 
623 
686  const char *path, bt_bool recurse, bt_bool fail_on_load_error,
687  const bt_plugin_set **plugins) __BT_NOEXCEPT;
688 
699 
705 
710  BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
711 
718 
763  bt_bool fail_on_load_error, const bt_plugin_set **plugins)
764  __BT_NOEXCEPT;
765 
791 extern const char *bt_plugin_get_name(const bt_plugin *plugin) __BT_NOEXCEPT;
792 
811 extern const char *bt_plugin_get_description(const bt_plugin *plugin)
812  __BT_NOEXCEPT;
813 
832 extern const char *bt_plugin_get_author(const bt_plugin *plugin) __BT_NOEXCEPT;
833 
853 extern const char *bt_plugin_get_license(const bt_plugin *plugin) __BT_NOEXCEPT;
854 
878 extern const char *bt_plugin_get_path(const bt_plugin *plugin) __BT_NOEXCEPT;
879 
920  const bt_plugin *plugin, unsigned int *major,
921  unsigned int *minor, unsigned int *patch, const char **extra)
922  __BT_NOEXCEPT;
923 
946  const bt_plugin *plugin) __BT_NOEXCEPT;
947 
963  const bt_plugin *plugin) __BT_NOEXCEPT;
964 
980  const bt_plugin *plugin) __BT_NOEXCEPT;
981 
1010 extern const bt_component_class_source *
1012  const bt_plugin *plugin, uint64_t index) __BT_NOEXCEPT;
1013 
1042 extern const bt_component_class_filter *
1044  const bt_plugin *plugin, uint64_t index) __BT_NOEXCEPT;
1045 
1074 extern const bt_component_class_sink *
1076  const bt_plugin *plugin, uint64_t index) __BT_NOEXCEPT;
1077 
1107 extern const bt_component_class_source *
1109  const bt_plugin *plugin, const char *name) __BT_NOEXCEPT;
1110 
1140 extern const bt_component_class_filter *
1142  const bt_plugin *plugin, const char *name) __BT_NOEXCEPT;
1143 
1173 extern const bt_component_class_sink *
1175  const bt_plugin *plugin, const char *name) __BT_NOEXCEPT;
1176 
1199 extern void bt_plugin_get_ref(const bt_plugin *plugin) __BT_NOEXCEPT;
1200 
1216 extern void bt_plugin_put_ref(const bt_plugin *plugin) __BT_NOEXCEPT;
1217 
1232 #define BT_PLUGIN_PUT_REF_AND_RESET(_plugin) \
1233  do { \
1234  bt_plugin_put_ref(_plugin); \
1235  (_plugin) = NULL; \
1236  } while (0)
1237 
1263 #define BT_PLUGIN_MOVE_REF(_dst, _src) \
1264  do { \
1265  bt_plugin_put_ref(_dst); \
1266  (_dst) = (_src); \
1267  (_src) = NULL; \
1268  } while (0)
1269 
1290 extern uint64_t bt_plugin_set_get_plugin_count(
1291  const bt_plugin_set *plugin_set) __BT_NOEXCEPT;
1292 
1318  const bt_plugin_set *plugin_set, uint64_t index) __BT_NOEXCEPT;
1319 
1342 extern void bt_plugin_set_get_ref(const bt_plugin_set *plugin_set)
1343  __BT_NOEXCEPT;
1344 
1360 extern void bt_plugin_set_put_ref(const bt_plugin_set *plugin_set)
1361  __BT_NOEXCEPT;
1362 
1377 #define BT_PLUGIN_SET_PUT_REF_AND_RESET(_plugin_set) \
1378  do { \
1379  bt_plugin_set_put_ref(_plugin_set); \
1380  (_plugin_set) = NULL; \
1381  } while (0)
1382 
1408 #define BT_PLUGIN_SET_MOVE_REF(_dst, _src) \
1409  do { \
1410  bt_plugin_set_put_ref(_dst); \
1411  (_dst) = (_src); \
1412  (_src) = NULL; \
1413  } while (0)
1414 
1419 #ifdef __cplusplus
1420 }
1421 #endif
1422 
1423 #endif /* BABELTRACE2_PLUGIN_PLUGIN_LOADING_H */
Out of memory.
Definition: plugin-loading.h:528
bt_plugin_find_all_status
Status codes for bt_plugin_find_all().
Definition: plugin-loading.h:387
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:609
struct bt_component_class_source bt_component_class_source
Source component class.
Definition: types.h:28
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:534
struct bt_plugin_set bt_plugin_set
Set of plugins.
Definition: types.h:64
const char * bt_plugin_get_name(const bt_plugin *plugin)
Returns the name of the plugin plugin.
Success.
Definition: plugin-loading.h:516
No plugins found.
Definition: plugin-loading.h:398
struct bt_component_class_filter bt_component_class_filter
Filter component class.
Definition: types.h:26
Success.
Definition: plugin-loading.h:392
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:704
Success.
Definition: plugin-loading.h:263
Error.
Definition: plugin-loading.h:621
Out of memory.
Definition: plugin-loading.h:615
bt_property_availability
Availability of an object property.
Definition: types.h:159
Error.
Definition: plugin-loading.h:716
No plugins found.
Definition: plugin-loading.h:522
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:598
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:698
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:404
Plugin not found.
Definition: plugin-loading.h:269
Error.
Definition: plugin-loading.h:281
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:275
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:63
Out of memory.
Definition: plugin-loading.h:710
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:27
int bt_bool
Babeltrace 2 boolean type.
Definition: types.h:126
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:693
Error.
Definition: plugin-loading.h:410
bt_plugin_find_status
Status codes for bt_plugin_find().
Definition: plugin-loading.h:258
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:603
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:511
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.