1 #ifndef BABELTRACE_PLUGIN_PLUGIN_DEV_H
2 #define BABELTRACE_PLUGIN_PLUGIN_DEV_H
5 * BabelTrace - Babeltrace Plug-in Development API
7 * This is the header that you need to include for the development of
8 * a Babeltrace plug-in.
10 * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
13 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
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
35 #include <babeltrace/plugin/plugin.h>
36 #include <babeltrace/component/component-class.h>
37 #include <babeltrace/component/component-class-source.h>
38 #include <babeltrace/component/component-class-filter.h>
39 #include <babeltrace/component/component-class-sink.h>
46 * Plugin interface's version, not synced with Babeltrace's version
49 #define __BT_PLUGIN_VERSION_MAJOR 1
50 #define __BT_PLUGIN_VERSION_MINOR 0
52 /* Plugin initialization function type */
53 typedef enum bt_plugin_status (*bt_plugin_init_func
)(
54 struct bt_plugin
*plugin
);
56 /* Plugin exit function type */
57 typedef enum bt_plugin_status (*bt_plugin_exit_func
)(void);
60 * Function to call from a plugin's initialization function to add a
61 * component class to a plugin object.
63 extern enum bt_plugin_status
bt_plugin_add_component_class(
64 struct bt_plugin
*plugin
,
65 struct bt_component_class
*component_class
);
67 /* Plugin descriptor: describes a single plugin (internal use) */
68 struct __bt_plugin_descriptor
{
69 /* Plugin's interface major version number */
72 /* Plugin's interface minor version number */
77 } __attribute__((packed
));
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,
86 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION
= 5,
89 /* Plugin (user) version */
90 struct __bt_plugin_descriptor_version
{
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
;
102 /* Name of the attribute's type for debug purposes */
103 const char *type_name
;
105 /* Attribute's type */
106 enum __bt_plugin_descriptor_attribute_type type
;
108 /* Attribute's value (depends on attribute's type) */
110 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT */
111 bt_plugin_init_func init
;
113 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT */
114 bt_plugin_exit_func exit
;
116 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR */
119 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE */
122 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
123 const char *description
;
125 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION */
126 struct __bt_plugin_descriptor_version version
;
128 } __attribute__((packed
));
130 /* Component class descriptor (internal use) */
131 struct __bt_plugin_component_class_descriptor
{
133 * Plugin descriptor to which to associate this component
136 const struct __bt_plugin_descriptor
*plugin_descriptor
;
138 /* Component class name */
141 /* Component class type */
142 enum bt_component_class_type type
;
144 /* Mandatory methods (depends on component class type) */
146 /* BT_COMPONENT_CLASS_TYPE_SOURCE */
148 bt_component_class_source_init_iterator_method init_iterator
;
151 /* BT_COMPONENT_CLASS_TYPE_FILTER */
153 bt_component_class_filter_init_iterator_method init_iterator
;
156 /* BT_COMPONENT_CLASS_TYPE_SINK */
158 bt_component_class_sink_consume_method consume
;
161 } __attribute__((packed
));
163 /* Type of a component class attribute (internal use) */
164 enum __bt_plugin_component_class_descriptor_attribute_type
{
165 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION
= 0,
166 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD
= 1,
167 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD
= 2,
168 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD
= 3,
169 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD
= 4,
172 /* Component class attribute (internal use) */
173 struct __bt_plugin_component_class_descriptor_attribute
{
175 * Component class plugin attribute to which to associate this
176 * component class attribute.
178 const struct __bt_plugin_component_class_descriptor
*comp_class_descriptor
;
180 /* Name of the attribute's type for debug purposes */
181 const char *type_name
;
183 /* Attribute's type */
184 enum __bt_plugin_component_class_descriptor_attribute_type type
;
186 /* Attribute's value (depends on attribute's type) */
188 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
189 const char *description
;
191 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD */
192 bt_component_class_init_method init_method
;
194 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD */
195 bt_component_class_destroy_method destroy_method
;
197 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD */
198 bt_component_class_filter_add_iterator_method filter_add_iterator_method
;
200 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */
201 bt_component_class_sink_add_iterator_method sink_add_iterator_method
;
203 } __attribute__((packed
));
206 * Variable attributes for a plugin descriptor pointer to be added to
207 * the plugin descriptor section (internal use).
209 #define __BT_PLUGIN_DESCRIPTOR_ATTRS \
210 __attribute__((section("__bt_plugin_descriptors"), used))
213 * Variable attributes for a plugin attribute pointer to be added to
214 * the plugin attribute section (internal use).
216 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
217 __attribute__((section("__bt_plugin_descriptor_attributes"), used))
220 * Variable attributes for a component class descriptor pointer to be
221 * added to the component class descriptor section (internal use).
223 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
224 __attribute__((section("__bt_plugin_component_class_descriptors"), used))
227 * Variable attributes for a component class descriptor attribute
228 * pointer to be added to the component class descriptor attribute
229 * section (internal use).
231 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
232 __attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used))
235 * Declares a plugin descriptor pointer variable with a custom ID.
237 * _id: ID (any valid C identifier except `auto`).
239 #define BT_PLUGIN_DECLARE(_id) extern struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id
242 * Defines a plugin descriptor with a custom ID.
244 * _id: ID (any valid C identifier except `auto`).
245 * _name: Plugin's name (C string).
247 #define BT_PLUGIN_WITH_ID(_id, _name) \
248 struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \
249 .major = __BT_PLUGIN_VERSION_MAJOR, \
250 .minor = __BT_PLUGIN_VERSION_MINOR, \
253 static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \
254 extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \
255 extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors
258 * Defines a plugin attribute (generic, internal use).
260 * _attr_name: Name of the attribute (C identifier).
261 * _attr_type: Type of the attribute (enum __bt_plugin_descriptor_attribute_type).
262 * _id: Plugin descriptor ID (C identifier).
265 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _x) \
266 static struct __bt_plugin_descriptor_attribute __bt_plugin_descriptor_attribute_##_id##_##_attr_name = { \
267 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
268 .type_name = #_attr_name, \
269 .type = _attr_type, \
270 .value._attr_name = _x, \
272 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; \
273 extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \
274 extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes
277 * Defines a plugin initialization function attribute attached to a
278 * specific plugin descriptor.
280 * _id: Plugin descriptor ID (C identifier).
281 * _x: Initialization function (bt_plugin_init_func).
283 #define BT_PLUGIN_INIT_WITH_ID(_id, _x) \
284 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(init, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT, _id, _x)
287 * Defines a plugin exit function attribute attached to a specific
290 * _id: Plugin descriptor ID (C identifier).
291 * _x: Exit function (bt_plugin_exit_func).
293 #define BT_PLUGIN_EXIT_WITH_ID(_id, _x) \
294 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(exit, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT, _id, _x)
297 * Defines an author attribute attached to a specific plugin descriptor.
299 * _id: Plugin descriptor ID (C identifier).
300 * _x: Author (C string).
302 #define BT_PLUGIN_AUTHOR_WITH_ID(_id, _x) \
303 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(author, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR, _id, _x)
306 * Defines a license attribute attached to a specific plugin descriptor.
308 * _id: Plugin descriptor ID (C identifier).
309 * _x: License (C string).
311 #define BT_PLUGIN_LICENSE_WITH_ID(_id, _x) \
312 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(license, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE, _id, _x)
315 * Defines a description attribute attached to a specific plugin
318 * _id: Plugin descriptor ID (C identifier).
319 * _x: Description (C string).
321 #define BT_PLUGIN_DESCRIPTION_WITH_ID(_id, _x) \
322 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _x)
324 #define __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra) \
325 {.major = _major, .minor = _minor, .patch = _patch, .extra = _extra,}
328 * Defines a version attribute attached to a specific plugin descriptor.
330 * _id: Plugin descriptor ID (C identifier).
331 * _major: Plugin's major version (uint32_t).
332 * _minor: Plugin's minor version (uint32_t).
333 * _patch: Plugin's patch version (uint32_t).
334 * _extra: Plugin's version extra information (C string).
336 #define BT_PLUGIN_VERSION_WITH_ID(_id, _major, _minor, _patch, _extra) \
337 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(version, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION, _id, __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra))
340 * Declaration of start and stop symbols of component class descriptors
343 #define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \
344 extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \
345 extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors
348 * Defines a source component class descriptor with a custom ID.
350 * _id: ID (any valid C identifier except `auto`).
351 * _comp_class_id: Component class ID (C identifier).
352 * _name: Component class name (C string).
353 * _init_iterator_method: Component class's iterator initialization method
354 * (bt_component_class_source_init_iterator_method).
356 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
357 static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
358 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
360 .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
361 .methods.source = { \
362 .init_iterator = _init_iterator_method, \
365 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; \
366 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
369 * Defines a filter component class descriptor with a custom ID.
371 * _id: ID (any valid C identifier except `auto`).
372 * _comp_class_id: Component class ID (C identifier).
373 * _name: Component class name (C string).
374 * _init_iterator_method: Component class's iterator initialization method
375 * (bt_component_class_filter_init_iterator_method).
377 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
378 static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
379 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
381 .type = BT_COMPONENT_CLASS_TYPE_FILTER, \
382 .methods.filter = { \
383 .init_iterator = _init_iterator_method, \
386 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; \
387 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
390 * Defines a sink component class descriptor with a custom ID.
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).
395 * _consume_method: Component class's iterator consume method
396 * (bt_component_class_sink_consume_method).
398 #define BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _consume_method) \
399 static struct __bt_plugin_component_class_descriptor __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id = { \
400 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
402 .type = BT_COMPONENT_CLASS_TYPE_SINK, \
404 .consume = _consume_method, \
407 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; \
408 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
411 * Defines a component class descriptor attribute (generic, internal
414 * _id: Plugin descriptor ID (C identifier).
415 * _comp_class_id: Component class ID (C identifier).
416 * _type: Component class type (`source`, `filter`, or `sink`).
417 * _attr_name: Name of the attribute (C identifier).
418 * _attr_type: Type of the attribute
419 * (enum __bt_plugin_descriptor_attribute_type).
422 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _comp_class_id, _type, _x) \
423 static struct __bt_plugin_component_class_descriptor_attribute __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name = { \
424 .comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \
425 .type_name = #_attr_name, \
426 .type = _attr_type, \
427 .value._attr_name = _x, \
429 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; \
430 extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \
431 extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes
434 * Defines a description attribute attached to a specific source
435 * component class descriptor.
437 * _id: Plugin descriptor ID (C identifier).
438 * _comp_class_id: Component class descriptor ID (C identifier).
439 * _x: Description (C string).
441 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
442 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, source, _x)
445 * Defines a description attribute attached to a specific filter
446 * component class descriptor.
448 * _id: Plugin descriptor ID (C identifier).
449 * _comp_class_id: Component class descriptor ID (C identifier).
450 * _x: Description (C string).
452 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
453 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, filter, _x)
456 * Defines a description attribute attached to a specific sink
457 * component class descriptor.
459 * _id: Plugin descriptor ID (C identifier).
460 * _comp_class_id: Component class descriptor ID (C identifier).
461 * _x: Description (C string).
463 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
464 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, sink, _x)
467 * Defines an initialization method attribute attached to a specific
468 * source component class descriptor.
470 * _id: Plugin descriptor ID (C identifier).
471 * _comp_class_id: Component class descriptor ID (C identifier).
472 * _x: Initialization method (bt_component_class_init_method).
474 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
475 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, source, _x)
478 * Defines an initialization method attribute attached to a specific
479 * filter component class descriptor.
481 * _id: Plugin descriptor ID (C identifier).
482 * _comp_class_id: Component class descriptor ID (C identifier).
483 * _x: Initialization method (bt_component_class_init_method).
485 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
486 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, filter, _x)
489 * Defines an initialization method attribute attached to a specific
490 * sink component class descriptor.
492 * _id: Plugin descriptor ID (C identifier).
493 * _comp_class_id: Component class descriptor ID (C identifier).
494 * _x: Initialization method (bt_component_class_init_method).
496 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
497 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, sink, _x)
500 * Defines a destroy method attribute attached to a specific source
501 * component class descriptor.
503 * _id: Plugin descriptor ID (C identifier).
504 * _comp_class_id: Component class descriptor ID (C identifier).
505 * _x: Destroy method (bt_component_class_destroy_method).
507 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
508 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, source, _x)
511 * Defines a destroy method attribute attached to a specific filter
512 * component class descriptor.
514 * _id: Plugin descriptor ID (C identifier).
515 * _comp_class_id: Component class descriptor ID (C identifier).
516 * _x: Destroy method (bt_component_class_destroy_method).
518 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
519 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, filter, _x)
522 * Defines a destroy method attribute attached to a specific sink
523 * component class descriptor.
525 * _id: Plugin descriptor ID (C identifier).
526 * _comp_class_id: Component class descriptor ID (C identifier).
527 * _x: Destroy method (bt_component_class_destroy_method).
529 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
530 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, sink, _x)
533 * Defines an add iterator method attribute attached to a specific
534 * filter component class descriptor.
536 * _id: Plugin descriptor ID (C identifier).
537 * _comp_class_id: Component class descriptor ID (C identifier).
538 * _x: Add iterator method
539 * (bt_component_class_filter_add_iterator_method).
541 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
542 __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)
545 * Defines an add iterator method attribute attached to a specific
546 * sink component class descriptor.
548 * _id: Plugin descriptor ID (C identifier).
549 * _comp_class_id: Component class descriptor ID (C identifier).
550 * _x: Add iterator method
551 * (bt_component_class_sink_add_iterator_method).
553 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
554 __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)
557 * Defines a plugin descriptor with an automatic ID.
559 * _name: Plugin's name (C string).
561 #define BT_PLUGIN(_name) static BT_PLUGIN_WITH_ID(auto, #_name)
564 * Defines a plugin initialization function attribute attached to the
565 * automatic plugin descriptor.
567 * _x: Initialization function (bt_plugin_init_func).
569 #define BT_PLUGIN_INIT(_x) BT_PLUGIN_INIT_WITH_ID(auto, _x)
572 * Defines a plugin exit function attribute attached to the automatic
575 * _x: Exit function (bt_plugin_exit_func).
577 #define BT_PLUGIN_EXIT(_x) BT_PLUGIN_EXIT_WITH_ID(auto, _x)
580 * Defines an author attribute attached to the automatic plugin
583 * _x: Author (C string).
585 #define BT_PLUGIN_AUTHOR(_x) BT_PLUGIN_AUTHOR_WITH_ID(auto, _x)
588 * Defines a license attribute attached to the automatic plugin
591 * _x: License (C string).
593 #define BT_PLUGIN_LICENSE(_x) BT_PLUGIN_LICENSE_WITH_ID(auto, _x)
596 * Defines a description attribute attached to the automatic plugin
599 * _x: Description (C string).
601 #define BT_PLUGIN_DESCRIPTION(_x) BT_PLUGIN_DESCRIPTION_WITH_ID(auto, _x)
604 * Defines a version attribute attached to the automatic plugin
607 * _major: Plugin's major version (uint32_t).
608 * _minor: Plugin's minor version (uint32_t).
609 * _patch: Plugin's patch version (uint32_t).
610 * _extra: Plugin's version extra information (C string).
612 #define BT_PLUGIN_VERSION(_major, _minor, _patch, _extra) BT_PLUGIN_VERSION_WITH_ID(auto, _major, _minor, _patch, _extra)
615 * Defines a source component class attached to the automatic plugin
616 * descriptor. Its ID is the same as its name, hence its name must be a
617 * C identifier in this version.
619 * _name: Component class name (C identifier).
620 * _init_iterator_method: Component class's iterator initialization method
621 * (bt_component_class_source_init_iterator_method).
623 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _init_iterator_method) \
624 BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
627 * Defines a filter component class attached to the automatic plugin
628 * descriptor. Its ID is the same as its name, hence its name must be a
629 * C identifier in this version.
631 * _name: Component class name (C identifier).
632 * _init_iterator_method: Component class's iterator initialization method
633 * (bt_component_class_filter_init_iterator_method).
635 #define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _init_iterator_method) \
636 BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
639 * Defines a sink component class attached to the automatic plugin
640 * descriptor. Its ID is the same as its name, hence its name must be a
641 * C identifier in this version.
643 * _name: Component class name (C identifier).
644 * _consume_method: Component class's consume method
645 * (bt_component_class_sink_consume_method).
647 #define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method) \
648 BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _consume_method)
651 * Defines a description attribute attached to a source component class
652 * descriptor which is attached to the automatic plugin descriptor.
654 * _name: Component class name (C identifier).
655 * _x: Description (C string).
657 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
658 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
661 * Defines a description attribute attached to a filter component class
662 * descriptor which is attached to the automatic plugin descriptor.
664 * _name: Component class name (C identifier).
665 * _x: Description (C string).
667 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
668 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
671 * Defines a description attribute attached to a sink component class
672 * descriptor which is attached to the automatic plugin descriptor.
674 * _name: Component class name (C identifier).
675 * _x: Description (C string).
677 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
678 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
681 * Defines an initialization method attribute attached to a source
682 * component class descriptor which is attached to the automatic plugin
685 * _name: Component class name (C identifier).
686 * _x: Initialization method (bt_component_class_init_method).
688 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
689 BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
692 * Defines an initialization method attribute attached to a filter
693 * component class descriptor which is attached to the automatic plugin
696 * _name: Component class name (C identifier).
697 * _x: Initialization method (bt_component_class_init_method).
699 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
700 BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
703 * Defines an initialization method attribute attached to a sink
704 * component class descriptor which is attached to the automatic plugin
707 * _name: Component class name (C identifier).
708 * _x: Initialization method (bt_component_class_init_method).
710 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
711 BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
714 * Defines a destroy method attribute attached to a source component
715 * class descriptor which is attached to the automatic plugin
718 * _name: Component class name (C identifier).
719 * _x: Initialization method (bt_component_class_destroy_method).
721 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
722 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
725 * Defines a destroy method attribute attached to a filter component
726 * class descriptor which is attached to the automatic plugin
729 * _name: Component class name (C identifier).
730 * _x: Initialization method (bt_component_class_destroy_method).
732 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
733 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
736 * Defines a destroy method attribute attached to a sink component class
737 * descriptor which is attached to the automatic plugin descriptor.
739 * _name: Component class name (C identifier).
740 * _x: Initialization method (bt_component_class_destroy_method).
742 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
743 BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
746 * Defines an add iterator method attribute attached to a filter
747 * component class descriptor which is attached to the automatic plugin
750 * _name: Component class name (C identifier).
751 * _x: Add iterator method (bt_component_class_filter_add_iterator_method).
753 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
754 BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
757 * Defines an add iterator method attribute attached to a sink
758 * component class descriptor which is attached to the automatic plugin
761 * _name: Component class name (C identifier).
762 * _x: Add iterator method (bt_component_class_sink_add_iterator_method).
764 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
765 BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
771 #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */