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 | 32 | #include <stddef.h> |
9d408fca PP |
33 | |
34 | /* For bt_bool */ | |
c55a9f58 | 35 | #include <babeltrace/types.h> |
33b34c43 | 36 | |
9d408fca PP |
37 | /* For enum bt_component_class_type */ |
38 | #include <babeltrace/graph/component-class.h> | |
39 | ||
38b48196 JG |
40 | #ifdef __cplusplus |
41 | extern "C" { | |
42 | #endif | |
633edee0 | 43 | |
38b48196 | 44 | struct bt_plugin; |
a8ff38ef | 45 | struct bt_plugin_set; |
33b34c43 PP |
46 | struct bt_component_class; |
47 | ||
48 | /** | |
49 | * Status code. Errors are always negative. | |
50 | */ | |
51 | enum bt_plugin_status { | |
52 | /** No error, okay. */ | |
53 | BT_PLUGIN_STATUS_OK = 0, | |
54 | /** General error. */ | |
55 | BT_PLUGIN_STATUS_ERROR = -1, | |
56 | /** Memory allocation failure. */ | |
57 | BT_PLUGIN_STATUS_NOMEM = -4, | |
58 | }; | |
59 | ||
2b43acf9 PP |
60 | extern struct bt_plugin *bt_plugin_find(const char *plugin_name); |
61 | ||
62 | extern struct bt_component_class *bt_plugin_find_component_class( | |
63 | const char *plugin_name, const char *component_class_name, | |
64 | enum bt_component_class_type component_class_type); | |
1670bffd | 65 | |
a8ff38ef | 66 | extern struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path); |
33b34c43 | 67 | |
a8ff38ef | 68 | extern struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path, |
c55a9f58 | 69 | bt_bool recurse); |
33b34c43 | 70 | |
a8ff38ef | 71 | extern struct bt_plugin_set *bt_plugin_create_all_from_static(void); |
73299554 | 72 | |
38b48196 JG |
73 | /** |
74 | * Get the name of a plug-in. | |
75 | * | |
76 | * @param plugin An instance of a plug-in | |
77 | * @returns Plug-in name or NULL on error | |
78 | */ | |
79 | extern const char *bt_plugin_get_name(struct bt_plugin *plugin); | |
633edee0 | 80 | |
38b48196 JG |
81 | /** |
82 | * Get the name of a plug-in's author. | |
83 | * | |
84 | * @param plugin An instance of a plug-in | |
85 | * @returns Plug-in author or NULL on error | |
86 | */ | |
87 | extern const char *bt_plugin_get_author(struct bt_plugin *plugin); | |
633edee0 | 88 | |
38b48196 JG |
89 | /** |
90 | * Get the license of a plug-in. | |
91 | * | |
92 | * @param plugin An instance of a plug-in | |
93 | * @returns Plug-in license or NULL on error | |
94 | */ | |
95 | extern const char *bt_plugin_get_license(struct bt_plugin *plugin); | |
633edee0 | 96 | |
f3bc2010 JG |
97 | /** |
98 | * Get the decription of a plug-in. | |
99 | * | |
100 | * @param plugin An instance of a plug-in | |
101 | * @returns Plug-in description or NULL if none is available | |
102 | */ | |
103 | extern const char *bt_plugin_get_description(struct bt_plugin *plugin); | |
104 | ||
7c7c0433 JG |
105 | /** |
106 | * Get the path of a plug-in. | |
107 | * | |
108 | * @param plugin An instance of a plug-in | |
109 | * @returns Plug-in path or NULL on error | |
110 | */ | |
111 | extern const char *bt_plugin_get_path(struct bt_plugin *plugin); | |
112 | ||
b6de043b PP |
113 | extern enum bt_plugin_status bt_plugin_get_version(struct bt_plugin *plugin, |
114 | unsigned int *major, unsigned int *minor, unsigned int *patch, | |
115 | const char **extra); | |
116 | ||
544d0515 | 117 | extern int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin); |
33b34c43 | 118 | |
9ac68eb1 PP |
119 | extern struct bt_component_class *bt_plugin_get_component_class_by_index( |
120 | struct bt_plugin *plugin, uint64_t index); | |
33b34c43 PP |
121 | |
122 | extern | |
123 | struct bt_component_class *bt_plugin_get_component_class_by_name_and_type( | |
124 | struct bt_plugin *plugin, const char *name, | |
d3e4dcd8 | 125 | enum bt_component_class_type type); |
33b34c43 | 126 | |
a8ff38ef | 127 | extern |
544d0515 | 128 | int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set); |
a8ff38ef PP |
129 | |
130 | extern | |
131 | struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set, | |
9ac68eb1 | 132 | uint64_t index); |
a8ff38ef | 133 | |
38b48196 JG |
134 | #ifdef __cplusplus |
135 | } | |
136 | #endif | |
90354d3a | 137 | |
33b34c43 | 138 | #endif /* BABELTRACE_PLUGIN_PLUGIN_H */ |