lib: strictly type function return status enumerations
[babeltrace.git] / include / babeltrace2 / plugin / plugin-const.h
CommitLineData
92fed4e1
PP
1#ifndef BABELTRACE_PLUGIN_PLUGIN_CONST_H
2#define BABELTRACE_PLUGIN_PLUGIN_CONST_H
90354d3a
JG
3
4/*
e2f7325d 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>
9d408fca 31
b19ff26f
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 */
3fadfbc0 37#include <babeltrace2/types.h>
33b34c43 38
4cdfc5e8 39/* For bt_property_availability */
3fadfbc0 40#include <babeltrace2/property.h>
d94d92ac 41
d24d5663
PP
42/* For __BT_FUNC_STATUS_* */
43#define __BT_FUNC_STATUS_ENABLE
44#include <babeltrace2/func-status.h>
45#undef __BT_FUNC_STATUS_ENABLE
46
38b48196
JG
47#ifdef __cplusplus
48extern "C" {
49#endif
633edee0 50
d24d5663
PP
51typedef enum bt_plugin_find_status {
52 BT_PLUGIN_FIND_STATUS_OK = __BT_FUNC_STATUS_OK,
53 BT_PLUGIN_FIND_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
54 BT_PLUGIN_FIND_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
55 BT_PLUGIN_FIND_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
56 BT_PLUGIN_FIND_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
57} bt_plugin_find_status;
2b43acf9 58
d24d5663 59extern bt_plugin_find_status bt_plugin_find(const char *plugin_name,
9736d991 60 bt_bool fail_on_load_error, const bt_plugin **plugin);
33b34c43 61
d24d5663
PP
62typedef enum bt_plugin_find_all_from_file_status {
63 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK = __BT_FUNC_STATUS_OK,
64 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
65 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
66 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
67 BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
68} bt_plugin_find_all_from_file_status;
69
70extern bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
9736d991
PP
71 const char *path, bt_bool fail_on_load_error,
72 const bt_plugin_set **plugin_set);
33b34c43 73
d24d5663
PP
74typedef enum bt_plugin_find_all_from_dir_status {
75 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK = __BT_FUNC_STATUS_OK,
76 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
77 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
78 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
79 BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
80} bt_plugin_find_all_from_dir_status;
81
82extern bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
9736d991
PP
83 const char *path, bt_bool recurse, bt_bool fail_on_load_error,
84 const bt_plugin_set **plugin_set);
85
d24d5663
PP
86typedef enum bt_plugin_find_all_from_static_status {
87 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK = __BT_FUNC_STATUS_OK,
88 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND = __BT_FUNC_STATUS_NOT_FOUND,
89 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
90 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_LOADING_ERROR = __BT_FUNC_STATUS_LOADING_ERROR,
91 BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
92} bt_plugin_find_all_from_static_status;
93
94extern bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
95 bt_bool fail_on_load_error, const bt_plugin_set **plugin_set);
73299554 96
b19ff26f 97extern const char *bt_plugin_get_name(const bt_plugin *plugin);
633edee0 98
b19ff26f 99extern const char *bt_plugin_get_author(const bt_plugin *plugin);
633edee0 100
b19ff26f 101extern const char *bt_plugin_get_license(const bt_plugin *plugin);
633edee0 102
b19ff26f 103extern const char *bt_plugin_get_description(const bt_plugin *plugin);
f3bc2010 104
b19ff26f 105extern const char *bt_plugin_get_path(const bt_plugin *plugin);
7c7c0433 106
4cdfc5e8 107extern bt_property_availability bt_plugin_get_version(
b19ff26f 108 const bt_plugin *plugin, unsigned int *major,
d94d92ac
PP
109 unsigned int *minor, unsigned int *patch, const char **extra);
110
111extern uint64_t bt_plugin_get_source_component_class_count(
b19ff26f 112 const bt_plugin *plugin);
d94d92ac
PP
113
114extern uint64_t bt_plugin_get_filter_component_class_count(
b19ff26f 115 const bt_plugin *plugin);
b6de043b 116
d94d92ac 117extern uint64_t bt_plugin_get_sink_component_class_count(
b19ff26f 118 const bt_plugin *plugin);
33b34c43 119
b19ff26f 120extern const bt_component_class_source *
3f79b5cf 121bt_plugin_borrow_source_component_class_by_index_const(
b19ff26f 122 const bt_plugin *plugin, uint64_t index);
33b34c43 123
b19ff26f 124extern const bt_component_class_filter *
92fed4e1 125bt_plugin_borrow_filter_component_class_by_index_const(
b19ff26f 126 const bt_plugin *plugin, uint64_t index);
d94d92ac 127
b19ff26f 128extern const bt_component_class_sink *
92fed4e1 129bt_plugin_borrow_sink_component_class_by_index_const(
b19ff26f 130 const bt_plugin *plugin, uint64_t index);
d94d92ac 131
b19ff26f 132extern const bt_component_class_source *
0d72b8c3 133bt_plugin_borrow_source_component_class_by_name_const(
b19ff26f 134 const bt_plugin *plugin, const char *name);
d94d92ac 135
b19ff26f 136extern const bt_component_class_filter *
0d72b8c3 137bt_plugin_borrow_filter_component_class_by_name_const(
b19ff26f 138 const bt_plugin *plugin, const char *name);
d94d92ac 139
b19ff26f 140extern const bt_component_class_sink *
0d72b8c3 141bt_plugin_borrow_sink_component_class_by_name_const(
b19ff26f 142 const bt_plugin *plugin, const char *name);
33b34c43 143
b19ff26f 144extern void bt_plugin_get_ref(const bt_plugin *plugin);
c5b9b441 145
b19ff26f 146extern void bt_plugin_put_ref(const bt_plugin *plugin);
c5b9b441
PP
147
148#define BT_PLUGIN_PUT_REF_AND_RESET(_var) \
149 do { \
150 bt_plugin_put_ref(_var); \
151 (_var) = NULL; \
152 } while (0)
153
154#define BT_PLUGIN_MOVE_REF(_var_dst, _var_src) \
155 do { \
156 bt_plugin_put_ref(_var_dst); \
157 (_var_dst) = (_var_src); \
158 (_var_src) = NULL; \
159 } while (0)
160
38b48196
JG
161#ifdef __cplusplus
162}
163#endif
90354d3a 164
d24d5663
PP
165#include <babeltrace2/undef-func-status.h>
166
92fed4e1 167#endif /* BABELTRACE_PLUGIN_PLUGIN_CONST_H */
This page took 0.05545 seconds and 4 git commands to generate.