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