| 1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_DEV_H |
| 2 | #define BABELTRACE_PLUGIN_PLUGIN_DEV_H |
| 3 | |
| 4 | /* |
| 5 | * BabelTrace - Babeltrace Plug-in Development API |
| 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 | |
| 34 | #include <stdint.h> |
| 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> |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| 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 */ |
| 53 | typedef enum bt_plugin_status (*bt_plugin_init_func)( |
| 54 | struct bt_plugin *plugin); |
| 55 | |
| 56 | /* Plugin exit function type */ |
| 57 | typedef enum bt_plugin_status (*bt_plugin_exit_func)(void); |
| 58 | |
| 59 | /* |
| 60 | * Function to call from a plugin's initialization function to add a |
| 61 | * component class to a plugin object. |
| 62 | */ |
| 63 | extern enum bt_plugin_status bt_plugin_add_component_class( |
| 64 | struct bt_plugin *plugin, |
| 65 | struct bt_component_class *component_class); |
| 66 | |
| 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, |
| 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; |
| 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 | |
| 102 | /* Name of the attribute's type for debug purposes */ |
| 103 | const char *type_name; |
| 104 | |
| 105 | /* Attribute's type */ |
| 106 | enum __bt_plugin_descriptor_attribute_type type; |
| 107 | |
| 108 | /* Attribute's value (depends on attribute's type) */ |
| 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; |
| 124 | |
| 125 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION */ |
| 126 | struct __bt_plugin_descriptor_version version; |
| 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 | |
| 138 | /* Component class name */ |
| 139 | const char *name; |
| 140 | |
| 141 | /* Component class type */ |
| 142 | enum bt_component_class_type type; |
| 143 | |
| 144 | /* Mandatory methods (depends on component class type) */ |
| 145 | union { |
| 146 | /* BT_COMPONENT_CLASS_TYPE_SOURCE */ |
| 147 | struct { |
| 148 | bt_component_class_notification_iterator_get_method notif_iter_get; |
| 149 | bt_component_class_notification_iterator_next_method notif_iter_next; |
| 150 | } source; |
| 151 | |
| 152 | /* BT_COMPONENT_CLASS_TYPE_FILTER */ |
| 153 | struct { |
| 154 | bt_component_class_notification_iterator_get_method notif_iter_get; |
| 155 | bt_component_class_notification_iterator_next_method notif_iter_next; |
| 156 | } filter; |
| 157 | |
| 158 | /* BT_COMPONENT_CLASS_TYPE_SINK */ |
| 159 | struct { |
| 160 | bt_component_class_sink_consume_method consume; |
| 161 | } sink; |
| 162 | } methods; |
| 163 | } __attribute__((packed)); |
| 164 | |
| 165 | /* Type of a component class attribute (internal use) */ |
| 166 | enum __bt_plugin_component_class_descriptor_attribute_type { |
| 167 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 0, |
| 168 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD = 1, |
| 169 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD = 2, |
| 170 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD = 3, |
| 171 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD = 4, |
| 172 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD = 5, |
| 173 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD = 6, |
| 174 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD = 7, |
| 175 | }; |
| 176 | |
| 177 | /* Component class attribute (internal use) */ |
| 178 | struct __bt_plugin_component_class_descriptor_attribute { |
| 179 | /* |
| 180 | * Component class plugin attribute to which to associate this |
| 181 | * component class attribute. |
| 182 | */ |
| 183 | const struct __bt_plugin_component_class_descriptor *comp_class_descriptor; |
| 184 | |
| 185 | /* Name of the attribute's type for debug purposes */ |
| 186 | const char *type_name; |
| 187 | |
| 188 | /* Attribute's type */ |
| 189 | enum __bt_plugin_component_class_descriptor_attribute_type type; |
| 190 | |
| 191 | /* Attribute's value (depends on attribute's type) */ |
| 192 | union { |
| 193 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */ |
| 194 | const char *description; |
| 195 | |
| 196 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD */ |
| 197 | bt_component_class_init_method init_method; |
| 198 | |
| 199 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD */ |
| 200 | bt_component_class_destroy_method destroy_method; |
| 201 | |
| 202 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD */ |
| 203 | bt_component_class_filter_add_iterator_method filter_add_iterator_method; |
| 204 | |
| 205 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */ |
| 206 | bt_component_class_sink_add_iterator_method sink_add_iterator_method; |
| 207 | |
| 208 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD */ |
| 209 | bt_component_class_notification_iterator_init_method notif_iter_init_method; |
| 210 | |
| 211 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD */ |
| 212 | bt_component_class_notification_iterator_destroy_method notif_iter_destroy_method; |
| 213 | |
| 214 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD */ |
| 215 | bt_component_class_notification_iterator_seek_time_method notif_iter_seek_time_method; |
| 216 | } value; |
| 217 | } __attribute__((packed)); |
| 218 | |
| 219 | /* |
| 220 | * Variable attributes for a plugin descriptor pointer to be added to |
| 221 | * the plugin descriptor section (internal use). |
| 222 | */ |
| 223 | #define __BT_PLUGIN_DESCRIPTOR_ATTRS \ |
| 224 | __attribute__((section("__bt_plugin_descriptors"), used)) |
| 225 | |
| 226 | /* |
| 227 | * Variable attributes for a plugin attribute pointer to be added to |
| 228 | * the plugin attribute section (internal use). |
| 229 | */ |
| 230 | #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \ |
| 231 | __attribute__((section("__bt_plugin_descriptor_attributes"), used)) |
| 232 | |
| 233 | /* |
| 234 | * Variable attributes for a component class descriptor pointer to be |
| 235 | * added to the component class descriptor section (internal use). |
| 236 | */ |
| 237 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \ |
| 238 | __attribute__((section("__bt_plugin_component_class_descriptors"), used)) |
| 239 | |
| 240 | /* |
| 241 | * Variable attributes for a component class descriptor attribute |
| 242 | * pointer to be added to the component class descriptor attribute |
| 243 | * section (internal use). |
| 244 | */ |
| 245 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \ |
| 246 | __attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used)) |
| 247 | |
| 248 | /* |
| 249 | * Declares a plugin descriptor pointer variable with a custom ID. |
| 250 | * |
| 251 | * _id: ID (any valid C identifier except `auto`). |
| 252 | */ |
| 253 | #define BT_PLUGIN_DECLARE(_id) extern struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id |
| 254 | |
| 255 | /* |
| 256 | * Defines a plugin descriptor with a custom ID. |
| 257 | * |
| 258 | * _id: ID (any valid C identifier except `auto`). |
| 259 | * _name: Plugin's name (C string). |
| 260 | */ |
| 261 | #define BT_PLUGIN_WITH_ID(_id, _name) \ |
| 262 | struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \ |
| 263 | .major = __BT_PLUGIN_VERSION_MAJOR, \ |
| 264 | .minor = __BT_PLUGIN_VERSION_MINOR, \ |
| 265 | .name = _name, \ |
| 266 | }; \ |
| 267 | static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \ |
| 268 | extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \ |
| 269 | extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors |
| 270 | |
| 271 | /* |
| 272 | * Defines a plugin attribute (generic, internal use). |
| 273 | * |
| 274 | * _attr_name: Name of the attribute (C identifier). |
| 275 | * _attr_type: Type of the attribute (enum __bt_plugin_descriptor_attribute_type). |
| 276 | * _id: Plugin descriptor ID (C identifier). |
| 277 | * _x: Value. |
| 278 | */ |
| 279 | #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _x) \ |
| 280 | static struct __bt_plugin_descriptor_attribute __bt_plugin_descriptor_attribute_##_id##_##_attr_name = { \ |
| 281 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
| 282 | .type_name = #_attr_name, \ |
| 283 | .type = _attr_type, \ |
| 284 | .value._attr_name = _x, \ |
| 285 | }; \ |
| 286 | 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; \ |
| 287 | extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \ |
| 288 | extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes |
| 289 | |
| 290 | /* |
| 291 | * Defines a plugin initialization function attribute attached to a |
| 292 | * specific plugin descriptor. |
| 293 | * |
| 294 | * _id: Plugin descriptor ID (C identifier). |
| 295 | * _x: Initialization function (bt_plugin_init_func). |
| 296 | */ |
| 297 | #define BT_PLUGIN_INIT_WITH_ID(_id, _x) \ |
| 298 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(init, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT, _id, _x) |
| 299 | |
| 300 | /* |
| 301 | * Defines a plugin exit function attribute attached to a specific |
| 302 | * plugin descriptor. |
| 303 | * |
| 304 | * _id: Plugin descriptor ID (C identifier). |
| 305 | * _x: Exit function (bt_plugin_exit_func). |
| 306 | */ |
| 307 | #define BT_PLUGIN_EXIT_WITH_ID(_id, _x) \ |
| 308 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(exit, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT, _id, _x) |
| 309 | |
| 310 | /* |
| 311 | * Defines an author attribute attached to a specific plugin descriptor. |
| 312 | * |
| 313 | * _id: Plugin descriptor ID (C identifier). |
| 314 | * _x: Author (C string). |
| 315 | */ |
| 316 | #define BT_PLUGIN_AUTHOR_WITH_ID(_id, _x) \ |
| 317 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(author, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR, _id, _x) |
| 318 | |
| 319 | /* |
| 320 | * Defines a license attribute attached to a specific plugin descriptor. |
| 321 | * |
| 322 | * _id: Plugin descriptor ID (C identifier). |
| 323 | * _x: License (C string). |
| 324 | */ |
| 325 | #define BT_PLUGIN_LICENSE_WITH_ID(_id, _x) \ |
| 326 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(license, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE, _id, _x) |
| 327 | |
| 328 | /* |
| 329 | * Defines a description attribute attached to a specific plugin |
| 330 | * descriptor. |
| 331 | * |
| 332 | * _id: Plugin descriptor ID (C identifier). |
| 333 | * _x: Description (C string). |
| 334 | */ |
| 335 | #define BT_PLUGIN_DESCRIPTION_WITH_ID(_id, _x) \ |
| 336 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _x) |
| 337 | |
| 338 | #define __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra) \ |
| 339 | {.major = _major, .minor = _minor, .patch = _patch, .extra = _extra,} |
| 340 | |
| 341 | /* |
| 342 | * Defines a version attribute attached to a specific plugin descriptor. |
| 343 | * |
| 344 | * _id: Plugin descriptor ID (C identifier). |
| 345 | * _major: Plugin's major version (uint32_t). |
| 346 | * _minor: Plugin's minor version (uint32_t). |
| 347 | * _patch: Plugin's patch version (uint32_t). |
| 348 | * _extra: Plugin's version extra information (C string). |
| 349 | */ |
| 350 | #define BT_PLUGIN_VERSION_WITH_ID(_id, _major, _minor, _patch, _extra) \ |
| 351 | __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(version, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION, _id, __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra)) |
| 352 | |
| 353 | /* |
| 354 | * Declaration of start and stop symbols of component class descriptors |
| 355 | * section. |
| 356 | */ |
| 357 | #define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \ |
| 358 | extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \ |
| 359 | extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors |
| 360 | |
| 361 | /* |
| 362 | * Defines a source component class descriptor with a custom ID. |
| 363 | * |
| 364 | * _id: ID (any valid C identifier except `auto`). |
| 365 | * _comp_class_id: Component class ID (C identifier). |
| 366 | * _name: Component class name (C string). |
| 367 | * _notif_iter_get_method: Component class's iterator get method |
| 368 | * (bt_component_class_notification_iterator_get_method). |
| 369 | * _notif_iter_next_method: Component class's iterator next method |
| 370 | * (bt_component_class_notification_iterator_next_method). |
| 371 | */ |
| 372 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
| 373 | static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \ |
| 374 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
| 375 | .name = _name, \ |
| 376 | .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \ |
| 377 | .methods.source = { \ |
| 378 | .notif_iter_get = _notif_iter_get_method, \ |
| 379 | .notif_iter_next = _notif_iter_next_method, \ |
| 380 | }, \ |
| 381 | }; \ |
| 382 | 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; \ |
| 383 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP |
| 384 | |
| 385 | /* |
| 386 | * Defines a filter component class descriptor with a custom ID. |
| 387 | * |
| 388 | * _id: ID (any valid C identifier except `auto`). |
| 389 | * _comp_class_id: Component class ID (C identifier). |
| 390 | * _name: Component class name (C string). |
| 391 | * _notif_iter_get_method: Component class's iterator get method |
| 392 | * (bt_component_class_notification_iterator_get_method). |
| 393 | * _notif_iter_next_method: Component class's iterator next method |
| 394 | * (bt_component_class_notification_iterator_next_method). |
| 395 | */ |
| 396 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
| 397 | static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \ |
| 398 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
| 399 | .name = _name, \ |
| 400 | .type = BT_COMPONENT_CLASS_TYPE_FILTER, \ |
| 401 | .methods.filter = { \ |
| 402 | .notif_iter_get = _notif_iter_get_method, \ |
| 403 | .notif_iter_next = _notif_iter_next_method, \ |
| 404 | }, \ |
| 405 | }; \ |
| 406 | 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; \ |
| 407 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP |
| 408 | |
| 409 | /* |
| 410 | * Defines a sink component class descriptor with a custom ID. |
| 411 | * |
| 412 | * _id: ID (any valid C identifier except `auto`). |
| 413 | * _comp_class_id: Component class ID (C identifier). |
| 414 | * _name: Component class name (C string). |
| 415 | * _consume_method: Component class's iterator consume method |
| 416 | * (bt_component_class_sink_consume_method). |
| 417 | */ |
| 418 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _consume_method) \ |
| 419 | static struct __bt_plugin_component_class_descriptor __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id = { \ |
| 420 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
| 421 | .name = _name, \ |
| 422 | .type = BT_COMPONENT_CLASS_TYPE_SINK, \ |
| 423 | .methods.sink = { \ |
| 424 | .consume = _consume_method, \ |
| 425 | }, \ |
| 426 | }; \ |
| 427 | 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; \ |
| 428 | __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP |
| 429 | |
| 430 | /* |
| 431 | * Defines a component class descriptor attribute (generic, internal |
| 432 | * use). |
| 433 | * |
| 434 | * _id: Plugin descriptor ID (C identifier). |
| 435 | * _comp_class_id: Component class ID (C identifier). |
| 436 | * _type: Component class type (`source`, `filter`, or `sink`). |
| 437 | * _attr_name: Name of the attribute (C identifier). |
| 438 | * _attr_type: Type of the attribute |
| 439 | * (enum __bt_plugin_descriptor_attribute_type). |
| 440 | * _x: Value. |
| 441 | */ |
| 442 | #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _comp_class_id, _type, _x) \ |
| 443 | static struct __bt_plugin_component_class_descriptor_attribute __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name = { \ |
| 444 | .comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \ |
| 445 | .type_name = #_attr_name, \ |
| 446 | .type = _attr_type, \ |
| 447 | .value._attr_name = _x, \ |
| 448 | }; \ |
| 449 | 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; \ |
| 450 | extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \ |
| 451 | extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes |
| 452 | |
| 453 | /* |
| 454 | * Defines a description attribute attached to a specific source |
| 455 | * component class descriptor. |
| 456 | * |
| 457 | * _id: Plugin descriptor ID (C identifier). |
| 458 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 459 | * _x: Description (C string). |
| 460 | */ |
| 461 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ |
| 462 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, source, _x) |
| 463 | |
| 464 | /* |
| 465 | * Defines a description attribute attached to a specific filter |
| 466 | * component class descriptor. |
| 467 | * |
| 468 | * _id: Plugin descriptor ID (C identifier). |
| 469 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 470 | * _x: Description (C string). |
| 471 | */ |
| 472 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ |
| 473 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, filter, _x) |
| 474 | |
| 475 | /* |
| 476 | * Defines a description attribute attached to a specific sink |
| 477 | * component class descriptor. |
| 478 | * |
| 479 | * _id: Plugin descriptor ID (C identifier). |
| 480 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 481 | * _x: Description (C string). |
| 482 | */ |
| 483 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \ |
| 484 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, sink, _x) |
| 485 | |
| 486 | /* |
| 487 | * Defines an initialization method attribute attached to a specific |
| 488 | * source component class descriptor. |
| 489 | * |
| 490 | * _id: Plugin descriptor ID (C identifier). |
| 491 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 492 | * _x: Initialization method (bt_component_class_init_method). |
| 493 | */ |
| 494 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 495 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, source, _x) |
| 496 | |
| 497 | /* |
| 498 | * Defines an initialization method attribute attached to a specific |
| 499 | * filter component class descriptor. |
| 500 | * |
| 501 | * _id: Plugin descriptor ID (C identifier). |
| 502 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 503 | * _x: Initialization method (bt_component_class_init_method). |
| 504 | */ |
| 505 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 506 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, filter, _x) |
| 507 | |
| 508 | /* |
| 509 | * Defines an initialization method attribute attached to a specific |
| 510 | * sink component class descriptor. |
| 511 | * |
| 512 | * _id: Plugin descriptor ID (C identifier). |
| 513 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 514 | * _x: Initialization method (bt_component_class_init_method). |
| 515 | */ |
| 516 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 517 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, sink, _x) |
| 518 | |
| 519 | /* |
| 520 | * Defines a destroy method attribute attached to a specific source |
| 521 | * component class descriptor. |
| 522 | * |
| 523 | * _id: Plugin descriptor ID (C identifier). |
| 524 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 525 | * _x: Destroy method (bt_component_class_destroy_method). |
| 526 | */ |
| 527 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 528 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, source, _x) |
| 529 | |
| 530 | /* |
| 531 | * Defines a destroy method attribute attached to a specific filter |
| 532 | * component class descriptor. |
| 533 | * |
| 534 | * _id: Plugin descriptor ID (C identifier). |
| 535 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 536 | * _x: Destroy method (bt_component_class_destroy_method). |
| 537 | */ |
| 538 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 539 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, filter, _x) |
| 540 | |
| 541 | /* |
| 542 | * Defines a destroy method attribute attached to a specific sink |
| 543 | * component class descriptor. |
| 544 | * |
| 545 | * _id: Plugin descriptor ID (C identifier). |
| 546 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 547 | * _x: Destroy method (bt_component_class_destroy_method). |
| 548 | */ |
| 549 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 550 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, sink, _x) |
| 551 | |
| 552 | /* |
| 553 | * Defines an add iterator method attribute attached to a specific |
| 554 | * filter component class descriptor. |
| 555 | * |
| 556 | * _id: Plugin descriptor ID (C identifier). |
| 557 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 558 | * _x: Add iterator method |
| 559 | * (bt_component_class_filter_add_iterator_method). |
| 560 | */ |
| 561 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 562 | __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) |
| 563 | |
| 564 | /* |
| 565 | * Defines an add iterator method attribute attached to a specific |
| 566 | * sink component class descriptor. |
| 567 | * |
| 568 | * _id: Plugin descriptor ID (C identifier). |
| 569 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 570 | * _x: Add iterator method |
| 571 | * (bt_component_class_sink_add_iterator_method). |
| 572 | */ |
| 573 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 574 | __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) |
| 575 | |
| 576 | /* |
| 577 | * Defines an iterator initialization method attribute attached to a |
| 578 | * specific source component class descriptor. |
| 579 | * |
| 580 | * _id: Plugin descriptor ID (C identifier). |
| 581 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 582 | * _x: Iterator initialization method |
| 583 | * (bt_component_class_notification_iterator_init_method). |
| 584 | */ |
| 585 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 586 | __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) |
| 587 | |
| 588 | /* |
| 589 | * Defines an iterator destroy method attribute attached to a specific |
| 590 | * source component class descriptor. |
| 591 | * |
| 592 | * _id: Plugin descriptor ID (C identifier). |
| 593 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 594 | * _x: Iterator destroy method |
| 595 | * (bt_component_class_notification_iterator_destroy_method). |
| 596 | */ |
| 597 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 598 | __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) |
| 599 | |
| 600 | /* |
| 601 | * Defines an iterator seek time method attribute attached to a specific |
| 602 | * source component class descriptor. |
| 603 | * |
| 604 | * _id: Plugin descriptor ID (C identifier). |
| 605 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 606 | * _x: Iterator seek time method |
| 607 | * (bt_component_class_notification_iterator_seek_time_method). |
| 608 | */ |
| 609 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 610 | __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) |
| 611 | |
| 612 | /* |
| 613 | * Defines an iterator initialization method attribute attached to a |
| 614 | * specific filter component class descriptor. |
| 615 | * |
| 616 | * _id: Plugin descriptor ID (C identifier). |
| 617 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 618 | * _x: Iterator initialization method |
| 619 | * (bt_component_class_notification_iterator_init_method). |
| 620 | */ |
| 621 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 622 | __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) |
| 623 | |
| 624 | /* |
| 625 | * Defines an iterator destroy method attribute attached to a specific |
| 626 | * filter component class descriptor. |
| 627 | * |
| 628 | * _id: Plugin descriptor ID (C identifier). |
| 629 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 630 | * _x: Iterator destroy method |
| 631 | * (bt_component_class_notification_iterator_destroy_method). |
| 632 | */ |
| 633 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 634 | __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) |
| 635 | |
| 636 | /* |
| 637 | * Defines an iterator seek time method attribute attached to a specific |
| 638 | * filter component class descriptor. |
| 639 | * |
| 640 | * _id: Plugin descriptor ID (C identifier). |
| 641 | * _comp_class_id: Component class descriptor ID (C identifier). |
| 642 | * _x: Iterator seek time method |
| 643 | * (bt_component_class_notification_iterator_seek_time_method). |
| 644 | */ |
| 645 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
| 646 | __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) |
| 647 | |
| 648 | /* |
| 649 | * Defines a plugin descriptor with an automatic ID. |
| 650 | * |
| 651 | * _name: Plugin's name (C string). |
| 652 | */ |
| 653 | #define BT_PLUGIN(_name) static BT_PLUGIN_WITH_ID(auto, #_name) |
| 654 | |
| 655 | /* |
| 656 | * Defines a plugin initialization function attribute attached to the |
| 657 | * automatic plugin descriptor. |
| 658 | * |
| 659 | * _x: Initialization function (bt_plugin_init_func). |
| 660 | */ |
| 661 | #define BT_PLUGIN_INIT(_x) BT_PLUGIN_INIT_WITH_ID(auto, _x) |
| 662 | |
| 663 | /* |
| 664 | * Defines a plugin exit function attribute attached to the automatic |
| 665 | * plugin descriptor. |
| 666 | * |
| 667 | * _x: Exit function (bt_plugin_exit_func). |
| 668 | */ |
| 669 | #define BT_PLUGIN_EXIT(_x) BT_PLUGIN_EXIT_WITH_ID(auto, _x) |
| 670 | |
| 671 | /* |
| 672 | * Defines an author attribute attached to the automatic plugin |
| 673 | * descriptor. |
| 674 | * |
| 675 | * _x: Author (C string). |
| 676 | */ |
| 677 | #define BT_PLUGIN_AUTHOR(_x) BT_PLUGIN_AUTHOR_WITH_ID(auto, _x) |
| 678 | |
| 679 | /* |
| 680 | * Defines a license attribute attached to the automatic plugin |
| 681 | * descriptor. |
| 682 | * |
| 683 | * _x: License (C string). |
| 684 | */ |
| 685 | #define BT_PLUGIN_LICENSE(_x) BT_PLUGIN_LICENSE_WITH_ID(auto, _x) |
| 686 | |
| 687 | /* |
| 688 | * Defines a description attribute attached to the automatic plugin |
| 689 | * descriptor. |
| 690 | * |
| 691 | * _x: Description (C string). |
| 692 | */ |
| 693 | #define BT_PLUGIN_DESCRIPTION(_x) BT_PLUGIN_DESCRIPTION_WITH_ID(auto, _x) |
| 694 | |
| 695 | /* |
| 696 | * Defines a version attribute attached to the automatic plugin |
| 697 | * descriptor. |
| 698 | * |
| 699 | * _major: Plugin's major version (uint32_t). |
| 700 | * _minor: Plugin's minor version (uint32_t). |
| 701 | * _patch: Plugin's patch version (uint32_t). |
| 702 | * _extra: Plugin's version extra information (C string). |
| 703 | */ |
| 704 | #define BT_PLUGIN_VERSION(_major, _minor, _patch, _extra) BT_PLUGIN_VERSION_WITH_ID(auto, _major, _minor, _patch, _extra) |
| 705 | |
| 706 | /* |
| 707 | * Defines a source component class attached to the automatic plugin |
| 708 | * descriptor. Its ID is the same as its name, hence its name must be a |
| 709 | * C identifier in this version. |
| 710 | * |
| 711 | * _name: Component class name (C identifier). |
| 712 | * _notif_iter_get_method: Component class's iterator get method |
| 713 | * (bt_component_class_notification_iterator_get_method). |
| 714 | * _notif_iter_next_method: Component class's iterator next method |
| 715 | * (bt_component_class_notification_iterator_next_method). |
| 716 | */ |
| 717 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \ |
| 718 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method) |
| 719 | |
| 720 | /* |
| 721 | * Defines a filter component class attached to the automatic plugin |
| 722 | * descriptor. Its ID is the same as its name, hence its name must be a |
| 723 | * C identifier in this version. |
| 724 | * |
| 725 | * _name: Component class name (C identifier). |
| 726 | * _notif_iter_get_method: Component class's iterator get method |
| 727 | * (bt_component_class_notification_iterator_get_method). |
| 728 | * _notif_iter_next_method: Component class's iterator next method |
| 729 | * (bt_component_class_notification_iterator_next_method). |
| 730 | */ |
| 731 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \ |
| 732 | BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method) |
| 733 | |
| 734 | /* |
| 735 | * Defines a sink component class attached to the automatic plugin |
| 736 | * descriptor. Its ID is the same as its name, hence its name must be a |
| 737 | * C identifier in this version. |
| 738 | * |
| 739 | * _name: Component class name (C identifier). |
| 740 | * _consume_method: Component class's consume method |
| 741 | * (bt_component_class_sink_consume_method). |
| 742 | */ |
| 743 | #define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method) \ |
| 744 | BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _consume_method) |
| 745 | |
| 746 | /* |
| 747 | * Defines a description attribute attached to a source component class |
| 748 | * descriptor which is attached to the automatic plugin descriptor. |
| 749 | * |
| 750 | * _name: Component class name (C identifier). |
| 751 | * _x: Description (C string). |
| 752 | */ |
| 753 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ |
| 754 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) |
| 755 | |
| 756 | /* |
| 757 | * Defines a description attribute attached to a filter component class |
| 758 | * descriptor which is attached to the automatic plugin descriptor. |
| 759 | * |
| 760 | * _name: Component class name (C identifier). |
| 761 | * _x: Description (C string). |
| 762 | */ |
| 763 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ |
| 764 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) |
| 765 | |
| 766 | /* |
| 767 | * Defines a description attribute attached to a sink component class |
| 768 | * descriptor which is attached to the automatic plugin descriptor. |
| 769 | * |
| 770 | * _name: Component class name (C identifier). |
| 771 | * _x: Description (C string). |
| 772 | */ |
| 773 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _x) \ |
| 774 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x) |
| 775 | |
| 776 | /* |
| 777 | * Defines an initialization method attribute attached to a source |
| 778 | * component class descriptor which is attached to the automatic plugin |
| 779 | * descriptor. |
| 780 | * |
| 781 | * _name: Component class name (C identifier). |
| 782 | * _x: Initialization method (bt_component_class_init_method). |
| 783 | */ |
| 784 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ |
| 785 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) |
| 786 | |
| 787 | /* |
| 788 | * Defines an initialization method attribute attached to a filter |
| 789 | * component class descriptor which is attached to the automatic plugin |
| 790 | * descriptor. |
| 791 | * |
| 792 | * _name: Component class name (C identifier). |
| 793 | * _x: Initialization method (bt_component_class_init_method). |
| 794 | */ |
| 795 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ |
| 796 | BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) |
| 797 | |
| 798 | /* |
| 799 | * Defines an initialization method attribute attached to a sink |
| 800 | * component class descriptor which is attached to the automatic plugin |
| 801 | * descriptor. |
| 802 | * |
| 803 | * _name: Component class name (C identifier). |
| 804 | * _x: Initialization method (bt_component_class_init_method). |
| 805 | */ |
| 806 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(_name, _x) \ |
| 807 | BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x) |
| 808 | |
| 809 | /* |
| 810 | * Defines a destroy method attribute attached to a source component |
| 811 | * class descriptor which is attached to the automatic plugin |
| 812 | * descriptor. |
| 813 | * |
| 814 | * _name: Component class name (C identifier). |
| 815 | * _x: Initialization method (bt_component_class_destroy_method). |
| 816 | */ |
| 817 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ |
| 818 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) |
| 819 | |
| 820 | /* |
| 821 | * Defines a destroy method attribute attached to a filter component |
| 822 | * class descriptor which is attached to the automatic plugin |
| 823 | * descriptor. |
| 824 | * |
| 825 | * _name: Component class name (C identifier). |
| 826 | * _x: Initialization method (bt_component_class_destroy_method). |
| 827 | */ |
| 828 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ |
| 829 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) |
| 830 | |
| 831 | /* |
| 832 | * Defines a destroy method attribute attached to a sink component class |
| 833 | * descriptor which is attached to the automatic plugin descriptor. |
| 834 | * |
| 835 | * _name: Component class name (C identifier). |
| 836 | * _x: Initialization method (bt_component_class_destroy_method). |
| 837 | */ |
| 838 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \ |
| 839 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x) |
| 840 | |
| 841 | /* |
| 842 | * Defines an add iterator method attribute attached to a filter |
| 843 | * component class descriptor which is attached to the automatic plugin |
| 844 | * descriptor. |
| 845 | * |
| 846 | * _name: Component class name (C identifier). |
| 847 | * _x: Add iterator method (bt_component_class_filter_add_iterator_method). |
| 848 | */ |
| 849 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \ |
| 850 | BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x) |
| 851 | |
| 852 | /* |
| 853 | * Defines an add iterator method attribute attached to a sink |
| 854 | * component class descriptor which is attached to the automatic plugin |
| 855 | * descriptor. |
| 856 | * |
| 857 | * _name: Component class name (C identifier). |
| 858 | * _x: Add iterator method (bt_component_class_sink_add_iterator_method). |
| 859 | */ |
| 860 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \ |
| 861 | BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x) |
| 862 | |
| 863 | /* |
| 864 | * Defines an iterator initialization method attribute attached to a |
| 865 | * source component class descriptor which is attached to the automatic |
| 866 | * plugin descriptor. |
| 867 | * |
| 868 | * _name: Component class name (C identifier). |
| 869 | * _x: Iterator initialization method |
| 870 | * (bt_component_class_notification_iterator_init_method). |
| 871 | */ |
| 872 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \ |
| 873 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x) |
| 874 | |
| 875 | /* |
| 876 | * Defines an iterator destroy method attribute attached to a source |
| 877 | * component class descriptor which is attached to the automatic plugin |
| 878 | * descriptor. |
| 879 | * |
| 880 | * _name: Component class name (C identifier). |
| 881 | * _x: Iterator destroy method |
| 882 | * (bt_component_class_notification_iterator_destroy_method). |
| 883 | */ |
| 884 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \ |
| 885 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x) |
| 886 | |
| 887 | /* |
| 888 | * Defines an iterator seek time method attribute attached to a source |
| 889 | * component class descriptor which is attached to the automatic plugin |
| 890 | * descriptor. |
| 891 | * |
| 892 | * _name: Component class name (C identifier). |
| 893 | * _x: Iterator seek time method |
| 894 | * (bt_component_class_notification_iterator_seek_time_method). |
| 895 | */ |
| 896 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ |
| 897 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) |
| 898 | |
| 899 | /* |
| 900 | * Defines an iterator initialization method attribute attached to a |
| 901 | * filter component class descriptor which is attached to the automatic |
| 902 | * plugin descriptor. |
| 903 | * |
| 904 | * _name: Component class name (C identifier). |
| 905 | * _x: Iterator initialization method |
| 906 | * (bt_component_class_notification_iterator_init_method). |
| 907 | */ |
| 908 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \ |
| 909 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x) |
| 910 | |
| 911 | /* |
| 912 | * Defines an iterator destroy method attribute attached to a filter |
| 913 | * component class descriptor which is attached to the automatic plugin |
| 914 | * descriptor. |
| 915 | * |
| 916 | * _name: Component class name (C identifier). |
| 917 | * _x: Iterator destroy method |
| 918 | * (bt_component_class_notification_iterator_destroy_method). |
| 919 | */ |
| 920 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \ |
| 921 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x) |
| 922 | |
| 923 | /* |
| 924 | * Defines an iterator seek time method attribute attached to a filter |
| 925 | * component class descriptor which is attached to the automatic plugin |
| 926 | * descriptor. |
| 927 | * |
| 928 | * _name: Component class name (C identifier). |
| 929 | * _x: Iterator seek time method |
| 930 | * (bt_component_class_notification_iterator_seek_time_method). |
| 931 | */ |
| 932 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ |
| 933 | BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) |
| 934 | |
| 935 | #ifdef __cplusplus |
| 936 | } |
| 937 | #endif |
| 938 | |
| 939 | #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */ |