Commit | Line | Data |
---|---|---|
33b34c43 PP |
1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_DEV_H |
2 | #define BABELTRACE_PLUGIN_PLUGIN_DEV_H | |
3 | ||
4 | /* | |
6ba0b073 | 5 | * BabelTrace - Babeltrace Plug-in Development API |
33b34c43 PP |
6 | * |
7 | * This is the header that you need to include for the development of | |
8 | * a Babeltrace plug-in. | |
9 | * | |
10 | * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
11 | * Copyright 2017 Philippe Proulx <pproulx@efficios.com> | |
12 | * | |
13 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
14 | * | |
15 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
16 | * of this software and associated documentation files (the "Software"), to deal | |
17 | * in the Software without restriction, including without limitation the rights | |
18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
19 | * copies of the Software, and to permit persons to whom the Software is | |
20 | * furnished to do so, subject to the following conditions: | |
21 | * | |
22 | * The above copyright notice and this permission notice shall be included in | |
23 | * all copies or substantial portions of the Software. | |
24 | * | |
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
31 | * SOFTWARE. | |
32 | */ | |
33 | ||
6ba0b073 | 34 | #include <stdint.h> |
33b34c43 PP |
35 | #include <babeltrace/plugin/plugin.h> |
36 | #include <babeltrace/component/component-class.h> | |
d3e4dcd8 PP |
37 | #include <babeltrace/component/component-class-source.h> |
38 | #include <babeltrace/component/component-class-filter.h> | |
39 | #include <babeltrace/component/component-class-sink.h> | |
33b34c43 PP |
40 | |
41 | #ifdef __cplusplus | |
42 | extern "C" { | |
43 | #endif | |
44 | ||
6ba0b073 PP |
45 | /* |
46 | * Plugin interface's version, not synced with Babeltrace's version | |
47 | * (internal use). | |
48 | */ | |
49 | #define __BT_PLUGIN_VERSION_MAJOR 1 | |
50 | #define __BT_PLUGIN_VERSION_MINOR 0 | |
51 | ||
52 | /* Plugin initialization function type */ | |
33b34c43 PP |
53 | typedef enum bt_plugin_status (*bt_plugin_init_func)( |
54 | struct bt_plugin *plugin); | |
55 | ||
6ba0b073 | 56 | /* Plugin exit function type */ |
33b34c43 PP |
57 | typedef enum bt_plugin_status (*bt_plugin_exit_func)(void); |
58 | ||
6ba0b073 PP |
59 | /* |
60 | * Function to call from a plugin's initialization function to add a | |
61 | * component class to a plugin object. | |
62 | */ | |
33b34c43 PP |
63 | extern enum bt_plugin_status bt_plugin_add_component_class( |
64 | struct bt_plugin *plugin, | |
65 | struct bt_component_class *component_class); | |
66 | ||
6ba0b073 PP |
67 | /* Plugin descriptor: describes a single plugin (internal use) */ |
68 | struct __bt_plugin_descriptor { | |
69 | /* Plugin's interface major version number */ | |
70 | uint32_t major; | |
71 | ||
72 | /* Plugin's interface minor version number */ | |
73 | uint32_t minor; | |
74 | ||
75 | /* Plugin's name */ | |
76 | const char *name; | |
77 | } __attribute__((packed)); | |
78 | ||
79 | /* Type of a plugin attribute (internal use) */ | |
80 | enum __bt_plugin_descriptor_attribute_type { | |
81 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT = 0, | |
82 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT = 1, | |
83 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR = 2, | |
84 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE = 3, | |
85 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 4, | |
b6de043b PP |
86 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION = 5, |
87 | }; | |
88 | ||
89 | /* Plugin (user) version */ | |
90 | struct __bt_plugin_descriptor_version { | |
91 | uint32_t major; | |
92 | uint32_t minor; | |
93 | uint32_t patch; | |
94 | const char *extra; | |
6ba0b073 PP |
95 | }; |
96 | ||
97 | /* Plugin attribute (internal use) */ | |
98 | struct __bt_plugin_descriptor_attribute { | |
99 | /* Plugin descriptor to which to associate this attribute */ | |
100 | const struct __bt_plugin_descriptor *plugin_descriptor; | |
101 | ||
6ba0b073 PP |
102 | /* Name of the attribute's type for debug purposes */ |
103 | const char *type_name; | |
104 | ||
857f4dce PP |
105 | /* Attribute's type */ |
106 | enum __bt_plugin_descriptor_attribute_type type; | |
107 | ||
d3e4dcd8 | 108 | /* Attribute's value (depends on attribute's type) */ |
6ba0b073 PP |
109 | union { |
110 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT */ | |
111 | bt_plugin_init_func init; | |
112 | ||
113 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT */ | |
114 | bt_plugin_exit_func exit; | |
115 | ||
116 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR */ | |
117 | const char *author; | |
118 | ||
119 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE */ | |
120 | const char *license; | |
121 | ||
122 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */ | |
123 | const char *description; | |
b6de043b PP |
124 | |
125 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION */ | |
126 | struct __bt_plugin_descriptor_version version; | |
6ba0b073 PP |
127 | } value; |
128 | } __attribute__((packed)); | |
129 | ||
130 | /* Component class descriptor (internal use) */ | |
131 | struct __bt_plugin_component_class_descriptor { | |
132 | /* | |
133 | * Plugin descriptor to which to associate this component | |
134 | * class descriptor. | |
135 | */ | |
136 | const struct __bt_plugin_descriptor *plugin_descriptor; | |
137 | ||
6ba0b073 PP |
138 | /* Component class name */ |
139 | const char *name; | |
140 | ||
857f4dce PP |
141 | /* Component class type */ |
142 | enum bt_component_class_type type; | |
143 | ||
d3e4dcd8 PP |
144 | /* Mandatory methods (depends on component class type) */ |
145 | union { | |
146 | /* BT_COMPONENT_CLASS_TYPE_SOURCE */ | |
147 | struct { | |
d3eb6e8f PP |
148 | bt_component_class_notification_iterator_get_method notif_iter_get; |
149 | bt_component_class_notification_iterator_next_method notif_iter_next; | |
d3e4dcd8 PP |
150 | } source; |
151 | ||
152 | /* BT_COMPONENT_CLASS_TYPE_FILTER */ | |
153 | struct { | |
d3eb6e8f PP |
154 | bt_component_class_notification_iterator_get_method notif_iter_get; |
155 | bt_component_class_notification_iterator_next_method notif_iter_next; | |
d3e4dcd8 PP |
156 | } filter; |
157 | ||
158 | /* BT_COMPONENT_CLASS_TYPE_SINK */ | |
159 | struct { | |
160 | bt_component_class_sink_consume_method consume; | |
161 | } sink; | |
162 | } methods; | |
6ba0b073 PP |
163 | } __attribute__((packed)); |
164 | ||
165 | /* Type of a component class attribute (internal use) */ | |
166 | enum __bt_plugin_component_class_descriptor_attribute_type { | |
d3e4dcd8 | 167 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 0, |
279b3f15 PP |
168 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP = 1, |
169 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD = 2, | |
170 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD = 3, | |
171 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD = 4, | |
172 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD = 5, | |
173 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD = 6, | |
174 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD = 7, | |
175 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD = 8, | |
6ba0b073 PP |
176 | }; |
177 | ||
178 | /* Component class attribute (internal use) */ | |
179 | struct __bt_plugin_component_class_descriptor_attribute { | |
180 | /* | |
181 | * Component class plugin attribute to which to associate this | |
182 | * component class attribute. | |
183 | */ | |
184 | const struct __bt_plugin_component_class_descriptor *comp_class_descriptor; | |
185 | ||
6ba0b073 PP |
186 | /* Name of the attribute's type for debug purposes */ |
187 | const char *type_name; | |
188 | ||
857f4dce PP |
189 | /* Attribute's type */ |
190 | enum __bt_plugin_component_class_descriptor_attribute_type type; | |
191 | ||
d3e4dcd8 | 192 | /* Attribute's value (depends on attribute's type) */ |
6ba0b073 | 193 | union { |
d3e4dcd8 | 194 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */ |
6ba0b073 | 195 | const char *description; |
d3e4dcd8 | 196 | |
279b3f15 PP |
197 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP */ |
198 | const char *help; | |
199 | ||
d3e4dcd8 PP |
200 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD */ |
201 | bt_component_class_init_method init_method; | |
202 | ||
203 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD */ | |
204 | bt_component_class_destroy_method destroy_method; | |
205 | ||
206 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD */ | |
207 | bt_component_class_filter_add_iterator_method filter_add_iterator_method; | |
208 | ||
209 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */ | |
210 | bt_component_class_sink_add_iterator_method sink_add_iterator_method; | |
d3eb6e8f PP |
211 | |
212 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD */ | |
213 | bt_component_class_notification_iterator_init_method notif_iter_init_method; | |
214 | ||
215 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD */ | |
216 | bt_component_class_notification_iterator_destroy_method notif_iter_destroy_method; | |
217 | ||
218 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD */ | |
219 | bt_component_class_notification_iterator_seek_time_method notif_iter_seek_time_method; | |
6ba0b073 PP |
220 | } value; |
221 | } __attribute__((packed)); | |
222 | ||
223 | /* | |
224 | * Variable attributes for a plugin descriptor pointer to be added to | |
225 | * the plugin descriptor section (internal use). | |
226 | */ | |
227 | #define __BT_PLUGIN_DESCRIPTOR_ATTRS \ | |
228 | __attribute__((section("__bt_plugin_descriptors"), used)) | |
229 | ||
230 | /* | |
231 | * Variable attributes for a plugin attribute pointer to be added to | |
232 | * the plugin attribute section (internal use). | |
233 | */ | |
234 | #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \ | |
235 | __attribute__((section("__bt_plugin_descriptor_attributes"), used)) | |
236 | ||
237 | /* | |
238 | * Variable attributes for a component class descriptor pointer to be | |
239 | * added to the component class descriptor section (internal use). | |
240 | */ | |
241 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \ | |
242 | __attribute__((section("__bt_plugin_component_class_descriptors"), used)) | |
243 | ||
244 | /* | |
245 | * Variable attributes for a component class descriptor attribute | |
246 | * pointer to be added to the component class descriptor attribute | |
247 | * section (internal use). | |
248 | */ | |
249 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \ | |
250 | __attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used)) | |
251 | ||
252 | /* | |
253 | * Declares a plugin descriptor pointer variable with a custom ID. | |
254 | * | |
255 | * _id: ID (any valid C identifier except `auto`). | |
256 | */ | |
257 | #define BT_PLUGIN_DECLARE(_id) extern struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id | |
258 | ||
259 | /* | |
260 | * Defines a plugin descriptor with a custom ID. | |
261 | * | |
262 | * _id: ID (any valid C identifier except `auto`). | |
263 | * _name: Plugin's name (C string). | |
264 | */ | |
265 | #define BT_PLUGIN_WITH_ID(_id, _name) \ | |
266 | struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \ | |
267 | .major = __BT_PLUGIN_VERSION_MAJOR, \ | |
268 | .minor = __BT_PLUGIN_VERSION_MINOR, \ | |
269 | .name = _name, \ | |
270 | }; \ | |
271 | static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \ | |
272 | extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \ | |
273 | extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors | |
274 | ||
275 | /* | |
276 | * Defines a plugin attribute (generic, internal use). | |
277 | * | |
278 | * _attr_name: Name of the attribute (C identifier). | |
279 | * _attr_type: Type of the attribute (enum __bt_plugin_descriptor_attribute_type). | |
280 | * _id: Plugin descriptor ID (C identifier). | |
281 | * _x: Value. | |
282 | */ | |
283 | #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _x) \ | |
284 | static struct __bt_plugin_descriptor_attribute __bt_plugin_descriptor_attribute_##_id##_##_attr_name = { \ | |
285 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ | |
6ba0b073 | 286 | .type_name = #_attr_name, \ |
857f4dce | 287 | .type = _attr_type, \ |
6ba0b073 PP |
288 | .value._attr_name = _x, \ |
289 | }; \ | |
290 | static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name; \ | |
291 | extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \ | |
292 | extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes | |
293 | ||
294 | /* | |
295 | * Defines a plugin initialization function attribute attached to a | |
296 | * specific plugin descriptor. | |
297 | * | |
298 | * _id: Plugin descriptor ID (C identifier). | |
299 | * _x: Initialization function (bt_plugin_init_func). | |
300 | */ | |
301 | #define BT_PLUGIN_INIT_WITH_ID(_id, _x) \ | |
302 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(init, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT, _id, _x) | |
303 | ||
304 | /* | |
305 | * Defines a plugin exit function attribute attached to a specific | |
306 | * plugin descriptor. | |
307 | * | |
308 | * _id: Plugin descriptor ID (C identifier). | |
309 | * _x: Exit function (bt_plugin_exit_func). | |
310 | */ | |
311 | #define BT_PLUGIN_EXIT_WITH_ID(_id, _x) \ | |
312 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(exit, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT, _id, _x) | |
313 | ||
314 | /* | |
315 | * Defines an author attribute attached to a specific plugin descriptor. | |
316 | * | |
317 | * _id: Plugin descriptor ID (C identifier). | |
318 | * _x: Author (C string). | |
319 | */ | |
320 | #define BT_PLUGIN_AUTHOR_WITH_ID(_id, _x) \ | |
321 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(author, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR, _id, _x) | |
322 | ||
323 | /* | |
324 | * Defines a license attribute attached to a specific plugin descriptor. | |
325 | * | |
326 | * _id: Plugin descriptor ID (C identifier). | |
327 | * _x: License (C string). | |
328 | */ | |
329 | #define BT_PLUGIN_LICENSE_WITH_ID(_id, _x) \ | |
330 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(license, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE, _id, _x) | |
331 | ||
332 | /* | |
333 | * Defines a description attribute attached to a specific plugin | |
334 | * descriptor. | |
335 | * | |
336 | * _id: Plugin descriptor ID (C identifier). | |
337 | * _x: Description (C string). | |
338 | */ | |
339 | #define BT_PLUGIN_DESCRIPTION_WITH_ID(_id, _x) \ | |
340 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _x) | |
341 | ||
b6de043b PP |
342 | #define __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra) \ |
343 | {.major = _major, .minor = _minor, .patch = _patch, .extra = _extra,} | |
344 | ||
345 | /* | |
346 | * Defines a version attribute attached to a specific plugin descriptor. | |
347 | * | |
348 | * _id: Plugin descriptor ID (C identifier). | |
349 | * _major: Plugin's major version (uint32_t). | |
350 | * _minor: Plugin's minor version (uint32_t). | |
351 | * _patch: Plugin's patch version (uint32_t). | |
352 | * _extra: Plugin's version extra information (C string). | |
353 | */ | |
354 | #define BT_PLUGIN_VERSION_WITH_ID(_id, _major, _minor, _patch, _extra) \ | |
355 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(version, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION, _id, __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra)) | |
356 | ||
6ba0b073 | 357 | /* |
d3e4dcd8 PP |
358 | * Declaration of start and stop symbols of component class descriptors |
359 | * section. | |
360 | */ | |
361 | #define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \ | |
362 | extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \ | |
363 | extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors | |
364 | ||
365 | /* | |
366 | * Defines a source component class descriptor with a custom ID. | |
6ba0b073 | 367 | * |
d3eb6e8f PP |
368 | * _id: ID (any valid C identifier except `auto`). |
369 | * _comp_class_id: Component class ID (C identifier). | |
370 | * _name: Component class name (C string). | |
371 | * _notif_iter_get_method: Component class's iterator get method | |
372 | * (bt_component_class_notification_iterator_get_method). | |
373 | * _notif_iter_next_method: Component class's iterator next method | |
374 | * (bt_component_class_notification_iterator_next_method). | |
6ba0b073 | 375 | */ |
d3eb6e8f | 376 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
d3e4dcd8 | 377 | static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \ |
6ba0b073 | 378 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
6ba0b073 | 379 | .name = _name, \ |
857f4dce | 380 | .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \ |
d3e4dcd8 | 381 | .methods.source = { \ |
d3eb6e8f PP |
382 | .notif_iter_get = _notif_iter_get_method, \ |
383 | .notif_iter_next = _notif_iter_next_method, \ | |
d3e4dcd8 | 384 | }, \ |
6ba0b073 | 385 | }; \ |
d3e4dcd8 PP |
386 | static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id; \ |
387 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP | |
388 | ||
389 | /* | |
390 | * Defines a filter component class descriptor with a custom ID. | |
391 | * | |
392 | * _id: ID (any valid C identifier except `auto`). | |
393 | * _comp_class_id: Component class ID (C identifier). | |
394 | * _name: Component class name (C string). | |
d3eb6e8f PP |
395 | * _notif_iter_get_method: Component class's iterator get method |
396 | * (bt_component_class_notification_iterator_get_method). | |
397 | * _notif_iter_next_method: Component class's iterator next method | |
398 | * (bt_component_class_notification_iterator_next_method). | |
d3e4dcd8 | 399 | */ |
d3eb6e8f | 400 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
d3e4dcd8 PP |
401 | static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \ |
402 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ | |
d3e4dcd8 | 403 | .name = _name, \ |
857f4dce | 404 | .type = BT_COMPONENT_CLASS_TYPE_FILTER, \ |
d3e4dcd8 | 405 | .methods.filter = { \ |
d3eb6e8f PP |
406 | .notif_iter_get = _notif_iter_get_method, \ |
407 | .notif_iter_next = _notif_iter_next_method, \ | |
d3e4dcd8 PP |
408 | }, \ |
409 | }; \ | |
410 | static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id; \ | |
411 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP | |
412 | ||
413 | /* | |
414 | * Defines a sink component class descriptor with a custom ID. | |
415 | * | |
416 | * _id: ID (any valid C identifier except `auto`). | |
417 | * _comp_class_id: Component class ID (C identifier). | |
418 | * _name: Component class name (C string). | |
419 | * _consume_method: Component class's iterator consume method | |
420 | * (bt_component_class_sink_consume_method). | |
421 | */ | |
422 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _consume_method) \ | |
423 | static struct __bt_plugin_component_class_descriptor __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id = { \ | |
424 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ | |
d3e4dcd8 | 425 | .name = _name, \ |
857f4dce | 426 | .type = BT_COMPONENT_CLASS_TYPE_SINK, \ |
d3e4dcd8 PP |
427 | .methods.sink = { \ |
428 | .consume = _consume_method, \ | |
429 | }, \ | |
430 | }; \ | |
431 | static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id; \ | |
432 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP | |
6ba0b073 PP |
433 | |
434 | /* | |
435 | * Defines a component class descriptor attribute (generic, internal | |
436 | * use). | |
437 | * | |
438 | * _id: Plugin descriptor ID (C identifier). | |
439 | * _comp_class_id: Component class ID (C identifier). | |
d3e4dcd8 | 440 | * _type: Component class type (`source`, `filter`, or `sink`). |
6ba0b073 PP |
441 | * _attr_name: Name of the attribute (C identifier). |
442 | * _attr_type: Type of the attribute | |
443 | * (enum __bt_plugin_descriptor_attribute_type). | |
444 | * _x: Value. | |
445 | */ | |
446 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _comp_class_id, _type, _x) \ | |
d3e4dcd8 PP |
447 | static struct __bt_plugin_component_class_descriptor_attribute __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name = { \ |
448 | .comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \ | |
6ba0b073 | 449 | .type_name = #_attr_name, \ |
857f4dce | 450 | .type = _attr_type, \ |
d3e4dcd8 | 451 | .value._attr_name = _x, \ |
6ba0b073 | 452 | }; \ |
d3e4dcd8 | 453 | static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name; \ |
6ba0b073 PP |
454 | extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \ |
455 | extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes | |
456 | ||
457 | /* | |
d3e4dcd8 PP |
458 | * Defines a description attribute attached to a specific source |
459 | * component class descriptor. | |
6ba0b073 PP |
460 | * |
461 | * _id: Plugin descriptor ID (C identifier). | |
462 | * _comp_class_id: Component class descriptor ID (C identifier). | |
6ba0b073 PP |
463 | * _x: Description (C string). |
464 | */ | |
d3e4dcd8 PP |
465 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ |
466 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, source, _x) | |
467 | ||
468 | /* | |
469 | * Defines a description attribute attached to a specific filter | |
470 | * component class descriptor. | |
471 | * | |
472 | * _id: Plugin descriptor ID (C identifier). | |
473 | * _comp_class_id: Component class descriptor ID (C identifier). | |
474 | * _x: Description (C string). | |
475 | */ | |
476 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ | |
477 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, filter, _x) | |
478 | ||
479 | /* | |
480 | * Defines a description attribute attached to a specific sink | |
481 | * component class descriptor. | |
482 | * | |
483 | * _id: Plugin descriptor ID (C identifier). | |
484 | * _comp_class_id: Component class descriptor ID (C identifier). | |
485 | * _x: Description (C string). | |
486 | */ | |
487 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ | |
488 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, sink, _x) | |
489 | ||
279b3f15 PP |
490 | /* |
491 | * Defines a help attribute attached to a specific source component | |
492 | * class descriptor. | |
493 | * | |
494 | * _id: Plugin descriptor ID (C identifier). | |
495 | * _comp_class_id: Component class descriptor ID (C identifier). | |
496 | * _x: Help (C string). | |
497 | */ | |
498 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_HELP_WITH_ID(_id, _comp_class_id, _x) \ | |
499 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(help, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP, _id, _comp_class_id, source, _x) | |
500 | ||
501 | /* | |
502 | * Defines a help attribute attached to a specific filter component | |
503 | * class descriptor. | |
504 | * | |
505 | * _id: Plugin descriptor ID (C identifier). | |
506 | * _comp_class_id: Component class descriptor ID (C identifier). | |
507 | * _x: Help (C string). | |
508 | */ | |
509 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_HELP_WITH_ID(_id, _comp_class_id, _x) \ | |
510 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(help, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP, _id, _comp_class_id, filter, _x) | |
511 | ||
512 | /* | |
513 | * Defines a help attribute attached to a specific sink component class | |
514 | * descriptor. | |
515 | * | |
516 | * _id: Plugin descriptor ID (C identifier). | |
517 | * _comp_class_id: Component class descriptor ID (C identifier). | |
518 | * _x: Help (C string). | |
519 | */ | |
520 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_HELP_WITH_ID(_id, _comp_class_id, _x) \ | |
521 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(help, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP, _id, _comp_class_id, sink, _x) | |
522 | ||
d3e4dcd8 PP |
523 | /* |
524 | * Defines an initialization method attribute attached to a specific | |
525 | * source component class descriptor. | |
526 | * | |
527 | * _id: Plugin descriptor ID (C identifier). | |
528 | * _comp_class_id: Component class descriptor ID (C identifier). | |
529 | * _x: Initialization method (bt_component_class_init_method). | |
530 | */ | |
531 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
532 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, source, _x) | |
533 | ||
534 | /* | |
535 | * Defines an initialization method attribute attached to a specific | |
536 | * filter component class descriptor. | |
537 | * | |
538 | * _id: Plugin descriptor ID (C identifier). | |
539 | * _comp_class_id: Component class descriptor ID (C identifier). | |
540 | * _x: Initialization method (bt_component_class_init_method). | |
541 | */ | |
542 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
543 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, filter, _x) | |
544 | ||
545 | /* | |
546 | * Defines an initialization method attribute attached to a specific | |
547 | * sink component class descriptor. | |
548 | * | |
549 | * _id: Plugin descriptor ID (C identifier). | |
550 | * _comp_class_id: Component class descriptor ID (C identifier). | |
551 | * _x: Initialization method (bt_component_class_init_method). | |
552 | */ | |
553 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
554 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, sink, _x) | |
555 | ||
556 | /* | |
557 | * Defines a destroy method attribute attached to a specific source | |
558 | * component class descriptor. | |
559 | * | |
560 | * _id: Plugin descriptor ID (C identifier). | |
561 | * _comp_class_id: Component class descriptor ID (C identifier). | |
562 | * _x: Destroy method (bt_component_class_destroy_method). | |
563 | */ | |
564 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
565 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, source, _x) | |
566 | ||
567 | /* | |
568 | * Defines a destroy method attribute attached to a specific filter | |
569 | * component class descriptor. | |
570 | * | |
571 | * _id: Plugin descriptor ID (C identifier). | |
572 | * _comp_class_id: Component class descriptor ID (C identifier). | |
573 | * _x: Destroy method (bt_component_class_destroy_method). | |
574 | */ | |
575 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
576 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, filter, _x) | |
577 | ||
578 | /* | |
579 | * Defines a destroy method attribute attached to a specific sink | |
580 | * component class descriptor. | |
581 | * | |
582 | * _id: Plugin descriptor ID (C identifier). | |
583 | * _comp_class_id: Component class descriptor ID (C identifier). | |
584 | * _x: Destroy method (bt_component_class_destroy_method). | |
585 | */ | |
586 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
587 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, sink, _x) | |
588 | ||
589 | /* | |
590 | * Defines an add iterator method attribute attached to a specific | |
591 | * filter component class descriptor. | |
592 | * | |
593 | * _id: Plugin descriptor ID (C identifier). | |
594 | * _comp_class_id: Component class descriptor ID (C identifier). | |
595 | * _x: Add iterator method | |
596 | * (bt_component_class_filter_add_iterator_method). | |
597 | */ | |
598 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
599 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_add_iterator_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD, _id, _comp_class_id, filter, _x) | |
600 | ||
601 | /* | |
602 | * Defines an add iterator method attribute attached to a specific | |
603 | * sink component class descriptor. | |
604 | * | |
605 | * _id: Plugin descriptor ID (C identifier). | |
606 | * _comp_class_id: Component class descriptor ID (C identifier). | |
607 | * _x: Add iterator method | |
608 | * (bt_component_class_sink_add_iterator_method). | |
609 | */ | |
610 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
611 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(sink_add_iterator_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD, _id, _comp_class_id, sink, _x) | |
6ba0b073 | 612 | |
d3eb6e8f PP |
613 | /* |
614 | * Defines an iterator initialization method attribute attached to a | |
615 | * specific source component class descriptor. | |
616 | * | |
617 | * _id: Plugin descriptor ID (C identifier). | |
618 | * _comp_class_id: Component class descriptor ID (C identifier). | |
619 | * _x: Iterator initialization method | |
620 | * (bt_component_class_notification_iterator_init_method). | |
621 | */ | |
622 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
623 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, source, _x) | |
624 | ||
625 | /* | |
626 | * Defines an iterator destroy method attribute attached to a specific | |
627 | * source component class descriptor. | |
628 | * | |
629 | * _id: Plugin descriptor ID (C identifier). | |
630 | * _comp_class_id: Component class descriptor ID (C identifier). | |
631 | * _x: Iterator destroy method | |
632 | * (bt_component_class_notification_iterator_destroy_method). | |
633 | */ | |
634 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
635 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD, _id, _comp_class_id, source, _x) | |
636 | ||
637 | /* | |
638 | * Defines an iterator seek time method attribute attached to a specific | |
639 | * source component class descriptor. | |
640 | * | |
641 | * _id: Plugin descriptor ID (C identifier). | |
642 | * _comp_class_id: Component class descriptor ID (C identifier). | |
643 | * _x: Iterator seek time method | |
644 | * (bt_component_class_notification_iterator_seek_time_method). | |
645 | */ | |
646 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
647 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, source, _x) | |
648 | ||
649 | /* | |
650 | * Defines an iterator initialization method attribute attached to a | |
651 | * specific filter component class descriptor. | |
652 | * | |
653 | * _id: Plugin descriptor ID (C identifier). | |
654 | * _comp_class_id: Component class descriptor ID (C identifier). | |
655 | * _x: Iterator initialization method | |
656 | * (bt_component_class_notification_iterator_init_method). | |
657 | */ | |
658 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
659 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, filter, _x) | |
660 | ||
661 | /* | |
662 | * Defines an iterator destroy method attribute attached to a specific | |
663 | * filter component class descriptor. | |
664 | * | |
665 | * _id: Plugin descriptor ID (C identifier). | |
666 | * _comp_class_id: Component class descriptor ID (C identifier). | |
667 | * _x: Iterator destroy method | |
668 | * (bt_component_class_notification_iterator_destroy_method). | |
669 | */ | |
670 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
671 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD, _id, _comp_class_id, filter, _x) | |
672 | ||
673 | /* | |
674 | * Defines an iterator seek time method attribute attached to a specific | |
675 | * filter component class descriptor. | |
676 | * | |
677 | * _id: Plugin descriptor ID (C identifier). | |
678 | * _comp_class_id: Component class descriptor ID (C identifier). | |
679 | * _x: Iterator seek time method | |
680 | * (bt_component_class_notification_iterator_seek_time_method). | |
681 | */ | |
682 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ | |
683 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, filter, _x) | |
684 | ||
6ba0b073 PP |
685 | /* |
686 | * Defines a plugin descriptor with an automatic ID. | |
687 | * | |
688 | * _name: Plugin's name (C string). | |
689 | */ | |
690 | #define BT_PLUGIN(_name) static BT_PLUGIN_WITH_ID(auto, #_name) | |
691 | ||
692 | /* | |
693 | * Defines a plugin initialization function attribute attached to the | |
694 | * automatic plugin descriptor. | |
695 | * | |
696 | * _x: Initialization function (bt_plugin_init_func). | |
697 | */ | |
698 | #define BT_PLUGIN_INIT(_x) BT_PLUGIN_INIT_WITH_ID(auto, _x) | |
699 | ||
700 | /* | |
701 | * Defines a plugin exit function attribute attached to the automatic | |
702 | * plugin descriptor. | |
703 | * | |
704 | * _x: Exit function (bt_plugin_exit_func). | |
705 | */ | |
706 | #define BT_PLUGIN_EXIT(_x) BT_PLUGIN_EXIT_WITH_ID(auto, _x) | |
707 | ||
708 | /* | |
709 | * Defines an author attribute attached to the automatic plugin | |
710 | * descriptor. | |
711 | * | |
712 | * _x: Author (C string). | |
713 | */ | |
714 | #define BT_PLUGIN_AUTHOR(_x) BT_PLUGIN_AUTHOR_WITH_ID(auto, _x) | |
715 | ||
716 | /* | |
717 | * Defines a license attribute attached to the automatic plugin | |
718 | * descriptor. | |
719 | * | |
720 | * _x: License (C string). | |
721 | */ | |
722 | #define BT_PLUGIN_LICENSE(_x) BT_PLUGIN_LICENSE_WITH_ID(auto, _x) | |
723 | ||
724 | /* | |
725 | * Defines a description attribute attached to the automatic plugin | |
726 | * descriptor. | |
727 | * | |
728 | * _x: Description (C string). | |
729 | */ | |
730 | #define BT_PLUGIN_DESCRIPTION(_x) BT_PLUGIN_DESCRIPTION_WITH_ID(auto, _x) | |
b6de043b PP |
731 | |
732 | /* | |
733 | * Defines a version attribute attached to the automatic plugin | |
734 | * descriptor. | |
735 | * | |
736 | * _major: Plugin's major version (uint32_t). | |
737 | * _minor: Plugin's minor version (uint32_t). | |
738 | * _patch: Plugin's patch version (uint32_t). | |
739 | * _extra: Plugin's version extra information (C string). | |
740 | */ | |
741 | #define BT_PLUGIN_VERSION(_major, _minor, _patch, _extra) BT_PLUGIN_VERSION_WITH_ID(auto, _major, _minor, _patch, _extra) | |
6ba0b073 PP |
742 | |
743 | /* | |
d3e4dcd8 PP |
744 | * Defines a source component class attached to the automatic plugin |
745 | * descriptor. Its ID is the same as its name, hence its name must be a | |
746 | * C identifier in this version. | |
747 | * | |
d3eb6e8f PP |
748 | * _name: Component class name (C identifier). |
749 | * _notif_iter_get_method: Component class's iterator get method | |
750 | * (bt_component_class_notification_iterator_get_method). | |
751 | * _notif_iter_next_method: Component class's iterator next method | |
752 | * (bt_component_class_notification_iterator_next_method). | |
d3e4dcd8 | 753 | */ |
d3eb6e8f PP |
754 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \ |
755 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method) | |
d3e4dcd8 PP |
756 | |
757 | /* | |
758 | * Defines a filter component class attached to the automatic plugin | |
6ba0b073 PP |
759 | * descriptor. Its ID is the same as its name, hence its name must be a |
760 | * C identifier in this version. | |
761 | * | |
d3eb6e8f PP |
762 | * _name: Component class name (C identifier). |
763 | * _notif_iter_get_method: Component class's iterator get method | |
764 | * (bt_component_class_notification_iterator_get_method). | |
765 | * _notif_iter_next_method: Component class's iterator next method | |
766 | * (bt_component_class_notification_iterator_next_method). | |
6ba0b073 | 767 | */ |
d3eb6e8f PP |
768 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \ |
769 | BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method) | |
6ba0b073 PP |
770 | |
771 | /* | |
d3e4dcd8 PP |
772 | * Defines a sink component class attached to the automatic plugin |
773 | * descriptor. Its ID is the same as its name, hence its name must be a | |
774 | * C identifier in this version. | |
775 | * | |
776 | * _name: Component class name (C identifier). | |
777 | * _consume_method: Component class's consume method | |
778 | * (bt_component_class_sink_consume_method). | |
779 | */ | |
780 | #define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method) \ | |
781 | BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _consume_method) | |
782 | ||
783 | /* | |
784 | * Defines a description attribute attached to a source component class | |
6ba0b073 PP |
785 | * descriptor which is attached to the automatic plugin descriptor. |
786 | * | |
d3e4dcd8 PP |
787 | * _name: Component class name (C identifier). |
788 | * _x: Description (C string). | |
789 | */ | |
790 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ | |
791 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) | |
792 | ||
793 | /* | |
794 | * Defines a description attribute attached to a filter component class | |
795 | * descriptor which is attached to the automatic plugin descriptor. | |
796 | * | |
797 | * _name: Component class name (C identifier). | |
798 | * _x: Description (C string). | |
799 | */ | |
800 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ | |
801 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) | |
802 | ||
803 | /* | |
804 | * Defines a description attribute attached to a sink component class | |
805 | * descriptor which is attached to the automatic plugin descriptor. | |
806 | * | |
807 | * _name: Component class name (C identifier). | |
808 | * _x: Description (C string). | |
809 | */ | |
810 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ | |
811 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) | |
812 | ||
279b3f15 PP |
813 | /* |
814 | * Defines a help attribute attached to a source component class | |
815 | * descriptor which is attached to the automatic plugin descriptor. | |
816 | * | |
817 | * _name: Component class name (C identifier). | |
818 | * _x: Help (C string). | |
819 | */ | |
820 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_HELP(_name, _x) \ | |
821 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_HELP_WITH_ID(auto, _name, _x) | |
822 | ||
823 | /* | |
824 | * Defines a help attribute attached to a filter component class | |
825 | * descriptor which is attached to the automatic plugin descriptor. | |
826 | * | |
827 | * _name: Component class name (C identifier). | |
828 | * _x: Help (C string). | |
829 | */ | |
830 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_HELP(_name, _x) \ | |
831 | BT_PLUGIN_FILTER_COMPONENT_CLASS_HELP_WITH_ID(auto, _name, _x) | |
832 | ||
833 | /* | |
834 | * Defines a help attribute attached to a sink component class | |
835 | * descriptor which is attached to the automatic plugin descriptor. | |
836 | * | |
837 | * _name: Component class name (C identifier). | |
838 | * _x: Help (C string). | |
839 | */ | |
840 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(_name, _x) \ | |
841 | BT_PLUGIN_SINK_COMPONENT_CLASS_HELP_WITH_ID(auto, _name, _x) | |
842 | ||
d3e4dcd8 PP |
843 | /* |
844 | * Defines an initialization method attribute attached to a source | |
845 | * component class descriptor which is attached to the automatic plugin | |
846 | * descriptor. | |
847 | * | |
848 | * _name: Component class name (C identifier). | |
849 | * _x: Initialization method (bt_component_class_init_method). | |
850 | */ | |
851 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ | |
852 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) | |
853 | ||
854 | /* | |
855 | * Defines an initialization method attribute attached to a filter | |
856 | * component class descriptor which is attached to the automatic plugin | |
857 | * descriptor. | |
858 | * | |
859 | * _name: Component class name (C identifier). | |
860 | * _x: Initialization method (bt_component_class_init_method). | |
861 | */ | |
862 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ | |
863 | BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) | |
864 | ||
865 | /* | |
866 | * Defines an initialization method attribute attached to a sink | |
867 | * component class descriptor which is attached to the automatic plugin | |
868 | * descriptor. | |
869 | * | |
870 | * _name: Component class name (C identifier). | |
871 | * _x: Initialization method (bt_component_class_init_method). | |
872 | */ | |
873 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ | |
874 | BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) | |
875 | ||
876 | /* | |
877 | * Defines a destroy method attribute attached to a source component | |
878 | * class descriptor which is attached to the automatic plugin | |
879 | * descriptor. | |
880 | * | |
881 | * _name: Component class name (C identifier). | |
882 | * _x: Initialization method (bt_component_class_destroy_method). | |
883 | */ | |
884 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ | |
885 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) | |
886 | ||
887 | /* | |
888 | * Defines a destroy method attribute attached to a filter component | |
889 | * class descriptor which is attached to the automatic plugin | |
890 | * descriptor. | |
891 | * | |
892 | * _name: Component class name (C identifier). | |
893 | * _x: Initialization method (bt_component_class_destroy_method). | |
894 | */ | |
895 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ | |
896 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) | |
897 | ||
898 | /* | |
899 | * Defines a destroy method attribute attached to a sink component class | |
900 | * descriptor which is attached to the automatic plugin descriptor. | |
901 | * | |
902 | * _name: Component class name (C identifier). | |
903 | * _x: Initialization method (bt_component_class_destroy_method). | |
904 | */ | |
905 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ | |
906 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) | |
907 | ||
908 | /* | |
909 | * Defines an add iterator method attribute attached to a filter | |
910 | * component class descriptor which is attached to the automatic plugin | |
911 | * descriptor. | |
912 | * | |
913 | * _name: Component class name (C identifier). | |
914 | * _x: Add iterator method (bt_component_class_filter_add_iterator_method). | |
915 | */ | |
916 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \ | |
917 | BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x) | |
918 | ||
919 | /* | |
920 | * Defines an add iterator method attribute attached to a sink | |
921 | * component class descriptor which is attached to the automatic plugin | |
922 | * descriptor. | |
923 | * | |
924 | * _name: Component class name (C identifier). | |
925 | * _x: Add iterator method (bt_component_class_sink_add_iterator_method). | |
6ba0b073 | 926 | */ |
d3e4dcd8 PP |
927 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \ |
928 | BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x) | |
33b34c43 | 929 | |
d3eb6e8f PP |
930 | /* |
931 | * Defines an iterator initialization method attribute attached to a | |
932 | * source component class descriptor which is attached to the automatic | |
933 | * plugin descriptor. | |
934 | * | |
935 | * _name: Component class name (C identifier). | |
936 | * _x: Iterator initialization method | |
937 | * (bt_component_class_notification_iterator_init_method). | |
938 | */ | |
939 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \ | |
940 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x) | |
941 | ||
942 | /* | |
943 | * Defines an iterator destroy method attribute attached to a source | |
944 | * component class descriptor which is attached to the automatic plugin | |
945 | * descriptor. | |
946 | * | |
947 | * _name: Component class name (C identifier). | |
948 | * _x: Iterator destroy method | |
949 | * (bt_component_class_notification_iterator_destroy_method). | |
950 | */ | |
951 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \ | |
952 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x) | |
953 | ||
954 | /* | |
955 | * Defines an iterator seek time method attribute attached to a source | |
956 | * component class descriptor which is attached to the automatic plugin | |
957 | * descriptor. | |
958 | * | |
959 | * _name: Component class name (C identifier). | |
960 | * _x: Iterator seek time method | |
961 | * (bt_component_class_notification_iterator_seek_time_method). | |
962 | */ | |
963 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ | |
964 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) | |
965 | ||
966 | /* | |
967 | * Defines an iterator initialization method attribute attached to a | |
968 | * filter component class descriptor which is attached to the automatic | |
969 | * plugin descriptor. | |
970 | * | |
971 | * _name: Component class name (C identifier). | |
972 | * _x: Iterator initialization method | |
973 | * (bt_component_class_notification_iterator_init_method). | |
974 | */ | |
975 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \ | |
976 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x) | |
977 | ||
978 | /* | |
979 | * Defines an iterator destroy method attribute attached to a filter | |
980 | * component class descriptor which is attached to the automatic plugin | |
981 | * descriptor. | |
982 | * | |
983 | * _name: Component class name (C identifier). | |
984 | * _x: Iterator destroy method | |
985 | * (bt_component_class_notification_iterator_destroy_method). | |
986 | */ | |
987 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \ | |
988 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x) | |
989 | ||
990 | /* | |
991 | * Defines an iterator seek time method attribute attached to a filter | |
992 | * component class descriptor which is attached to the automatic plugin | |
993 | * descriptor. | |
994 | * | |
995 | * _name: Component class name (C identifier). | |
996 | * _x: Iterator seek time method | |
997 | * (bt_component_class_notification_iterator_seek_time_method). | |
998 | */ | |
999 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ | |
1000 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) | |
1001 | ||
33b34c43 PP |
1002 | #ifdef __cplusplus |
1003 | } | |
1004 | #endif | |
1005 | ||
1006 | #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */ |