Commit | Line | Data |
---|---|---|
33b34c43 PP |
1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_H |
2 | #define BABELTRACE_PLUGIN_PLUGIN_H | |
90354d3a JG |
3 | |
4 | /* | |
584e4e78 | 5 | * BabelTrace - Babeltrace Plug-in Interface |
90354d3a | 6 | * |
38b48196 | 7 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
33b34c43 | 8 | * Copyright 2017 Philippe Proulx <pproulx@efficios.com> |
90354d3a JG |
9 | * |
10 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
11 | * | |
12 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
13 | * of this software and associated documentation files (the "Software"), to deal | |
14 | * in the Software without restriction, including without limitation the rights | |
15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
16 | * copies of the Software, and to permit persons to whom the Software is | |
17 | * furnished to do so, subject to the following conditions: | |
18 | * | |
19 | * The above copyright notice and this permission notice shall be included in | |
20 | * all copies or substantial portions of the Software. | |
21 | * | |
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
28 | * SOFTWARE. | |
29 | */ | |
30 | ||
544d0515 | 31 | #include <stdint.h> |
33b34c43 PP |
32 | #include <stddef.h> |
33 | #include <stdbool.h> | |
b2e0c907 | 34 | #include <babeltrace/graph/component-class.h> |
33b34c43 | 35 | |
38b48196 JG |
36 | #ifdef __cplusplus |
37 | extern "C" { | |
38 | #endif | |
633edee0 | 39 | |
38b48196 | 40 | struct bt_plugin; |
a8ff38ef | 41 | struct bt_plugin_set; |
33b34c43 PP |
42 | struct bt_component_class; |
43 | ||
44 | /** | |
45 | * Status code. Errors are always negative. | |
46 | */ | |
47 | enum bt_plugin_status { | |
48 | /** No error, okay. */ | |
49 | BT_PLUGIN_STATUS_OK = 0, | |
50 | /** General error. */ | |
51 | BT_PLUGIN_STATUS_ERROR = -1, | |
52 | /** Memory allocation failure. */ | |
53 | BT_PLUGIN_STATUS_NOMEM = -4, | |
54 | }; | |
55 | ||
2b43acf9 PP |
56 | extern struct bt_plugin *bt_plugin_find(const char *plugin_name); |
57 | ||
58 | extern struct bt_component_class *bt_plugin_find_component_class( | |
59 | const char *plugin_name, const char *component_class_name, | |
60 | enum bt_component_class_type component_class_type); | |
1670bffd | 61 | |
a8ff38ef | 62 | extern struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path); |
33b34c43 | 63 | |
a8ff38ef | 64 | extern struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path, |
33b34c43 PP |
65 | bool recurse); |
66 | ||
a8ff38ef | 67 | extern struct bt_plugin_set *bt_plugin_create_all_from_static(void); |
73299554 | 68 | |
38b48196 JG |
69 | /** |
70 | * Get the name of a plug-in. | |
71 | * | |
72 | * @param plugin An instance of a plug-in | |
73 | * @returns Plug-in name or NULL on error | |
74 | */ | |
75 | extern const char *bt_plugin_get_name(struct bt_plugin *plugin); | |
633edee0 | 76 | |
38b48196 JG |
77 | /** |
78 | * Get the name of a plug-in's author. | |
79 | * | |
80 | * @param plugin An instance of a plug-in | |
81 | * @returns Plug-in author or NULL on error | |
82 | */ | |
83 | extern const char *bt_plugin_get_author(struct bt_plugin *plugin); | |
633edee0 | 84 | |
38b48196 JG |
85 | /** |
86 | * Get the license of a plug-in. | |
87 | * | |
88 | * @param plugin An instance of a plug-in | |
89 | * @returns Plug-in license or NULL on error | |
90 | */ | |
91 | extern const char *bt_plugin_get_license(struct bt_plugin *plugin); | |
633edee0 | 92 | |
f3bc2010 JG |
93 | /** |
94 | * Get the decription of a plug-in. | |
95 | * | |
96 | * @param plugin An instance of a plug-in | |
97 | * @returns Plug-in description or NULL if none is available | |
98 | */ | |
99 | extern const char *bt_plugin_get_description(struct bt_plugin *plugin); | |
100 | ||
7c7c0433 JG |
101 | /** |
102 | * Get the path of a plug-in. | |
103 | * | |
104 | * @param plugin An instance of a plug-in | |
105 | * @returns Plug-in path or NULL on error | |
106 | */ | |
107 | extern const char *bt_plugin_get_path(struct bt_plugin *plugin); | |
108 | ||
b6de043b PP |
109 | extern enum bt_plugin_status bt_plugin_get_version(struct bt_plugin *plugin, |
110 | unsigned int *major, unsigned int *minor, unsigned int *patch, | |
111 | const char **extra); | |
112 | ||
544d0515 | 113 | extern int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin); |
33b34c43 | 114 | |
9ac68eb1 PP |
115 | extern struct bt_component_class *bt_plugin_get_component_class_by_index( |
116 | struct bt_plugin *plugin, uint64_t index); | |
33b34c43 PP |
117 | |
118 | extern | |
119 | struct bt_component_class *bt_plugin_get_component_class_by_name_and_type( | |
120 | struct bt_plugin *plugin, const char *name, | |
d3e4dcd8 | 121 | enum bt_component_class_type type); |
33b34c43 | 122 | |
a8ff38ef | 123 | extern |
544d0515 | 124 | int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set); |
a8ff38ef PP |
125 | |
126 | extern | |
127 | struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set, | |
9ac68eb1 | 128 | uint64_t index); |
a8ff38ef | 129 | |
38b48196 JG |
130 | #ifdef __cplusplus |
131 | } | |
132 | #endif | |
90354d3a | 133 | |
33b34c43 | 134 | #endif /* BABELTRACE_PLUGIN_PLUGIN_H */ |