b8aa4a3b94da63ac4b5ab0889f92adcfedcd9b38
[babeltrace.git] / include / babeltrace / plugin / plugin-system.h
1 #ifndef BABELTRACE_PLUGIN_SYSTEM_H
2 #define BABELTRACE_PLUGIN_SYSTEM_H
3
4 /*
5 * BabelTrace - Babeltrace Plug-in System Interface
6 *
7 * This interface is provided for plug-ins to use the Babeltrace
8 * plug-in system facilities.
9 *
10 * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 *
12 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
13 *
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:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
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
30 * SOFTWARE.
31 */
32
33 #include <babeltrace/objects.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40 * Plug-in private data deallocation function type.
41 *
42 * @param plugin Plug-in instance
43 */
44 typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
45
46 /**
47 * Get a plug-in's private (implementation) data.
48 *
49 * @param plugin Plug-in of which to get the private data
50 * @returns Plug-in private data
51 */
52 extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
53
54
55 /** Plug-in initialization functions */
56 /**
57 * Allocate a source plug-in.
58 *
59 * @param name Plug-in instance name (will be copied)
60 * @param private_data Private plug-in implementation data
61 * @param destroy_cb Plug-in private data clean-up callback
62 * @param iterator_create_cb Iterator creation callback
63 * @returns A source plug-in instance
64 */
65 extern struct bt_plugin *bt_plugin_source_create(const char *name,
66 void *private_data, bt_plugin_destroy_func destroy_func,
67 bt_plugin_source_iterator_create_cb iterator_create_cb);
68
69 /**
70 * Allocate a sink plug-in.
71 *
72 * @param name Plug-in instance name (will be copied)
73 * @param private_data Private plug-in implementation data
74 * @param destroy_cb Plug-in private data clean-up callback
75 * @param notification_cb Notification handling callback
76 * @returns A sink plug-in instance
77 */
78 extern struct bt_plugin *bt_plugin_sink_create(const char *name,
79 void *private_data, bt_plugin_destroy_func destroy_func,
80 bt_plugin_sink_handle_notification_cb notification_cb);
81
82
83 /** Notification iterator functions */
84 /**
85 * Allocate a notification iterator.
86 *
87 * @param plugin Plug-in instance
88 * @param next_cb Callback advancing to the next notification
89 * @param notification_cb Callback providing the current notification
90 * @returns A notification iterator instance
91 */
92 extern struct bt_notification_iterator *bt_notification_iterator_create(
93 struct bt_plugin *plugin,
94 bt_notification_iterator_next_cb next_cb,
95 bt_notification_iterator_get_notification_cb notification_cb);
96
97 /**
98 * Set an iterator's private data.
99 *
100 * @param plugin Plug-in instance on which to iterate
101 * @param data Iterator private data
102 * @returns One of #bt_notification_iterator_status values
103 */
104 extern enum bt_notification_iterator_status *bt_notification_iterator_create(
105 struct bt_plugin *plugin, void *data);
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif /* BABELTRACE_PLUGIN_SYSTEM_H */
This page took 0.03513 seconds and 4 git commands to generate.