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,
88 /* Plugin attribute (internal use) */
89 struct __bt_plugin_descriptor_attribute
{
90 /* Plugin descriptor to which to associate this attribute */
91 const struct __bt_plugin_descriptor
*plugin_descriptor
;
93 /* Attribute's type */
94 enum __bt_plugin_descriptor_attribute_type type
;
96 /* Name of the attribute's type for debug purposes */
97 const char *type_name
;
99 /* Attribute's value (depends on attribute's type) */
101 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT */
102 bt_plugin_init_func init
;
104 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT */
105 bt_plugin_exit_func exit
;
107 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR */
110 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE */
113 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
114 const char *description
;
116 } __attribute__((packed
));
118 /* Component class descriptor (internal use) */
119 struct __bt_plugin_component_class_descriptor
{
121 * Plugin descriptor to which to associate this component
124 const struct __bt_plugin_descriptor
*plugin_descriptor
;
126 /* Component class type */
127 enum bt_component_class_type type
;
129 /* Component class name */
132 /* Mandatory methods (depends on component class type) */
134 /* BT_COMPONENT_CLASS_TYPE_SOURCE */
136 bt_component_class_source_init_iterator_method init_iterator
;
139 /* BT_COMPONENT_CLASS_TYPE_FILTER */
141 bt_component_class_filter_init_iterator_method init_iterator
;
144 /* BT_COMPONENT_CLASS_TYPE_SINK */
146 bt_component_class_sink_consume_method consume
;
149 } __attribute__((packed
));
151 /* Type of a component class attribute (internal use) */
152 enum __bt_plugin_component_class_descriptor_attribute_type
{
153 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION
= 0,
154 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD
= 1,
155 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD
= 2,
156 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD
= 3,
157 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD
= 4,
160 /* Component class attribute (internal use) */
161 struct __bt_plugin_component_class_descriptor_attribute
{
163 * Component class plugin attribute to which to associate this
164 * component class attribute.
166 const struct __bt_plugin_component_class_descriptor
*comp_class_descriptor
;
168 /* Attribute's type */
169 enum __bt_plugin_component_class_descriptor_attribute_type type
;
171 /* Name of the attribute's type for debug purposes */
172 const char *type_name
;
174 /* Attribute's value (depends on attribute's type) */
176 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
177 const char *description
;
179 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD */
180 bt_component_class_init_method init_method
;
182 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD */
183 bt_component_class_destroy_method destroy_method
;
185 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD */
186 bt_component_class_filter_add_iterator_method filter_add_iterator_method
;
188 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */
189 bt_component_class_sink_add_iterator_method sink_add_iterator_method
;
191 } __attribute__((packed
));
194 * Variable attributes for a plugin descriptor pointer to be added to
195 * the plugin descriptor section (internal use).
197 #define __BT_PLUGIN_DESCRIPTOR_ATTRS \
198 __attribute__((section("__bt_plugin_descriptors"), used))
201 * Variable attributes for a plugin attribute pointer to be added to
202 * the plugin attribute section (internal use).
204 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
205 __attribute__((section("__bt_plugin_descriptor_attributes"), used))
208 * Variable attributes for a component class descriptor pointer to be
209 * added to the component class descriptor section (internal use).
211 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
212 __attribute__((section("__bt_plugin_component_class_descriptors"), used))
215 * Variable attributes for a component class descriptor attribute
216 * pointer to be added to the component class descriptor attribute
217 * section (internal use).
219 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
220 __attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used))
223 * Declares a plugin descriptor pointer variable with a custom ID.
225 * _id: ID (any valid C identifier except `auto`).
227 #define BT_PLUGIN_DECLARE(_id) extern struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id
230 * Defines a plugin descriptor with a custom ID.
232 * _id: ID (any valid C identifier except `auto`).
233 * _name: Plugin's name (C string).
235 #define BT_PLUGIN_WITH_ID(_id, _name) \
236 struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \
237 .major = __BT_PLUGIN_VERSION_MAJOR, \
238 .minor = __BT_PLUGIN_VERSION_MINOR, \
241 static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \
242 extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \
243 extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors
246 * Defines a plugin attribute (generic, internal use).
248 * _attr_name: Name of the attribute (C identifier).
249 * _attr_type: Type of the attribute (enum __bt_plugin_descriptor_attribute_type).
250 * _id: Plugin descriptor ID (C identifier).
253 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _x) \
254 static struct __bt_plugin_descriptor_attribute __bt_plugin_descriptor_attribute_##_id##_##_attr_name = { \
255 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
256 .type = _attr_type, \
257 .type_name = #_attr_name, \
258 .value._attr_name = _x, \
260 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; \
261 extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \
262 extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes
265 * Defines a plugin initialization function attribute attached to a
266 * specific plugin descriptor.
268 * _id: Plugin descriptor ID (C identifier).
269 * _x: Initialization function (bt_plugin_init_func).
271 #define BT_PLUGIN_INIT_WITH_ID(_id, _x) \
272 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(init, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT, _id, _x)
275 * Defines a plugin exit function attribute attached to a specific
278 * _id: Plugin descriptor ID (C identifier).
279 * _x: Exit function (bt_plugin_exit_func).
281 #define BT_PLUGIN_EXIT_WITH_ID(_id, _x) \
282 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(exit, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT, _id, _x)
285 * Defines an author attribute attached to a specific plugin descriptor.
287 * _id: Plugin descriptor ID (C identifier).
288 * _x: Author (C string).
290 #define BT_PLUGIN_AUTHOR_WITH_ID(_id, _x) \
291 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(author, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR, _id, _x)
294 * Defines a license attribute attached to a specific plugin descriptor.
296 * _id: Plugin descriptor ID (C identifier).
297 * _x: License (C string).
299 #define BT_PLUGIN_LICENSE_WITH_ID(_id, _x) \
300 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(license, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE, _id, _x)
303 * Defines a description attribute attached to a specific plugin
306 * _id: Plugin descriptor ID (C identifier).
307 * _x: Description (C string).
309 #define BT_PLUGIN_DESCRIPTION_WITH_ID(_id, _x) \
310 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _x)
313 * Declaration of start and stop symbols of component class descriptors
316 #define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \
317 extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \
318 extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors
321 * Defines a source component class descriptor with a custom ID.
323 * _id: ID (any valid C identifier except `auto`).
324 * _comp_class_id: Component class ID (C identifier).
325 * _name: Component class name (C string).
326 * _init_iterator_method: Component class's iterator initialization method
327 * (bt_component_class_source_init_iterator_method).
329 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
330 static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
331 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
332 .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
334 .methods.source = { \
335 .init_iterator = _init_iterator_method, \
338 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; \
339 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
342 * Defines a filter component class descriptor with a custom ID.
344 * _id: ID (any valid C identifier except `auto`).
345 * _comp_class_id: Component class ID (C identifier).
346 * _name: Component class name (C string).
347 * _init_iterator_method: Component class's iterator initialization method
348 * (bt_component_class_filter_init_iterator_method).
350 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
351 static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
352 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
353 .type = BT_COMPONENT_CLASS_TYPE_FILTER, \
355 .methods.filter = { \
356 .init_iterator = _init_iterator_method, \
359 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; \
360 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
363 * Defines a sink component class descriptor with a custom ID.
365 * _id: ID (any valid C identifier except `auto`).
366 * _comp_class_id: Component class ID (C identifier).
367 * _name: Component class name (C string).
368 * _consume_method: Component class's iterator consume method
369 * (bt_component_class_sink_consume_method).
371 #define BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _consume_method) \
372 static struct __bt_plugin_component_class_descriptor __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id = { \
373 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
374 .type = BT_COMPONENT_CLASS_TYPE_SINK, \
377 .consume = _consume_method, \
380 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; \
381 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
384 * Defines a component class descriptor attribute (generic, internal
387 * _id: Plugin descriptor ID (C identifier).
388 * _comp_class_id: Component class ID (C identifier).
389 * _type: Component class type (`source`, `filter`, or `sink`).
390 * _attr_name: Name of the attribute (C identifier).
391 * _attr_type: Type of the attribute
392 * (enum __bt_plugin_descriptor_attribute_type).
395 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _comp_class_id, _type, _x) \
396 static struct __bt_plugin_component_class_descriptor_attribute __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name = { \
397 .comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \
398 .type = _attr_type, \
399 .type_name = #_attr_name, \
400 .value._attr_name = _x, \
402 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; \
403 extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \
404 extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes
407 * Defines a description attribute attached to a specific source
408 * component class descriptor.
410 * _id: Plugin descriptor ID (C identifier).
411 * _comp_class_id: Component class descriptor ID (C identifier).
412 * _x: Description (C string).
414 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
415 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, source, _x)
418 * Defines a description attribute attached to a specific filter
419 * component class descriptor.
421 * _id: Plugin descriptor ID (C identifier).
422 * _comp_class_id: Component class descriptor ID (C identifier).
423 * _x: Description (C string).
425 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
426 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, filter, _x)
429 * Defines a description attribute attached to a specific sink
430 * component class descriptor.
432 * _id: Plugin descriptor ID (C identifier).
433 * _comp_class_id: Component class descriptor ID (C identifier).
434 * _x: Description (C string).
436 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
437 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, sink, _x)
440 * Defines an initialization method attribute attached to a specific
441 * source component class descriptor.
443 * _id: Plugin descriptor ID (C identifier).
444 * _comp_class_id: Component class descriptor ID (C identifier).
445 * _x: Initialization method (bt_component_class_init_method).
447 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
448 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, source, _x)
451 * Defines an initialization method attribute attached to a specific
452 * filter component class descriptor.
454 * _id: Plugin descriptor ID (C identifier).
455 * _comp_class_id: Component class descriptor ID (C identifier).
456 * _x: Initialization method (bt_component_class_init_method).
458 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
459 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, filter, _x)
462 * Defines an initialization method attribute attached to a specific
463 * sink component class descriptor.
465 * _id: Plugin descriptor ID (C identifier).
466 * _comp_class_id: Component class descriptor ID (C identifier).
467 * _x: Initialization method (bt_component_class_init_method).
469 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
470 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, sink, _x)
473 * Defines a destroy method attribute attached to a specific source
474 * component class descriptor.
476 * _id: Plugin descriptor ID (C identifier).
477 * _comp_class_id: Component class descriptor ID (C identifier).
478 * _x: Destroy method (bt_component_class_destroy_method).
480 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
481 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, source, _x)
484 * Defines a destroy method attribute attached to a specific filter
485 * component class descriptor.
487 * _id: Plugin descriptor ID (C identifier).
488 * _comp_class_id: Component class descriptor ID (C identifier).
489 * _x: Destroy method (bt_component_class_destroy_method).
491 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
492 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, filter, _x)
495 * Defines a destroy method attribute attached to a specific sink
496 * component class descriptor.
498 * _id: Plugin descriptor ID (C identifier).
499 * _comp_class_id: Component class descriptor ID (C identifier).
500 * _x: Destroy method (bt_component_class_destroy_method).
502 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
503 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, sink, _x)
506 * Defines an add iterator method attribute attached to a specific
507 * filter component class descriptor.
509 * _id: Plugin descriptor ID (C identifier).
510 * _comp_class_id: Component class descriptor ID (C identifier).
511 * _x: Add iterator method
512 * (bt_component_class_filter_add_iterator_method).
514 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
515 __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)
518 * Defines an add iterator method attribute attached to a specific
519 * sink component class descriptor.
521 * _id: Plugin descriptor ID (C identifier).
522 * _comp_class_id: Component class descriptor ID (C identifier).
523 * _x: Add iterator method
524 * (bt_component_class_sink_add_iterator_method).
526 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
527 __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)
530 * Defines a plugin descriptor with an automatic ID.
532 * _name: Plugin's name (C string).
534 #define BT_PLUGIN(_name) static BT_PLUGIN_WITH_ID(auto, #_name)
537 * Defines a plugin initialization function attribute attached to the
538 * automatic plugin descriptor.
540 * _x: Initialization function (bt_plugin_init_func).
542 #define BT_PLUGIN_INIT(_x) BT_PLUGIN_INIT_WITH_ID(auto, _x)
545 * Defines a plugin exit function attribute attached to the automatic
548 * _x: Exit function (bt_plugin_exit_func).
550 #define BT_PLUGIN_EXIT(_x) BT_PLUGIN_EXIT_WITH_ID(auto, _x)
553 * Defines an author attribute attached to the automatic plugin
556 * _x: Author (C string).
558 #define BT_PLUGIN_AUTHOR(_x) BT_PLUGIN_AUTHOR_WITH_ID(auto, _x)
561 * Defines a license attribute attached to the automatic plugin
564 * _x: License (C string).
566 #define BT_PLUGIN_LICENSE(_x) BT_PLUGIN_LICENSE_WITH_ID(auto, _x)
569 * Defines a description attribute attached to the automatic plugin
572 * _x: Description (C string).
574 #define BT_PLUGIN_DESCRIPTION(_x) BT_PLUGIN_DESCRIPTION_WITH_ID(auto, _x)
577 * Defines a source component class attached to the automatic plugin
578 * descriptor. Its ID is the same as its name, hence its name must be a
579 * C identifier in this version.
581 * _name: Component class name (C identifier).
582 * _init_iterator_method: Component class's iterator initialization method
583 * (bt_component_class_source_init_iterator_method).
585 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _init_iterator_method) \
586 BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
589 * Defines a filter component class attached to the automatic plugin
590 * descriptor. Its ID is the same as its name, hence its name must be a
591 * C identifier in this version.
593 * _name: Component class name (C identifier).
594 * _init_iterator_method: Component class's iterator initialization method
595 * (bt_component_class_filter_init_iterator_method).
597 #define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _init_iterator_method) \
598 BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
601 * Defines a sink component class attached to the automatic plugin
602 * descriptor. Its ID is the same as its name, hence its name must be a
603 * C identifier in this version.
605 * _name: Component class name (C identifier).
606 * _consume_method: Component class's consume method
607 * (bt_component_class_sink_consume_method).
609 #define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method) \
610 BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _consume_method)
613 * Defines a description attribute attached to a source component class
614 * descriptor which is attached to the automatic plugin descriptor.
616 * _name: Component class name (C identifier).
617 * _x: Description (C string).
619 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
620 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
623 * Defines a description attribute attached to a filter component class
624 * descriptor which is attached to the automatic plugin descriptor.
626 * _name: Component class name (C identifier).
627 * _x: Description (C string).
629 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
630 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
633 * Defines a description attribute attached to a sink component class
634 * descriptor which is attached to the automatic plugin descriptor.
636 * _name: Component class name (C identifier).
637 * _x: Description (C string).
639 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
640 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
643 * Defines an initialization method attribute attached to a source
644 * component class descriptor which is attached to the automatic plugin
647 * _name: Component class name (C identifier).
648 * _x: Initialization method (bt_component_class_init_method).
650 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
651 BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
654 * Defines an initialization method attribute attached to a filter
655 * component class descriptor which is attached to the automatic plugin
658 * _name: Component class name (C identifier).
659 * _x: Initialization method (bt_component_class_init_method).
661 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
662 BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
665 * Defines an initialization method attribute attached to a sink
666 * component class descriptor which is attached to the automatic plugin
669 * _name: Component class name (C identifier).
670 * _x: Initialization method (bt_component_class_init_method).
672 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
673 BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
676 * Defines a destroy method attribute attached to a source component
677 * class descriptor which is attached to the automatic plugin
680 * _name: Component class name (C identifier).
681 * _x: Initialization method (bt_component_class_destroy_method).
683 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
684 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
687 * Defines a destroy method attribute attached to a filter component
688 * class descriptor which is attached to the automatic plugin
691 * _name: Component class name (C identifier).
692 * _x: Initialization method (bt_component_class_destroy_method).
694 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
695 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
698 * Defines a destroy method attribute attached to a sink component class
699 * descriptor which is attached to the automatic plugin descriptor.
701 * _name: Component class name (C identifier).
702 * _x: Initialization method (bt_component_class_destroy_method).
704 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
705 BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
708 * Defines an add iterator method attribute attached to a filter
709 * component class descriptor which is attached to the automatic plugin
712 * _name: Component class name (C identifier).
713 * _x: Add iterator method (bt_component_class_filter_add_iterator_method).
715 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
716 BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
719 * Defines an add iterator method attribute attached to a sink
720 * component class descriptor which is attached to the automatic plugin
723 * _name: Component class name (C identifier).
724 * _x: Add iterator method (bt_component_class_sink_add_iterator_method).
726 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
727 BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
733 #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */