1 #ifndef BABELTRACE_PLUGIN_SYSTEM_H
2 #define BABELTRACE_PLUGIN_SYSTEM_H
5 * BabelTrace - Babeltrace Plug-in System Interface
7 * This interface is provided for plug-ins to use the Babeltrace
8 * plug-in system facilities.
10 * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
12 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this software and associated documentation files (the "Software"), to deal
16 * in the Software without restriction, including without limitation the rights
17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 * copies of the Software, and to permit persons to whom the Software is
19 * furnished to do so, subject to the following conditions:
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #include <babeltrace/objects.h>
42 typedef void (*bt_plugin_destroy_cb
)(struct bt_plugin
*);
47 typedef void (*bt_plugin_set_error_stream_cb
)(struct bt_plugin
*,
51 * Get a plug-in's private (implementation) data.
53 * @param plugin Plug-in of which to get the private data
54 * @returns Plug-in private data
56 extern void *bt_plugin_get_private_data(struct bt_plugin
*plugin
);
59 * Set a callback permiting the registration of an error stream.
61 * @param plugin Plug-in to which the callback should be registered
62 * @param cb Error stream registration callback
64 extern int bt_plugin_set_error_stream_cb(struct bt_plugin
*plugin
,
65 bt_plugin_set_error_stream_cb cb
);
67 /* Plug-in initialization functions */
69 * Allocate a source plug-in.
71 * @param name Plug-in instance name (will be copied)
72 * @param private_data Private plug-in implementation data
73 * @param destroy_cb Plug-in private data clean-up callback
74 * @param iterator_create_cb Iterator creation callback
75 * @returns A source plug-in instance
77 extern struct bt_plugin
*bt_plugin_source_create(const char *name
,
78 void *private_data
, bt_plugin_destroy_func destroy_func
,
79 bt_plugin_source_iterator_create_cb iterator_create_cb
);
82 * Allocate a sink plug-in.
84 * @param name Plug-in instance name (will be copied)
85 * @param private_data Private plug-in implementation data
86 * @param destroy_cb Plug-in private data clean-up callback
87 * @param notification_cb Notification handling callback
88 * @returns A sink plug-in instance
90 extern struct bt_plugin
*bt_plugin_sink_create(const char *name
,
91 void *private_data
, bt_plugin_destroy_func destroy_func
,
92 bt_plugin_sink_handle_notification_cb notification_cb
);
95 * Allocate an notification iterator.
97 * @param plugin Plug-in instance
98 * @param next_cb Callback advancing to the next notification
99 * @param notification_cb Callback providing the current notification
100 * @returns A notification iterator instance
102 extern struct bt_notification_iterator
*bt_notification_iterator_create(
103 struct bt_plugin
*plugin
,
104 bt_notification_iterator_next_cb next_cb
,
105 bt_notification_iterator_get_notification_cb notification_cb
);
111 #endif /* BABELTRACE_PLUGIN_SYSTEM_H */