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