Commit | Line | Data |
---|---|---|
33b34c43 PP |
1 | #ifndef BABELTRACE_PLUGIN_PLUGIN_DEV_H |
2 | #define BABELTRACE_PLUGIN_PLUGIN_DEV_H | |
3 | ||
4 | /* | |
6ba0b073 | 5 | * BabelTrace - Babeltrace Plug-in Development API |
33b34c43 PP |
6 | * |
7 | * This is the header that you need to include for the development of | |
8 | * a Babeltrace plug-in. | |
9 | * | |
10 | * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
11 | * Copyright 2017 Philippe Proulx <pproulx@efficios.com> | |
12 | * | |
13 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
14 | * | |
15 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
16 | * of this software and associated documentation files (the "Software"), to deal | |
17 | * in the Software without restriction, including without limitation the rights | |
18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
19 | * copies of the Software, and to permit persons to whom the Software is | |
20 | * furnished to do so, subject to the following conditions: | |
21 | * | |
22 | * The above copyright notice and this permission notice shall be included in | |
23 | * all copies or substantial portions of the Software. | |
24 | * | |
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
31 | * SOFTWARE. | |
32 | */ | |
33 | ||
6ba0b073 | 34 | #include <stdint.h> |
33b34c43 PP |
35 | #include <babeltrace/plugin/plugin.h> |
36 | #include <babeltrace/component/component-class.h> | |
d3e4dcd8 PP |
37 | #include <babeltrace/component/component-class-source.h> |
38 | #include <babeltrace/component/component-class-filter.h> | |
39 | #include <babeltrace/component/component-class-sink.h> | |
33b34c43 PP |
40 | |
41 | #ifdef __cplusplus | |
42 | extern "C" { | |
43 | #endif | |
44 | ||
6ba0b073 PP |
45 | /* |
46 | * Plugin interface's version, not synced with Babeltrace's version | |
47 | * (internal use). | |
48 | */ | |
49 | #define __BT_PLUGIN_VERSION_MAJOR 1 | |
50 | #define __BT_PLUGIN_VERSION_MINOR 0 | |
51 | ||
52 | /* Plugin initialization function type */ | |
33b34c43 PP |
53 | typedef enum bt_plugin_status (*bt_plugin_init_func)( |
54 | struct bt_plugin *plugin); | |
55 | ||
6ba0b073 | 56 | /* Plugin exit function type */ |
33b34c43 PP |
57 | typedef enum bt_plugin_status (*bt_plugin_exit_func)(void); |
58 | ||
6ba0b073 PP |
59 | /* |
60 | * Function to call from a plugin's initialization function to add a | |
61 | * component class to a plugin object. | |
62 | */ | |
33b34c43 PP |
63 | extern enum bt_plugin_status bt_plugin_add_component_class( |
64 | struct bt_plugin *plugin, | |
65 | struct bt_component_class *component_class); | |
66 | ||
6ba0b073 PP |
67 | /* Plugin descriptor: describes a single plugin (internal use) */ |
68 | struct __bt_plugin_descriptor { | |
69 | /* Plugin's interface major version number */ | |
70 | uint32_t major; | |
71 | ||
72 | /* Plugin's interface minor version number */ | |
73 | uint32_t minor; | |
74 | ||
75 | /* Plugin's name */ | |
76 | const char *name; | |
77 | } __attribute__((packed)); | |
78 | ||
79 | /* Type of a plugin attribute (internal use) */ | |
80 | enum __bt_plugin_descriptor_attribute_type { | |
81 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT = 0, | |
82 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT = 1, | |
83 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR = 2, | |
84 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE = 3, | |
85 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 4, | |
b6de043b PP |
86 | BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION = 5, |
87 | }; | |
88 | ||
89 | /* Plugin (user) version */ | |
90 | struct __bt_plugin_descriptor_version { | |
91 | uint32_t major; | |
92 | uint32_t minor; | |
93 | uint32_t patch; | |
94 | const char *extra; | |
6ba0b073 PP |
95 | }; |
96 | ||
97 | /* Plugin attribute (internal use) */ | |
98 | struct __bt_plugin_descriptor_attribute { | |
99 | /* Plugin descriptor to which to associate this attribute */ | |
100 | const struct __bt_plugin_descriptor *plugin_descriptor; | |
101 | ||
6ba0b073 PP |
102 | /* Name of the attribute's type for debug purposes */ |
103 | const char *type_name; | |
104 | ||
857f4dce PP |
105 | /* Attribute's type */ |
106 | enum __bt_plugin_descriptor_attribute_type type; | |
107 | ||
d3e4dcd8 | 108 | /* Attribute's value (depends on attribute's type) */ |
6ba0b073 PP |
109 | union { |
110 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT */ | |
111 | bt_plugin_init_func init; | |
112 | ||
113 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT */ | |
114 | bt_plugin_exit_func exit; | |
115 | ||
116 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR */ | |
117 | const char *author; | |
118 | ||
119 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE */ | |
120 | const char *license; | |
121 | ||
122 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */ | |
123 | const char *description; | |
b6de043b PP |
124 | |
125 | /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION */ | |
126 | struct __bt_plugin_descriptor_version version; | |
6ba0b073 PP |
127 | } value; |
128 | } __attribute__((packed)); | |
129 | ||
130 | /* Component class descriptor (internal use) */ | |
131 | struct __bt_plugin_component_class_descriptor { | |
132 | /* | |
133 | * Plugin descriptor to which to associate this component | |
134 | * class descriptor. | |
135 | */ | |
136 | const struct __bt_plugin_descriptor *plugin_descriptor; | |
137 | ||
6ba0b073 PP |
138 | /* Component class name */ |
139 | const char *name; | |
140 | ||
857f4dce PP |
141 | /* Component class type */ |
142 | enum bt_component_class_type type; | |
143 | ||
d3e4dcd8 PP |
144 | /* Mandatory methods (depends on component class type) */ |
145 | union { | |
146 | /* BT_COMPONENT_CLASS_TYPE_SOURCE */ | |
147 | struct { | |
d3eb6e8f PP |
148 | bt_component_class_notification_iterator_get_method notif_iter_get; |
149 | bt_component_class_notification_iterator_next_method notif_iter_next; | |
d3e4dcd8 PP |
150 | } source; |
151 | ||
152 | /* BT_COMPONENT_CLASS_TYPE_FILTER */ | |
153 | struct { | |
d3eb6e8f PP |
154 | bt_component_class_notification_iterator_get_method notif_iter_get; |
155 | bt_component_class_notification_iterator_next_method notif_iter_next; | |
d3e4dcd8 PP |
156 | } filter; |
157 | ||
158 | /* BT_COMPONENT_CLASS_TYPE_SINK */ | |
159 | struct { | |
160 | bt_component_class_sink_consume_method consume; | |
161 | } sink; | |
162 | } methods; | |
6ba0b073 PP |
163 | } __attribute__((packed)); |
164 | ||
165 | /* Type of a component class attribute (internal use) */ | |
166 | enum __bt_plugin_component_class_descriptor_attribute_type { | |
d3e4dcd8 | 167 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 0, |
279b3f15 PP |
168 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP = 1, |
169 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD = 2, | |
170 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD = 3, | |
a67681c1 | 171 | BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD = 4, |
8463eac2 PP |
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, | |
6ba0b073 PP |
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 | ||
6ba0b073 PP |
187 | /* Name of the attribute's type for debug purposes */ |
188 | const char *type_name; | |
189 | ||
857f4dce PP |
190 | /* Attribute's type */ |
191 | enum __bt_plugin_component_class_descriptor_attribute_type type; | |
192 | ||
d3e4dcd8 | 193 | /* Attribute's value (depends on attribute's type) */ |
6ba0b073 | 194 | union { |
d3e4dcd8 | 195 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */ |
6ba0b073 | 196 | const char *description; |
d3e4dcd8 | 197 | |
279b3f15 PP |
198 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_HELP */ |
199 | const char *help; | |
200 | ||
d3e4dcd8 PP |
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 | ||
a67681c1 PP |
207 | /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD */ |
208 | bt_component_class_query_method query_method; | |
8463eac2 | 209 | |
d3e4dcd8 PP |
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; | |
d3eb6e8f PP |
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; | |
6ba0b073 PP |
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, \ | |
6ba0b073 | 290 | .type_name = #_attr_name, \ |
857f4dce | 291 | .type = _attr_type, \ |
6ba0b073 PP |
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 | ||
b6de043b PP |
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 | ||
6ba0b073 | 361 | /* |
d3e4dcd8 PP |
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. | |
6ba0b073 | 371 | * |
d3eb6e8f PP |
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). | |
6ba0b073 | 379 | */ |
d3eb6e8f | 380 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
d3e4dcd8 | 381 | static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \ |
6ba0b073 | 382 | .plugin_descriptor = &__bt_plugin_descriptor_##_id, \ |
6ba0b073 | 383 | .name = _name, \ |
857f4dce | 384 | .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \ |
d3e4dcd8 | 385 | .methods.source = { \ |
d3eb6e8f PP |
386 | .notif_iter_get = _notif_iter_get_method, \ |
387 | .notif_iter_next = _notif_iter_next_method, \ | |
d3e4dcd8 | 388 | }, \ |
6ba0b073 | 389 | }; \ |
d3e4dcd8 PP |
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). | |
d3eb6e8f PP |
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). | |
d3e4dcd8 | 403 | */ |
d3eb6e8f | 404 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \ |
d3e4dcd8 PP |
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, \ | |
d3e4dcd8 | 407 | .name = _name, \ |
857f4dce | 408 | .type = BT_COMPONENT_CLASS_TYPE_FILTER, \ |
d3e4dcd8 | 409 | .methods.filter = { \ |
d3eb6e8f PP |
410 | .notif_iter_get = _notif_iter_get_method, \ |
411 | .notif_iter_next = _notif_iter_next_method, \ | |
d3e4dcd8 PP |
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, \ | |
d3e4dcd8 | 429 | .name = _name, \ |
857f4dce | 430 | .type = BT_COMPONENT_CLASS_TYPE_SINK, \ |
d3e4dcd8 PP |
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 | |
6ba0b073 PP |
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). | |
d3e4dcd8 | 444 | * _type: Component class type (`source`, `filter`, or `sink`). |
6ba0b073 PP |
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) \ | |
d3e4dcd8 PP |
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, \ | |
6ba0b073 | 453 | .type_name = #_attr_name, \ |
857f4dce | 454 | .type = _attr_type, \ |
d3e4dcd8 | 455 | .value._attr_name = _x, \ |
6ba0b073 | 456 | }; \ |
d3e4dcd8 | 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; \ |
6ba0b073 PP |
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 | /* | |
d3e4dcd8 PP |
462 | * Defines a description attribute attached to a specific source |
463 | * component class descriptor. | |
6ba0b073 PP |
464 | * |
465 | * _id: Plugin descriptor ID (C identifier). | |
466 | * _comp_class_id: Component class descriptor ID (C identifier). | |
6ba0b073 PP |
467 | * _x: Description (C string). |
468 | */ | |
d3e4dcd8 PP |
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 | ||
279b3f15 PP |
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 | ||
d3e4dcd8 PP |
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 | ||
8463eac2 | 593 | /* |
a67681c1 | 594 | * Defines a query method attribute attached to a specific source |
8463eac2 PP |
595 | * component class descriptor. |
596 | * | |
597 | * _id: Plugin descriptor ID (C identifier). | |
598 | * _comp_class_id: Component class descriptor ID (C identifier). | |
a67681c1 | 599 | * _x: Destroy method (bt_component_class_query_method). |
8463eac2 | 600 | */ |
a67681c1 PP |
601 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
602 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(query_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD, _id, _comp_class_id, source, _x) | |
8463eac2 PP |
603 | |
604 | /* | |
a67681c1 | 605 | * Defines a query method attribute attached to a specific filter |
8463eac2 PP |
606 | * component class descriptor. |
607 | * | |
608 | * _id: Plugin descriptor ID (C identifier). | |
609 | * _comp_class_id: Component class descriptor ID (C identifier). | |
a67681c1 | 610 | * _x: Destroy method (bt_component_class_query_method). |
8463eac2 | 611 | */ |
a67681c1 PP |
612 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
613 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(query_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD, _id, _comp_class_id, filter, _x) | |
8463eac2 PP |
614 | |
615 | /* | |
a67681c1 | 616 | * Defines a query method attribute attached to a specific sink |
8463eac2 PP |
617 | * component class descriptor. |
618 | * | |
619 | * _id: Plugin descriptor ID (C identifier). | |
620 | * _comp_class_id: Component class descriptor ID (C identifier). | |
a67681c1 | 621 | * _x: Destroy method (bt_component_class_query_method). |
8463eac2 | 622 | */ |
a67681c1 PP |
623 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(_id, _comp_class_id, _x) \ |
624 | __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(query_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_QUERY_METHOD, _id, _comp_class_id, sink, _x) | |
8463eac2 | 625 | |
d3e4dcd8 PP |
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) | |
6ba0b073 | 649 | |
d3eb6e8f PP |
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 | ||
6ba0b073 PP |
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) | |
b6de043b PP |
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) | |
6ba0b073 PP |
779 | |
780 | /* | |
d3e4dcd8 PP |
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 | * | |
d3eb6e8f PP |
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). | |
d3e4dcd8 | 790 | */ |
d3eb6e8f PP |
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) | |
d3e4dcd8 PP |
793 | |
794 | /* | |
795 | * Defines a filter component class attached to the automatic plugin | |
6ba0b073 PP |
796 | * descriptor. Its ID is the same as its name, hence its name must be a |
797 | * C identifier in this version. | |
798 | * | |
d3eb6e8f PP |
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). | |
6ba0b073 | 804 | */ |
d3eb6e8f PP |
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) | |
6ba0b073 PP |
807 | |
808 | /* | |
d3e4dcd8 PP |
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 | |
6ba0b073 PP |
822 | * descriptor which is attached to the automatic plugin descriptor. |
823 | * | |
d3e4dcd8 PP |
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 | ||
279b3f15 PP |
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 | ||
d3e4dcd8 PP |
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 | ||
8463eac2 | 945 | /* |
a67681c1 | 946 | * Defines a query method attribute attached to a source component |
8463eac2 PP |
947 | * class descriptor which is attached to the automatic plugin |
948 | * descriptor. | |
949 | * | |
950 | * _name: Component class name (C identifier). | |
a67681c1 | 951 | * _x: Initialization method (bt_component_class_query_method). |
8463eac2 | 952 | */ |
a67681c1 PP |
953 | #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_QUERY_METHOD(_name, _x) \ |
954 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(auto, _name, _x) | |
8463eac2 PP |
955 | |
956 | /* | |
a67681c1 | 957 | * Defines a query method attribute attached to a filter component |
8463eac2 PP |
958 | * class descriptor which is attached to the automatic plugin |
959 | * descriptor. | |
960 | * | |
961 | * _name: Component class name (C identifier). | |
a67681c1 | 962 | * _x: Initialization method (bt_component_class_query_method). |
8463eac2 | 963 | */ |
a67681c1 PP |
964 | #define BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(_name, _x) \ |
965 | BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(auto, _name, _x) | |
8463eac2 PP |
966 | |
967 | /* | |
a67681c1 | 968 | * Defines a query method attribute attached to a sink component |
8463eac2 PP |
969 | * class descriptor which is attached to the automatic plugin |
970 | * descriptor. | |
971 | * | |
972 | * _name: Component class name (C identifier). | |
a67681c1 | 973 | * _x: Initialization method (bt_component_class_query_method). |
8463eac2 | 974 | */ |
a67681c1 PP |
975 | #define BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD(_name, _x) \ |
976 | BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD_WITH_ID(auto, _name, _x) | |
8463eac2 | 977 | |
d3e4dcd8 PP |
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). | |
6ba0b073 | 996 | */ |
d3e4dcd8 PP |
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) | |
33b34c43 | 999 | |
d3eb6e8f PP |
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 | ||
33b34c43 PP |
1072 | #ifdef __cplusplus |
1073 | } | |
1074 | #endif | |
1075 | ||
1076 | #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */ |