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
37 struct bt_notification
;
38 struct bt_notification_iterator
;
40 struct bt_component_factory
;
43 typedef enum bt_component_status (*bt_plugin_init_func
)(
44 struct bt_component_factory
*factory
);
45 typedef void (*bt_plugin_exit_func
)(void);
48 * Component private data deallocation function type.
50 * @param component Component instance
52 typedef void (*bt_component_destroy_cb
)(struct bt_component
*component
);
55 * Component initialization function type.
57 * A component's private data and required callbacks must be set by this
60 * @param component Component instance
61 * @param params A dictionary of component parameters
62 * @returns One of #bt_component_status values
64 typedef enum bt_component_status (*bt_component_init_cb
)(
65 struct bt_component
*component
, struct bt_value
*params
);
68 * Get a component's private data.
70 * @param component Component of which to get the private data
71 * @returns Component's private data
73 extern void *bt_component_get_private_data(struct bt_component
*component
);
76 * Set a component's private data.
78 * @param component Component of which to set the private data
79 * @param data Component private data
80 * @returns One of #bt_component_status values
82 extern enum bt_component_status
bt_component_set_private_data(
83 struct bt_component
*component
, void *data
);
86 * Set a component's private data cleanup function.
88 * @param component Component of which to set the private data destruction
90 * @param data Component private data clean-up function
91 * @returns One of #bt_component_status values
93 extern enum bt_component_status
bt_component_set_destroy_cb(
94 struct bt_component
*component
,
95 bt_component_destroy_cb destroy
);
97 /** bt_component_souce */
99 * Iterator initialization function type.
101 * A notification iterator's private data, deinitialization, next, and get
102 * callbacks must be set by this function.
104 * @param component Component instance
105 * @param iterator Notification iterator instance
107 typedef enum bt_component_status (*bt_component_source_init_iterator_cb
)(
108 struct bt_component
*component
,
109 struct bt_notification_iterator
*iterator
);
112 * Set a source component's iterator initialization function.
114 * @param component Component instance
115 * @param init_iterator Notification iterator initialization callback
117 extern enum bt_component_status
118 bt_component_source_set_iterator_init_cb(struct bt_component
*component
,
119 bt_component_source_init_iterator_cb init_iterator
);
121 /** bt_component_sink */
123 * Notification handling function type.
125 * @param component Component instance
126 * @param notificattion Notification to handle
127 * @returns One of #bt_component_status values
129 typedef enum bt_component_status (*bt_component_sink_handle_notification_cb
)(
130 struct bt_component
*, struct bt_notification
*);
133 * Set a sink component's notification handling callback.
135 * @param component Component instance
136 * @param handle_notification Notification handling callback
137 * @returns One of #bt_component_status values
139 extern enum bt_component_status
140 bt_component_sink_set_handle_notification_cb(struct bt_component
*component
,
141 bt_component_sink_handle_notification_cb handle_notification
);
143 /** bt_component_notification_iterator */
145 * Function returning an iterator's current notification.
147 * @param iterator Notification iterator instance
148 * @returns A notification instance
150 typedef struct bt_notification
*(*bt_notification_iterator_get_cb
)(
151 struct bt_notification_iterator
*iterator
);
154 * Function advancing an iterator's position of one element.
156 * @param iterator Notification iterator instance
157 * @returns One of #bt_notification_iterator_status values
159 typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb
)(
160 struct bt_notification_iterator
*iterator
);
163 * Function cleaning-up an iterator's private data on destruction.
165 * @param iterator Notification iterator instance
167 typedef void (*bt_notification_iterator_destroy_cb
)(
168 struct bt_notification_iterator
*iterator
);
171 * Set an iterator's "get" callback which return the current notification.
173 * @param iterator Notification iterator instance
174 * @param get Notification return callback
175 * @returns One of #bt_notification_iterator_status values
177 extern enum bt_notification_iterator_status
178 bt_notification_iterator_set_get_cb(struct bt_notification_iterator
*iterator
,
179 bt_notification_iterator_get_cb get
);
182 * Set an iterator's "next" callback which advances the iterator's position.
184 * @param iterator Notification iterator instance
185 * @param next Iterator "next" callback
186 * @returns One of #bt_notification_iterator_status values
188 extern enum bt_notification_iterator_status
189 bt_notification_iterator_set_next_cb(struct bt_notification_iterator
*iterator
,
190 bt_notification_iterator_next_cb next
);
193 * Set an iterator's "destroy" callback.
195 * @param iterator Notification iterator instance
196 * @param next Iterator destruction callback
197 * @returns One of #bt_notification_iterator_status values
199 extern enum bt_notification_iterator_status
200 bt_notification_iterator_set_destroy_cb(
201 struct bt_notification_iterator
*iterator
,
202 bt_notification_iterator_destroy_cb destroy
);
205 * Set an iterator's private data.
207 * @param iterator Notification iterator instance
208 * @param data Iterator private data
209 * @returns One of #bt_notification_iterator_status values
211 extern enum bt_notification_iterator_status
212 bt_notification_iterator_set_private_data(
213 struct bt_notification_iterator
*iterator
, void *data
);
216 * Get an iterator's private data.
218 * @param iterator Notification iterator instance
219 * @returns Iterator instance private data
221 extern void *bt_notification_iterator_get_private_data(
222 struct bt_notification_iterator
*iterator
);
228 #endif /* BABELTRACE_PLUGIN_SYSTEM_H */