List detected component classes
[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 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 struct bt_notification;
38 struct bt_notification_iterator;
39 struct bt_component;
40 struct bt_component_factory;
41 struct bt_value;
42
43 typedef enum bt_component_status (*bt_plugin_init_func)(
44 struct bt_component_factory *factory);
45 typedef void (*bt_plugin_exit_func)(void);
46
47 /**
48 * Component private data deallocation function type.
49 *
50 * @param component Component instance
51 */
52 typedef void (*bt_component_destroy_cb)(struct bt_component *component);
53
54 /**
55 * Component initialization function type.
56 *
57 * A component's private data and required callbacks must be set by this
58 * function.
59 *
60 * @param component Component instance
61 * @param params A dictionary of component parameters
62 * @returns One of #bt_component_status values
63 */
64 typedef enum bt_component_status (*bt_component_init_cb)(
65 struct bt_component *component, struct bt_value *params);
66
67 /**
68 * Get a component's private data.
69 *
70 * @param component Component of which to get the private data
71 * @returns Component's private data
72 */
73 extern void *bt_component_get_private_data(struct bt_component *component);
74
75 /**
76 * Set a component's private data.
77 *
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
81 */
82 extern enum bt_component_status bt_component_set_private_data(
83 struct bt_component *component, void *data);
84
85 /**
86 * Set a component's private data cleanup function.
87 *
88 * @param component Component of which to set the private data destruction
89 * function
90 * @param data Component private data clean-up function
91 * @returns One of #bt_component_status values
92 */
93 extern enum bt_component_status bt_component_set_destroy_cb(
94 struct bt_component *component,
95 bt_component_destroy_cb destroy);
96
97 /** bt_component_souce */
98 /**
99 * Iterator initialization function type.
100 *
101 * A notification iterator's private data, deinitialization, next, and get
102 * callbacks must be set by this function.
103 *
104 * @param component Component instance
105 * @param iterator Notification iterator instance
106 */
107 typedef enum bt_component_status (*bt_component_source_init_iterator_cb)(
108 struct bt_component *component,
109 struct bt_notification_iterator *iterator);
110
111 /**
112 * Set a source component's iterator initialization function.
113 *
114 * @param component Component instance
115 * @param init_iterator Notification iterator initialization callback
116 */
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);
120
121 /** bt_component_sink */
122 /**
123 * Notification handling function type.
124 *
125 * @param component Component instance
126 * @param notificattion Notification to handle
127 * @returns One of #bt_component_status values
128 */
129 typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)(
130 struct bt_component *, struct bt_notification *);
131
132 /**
133 * Set a sink component's notification handling callback.
134 *
135 * @param component Component instance
136 * @param handle_notification Notification handling callback
137 * @returns One of #bt_component_status values
138 */
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);
142
143 /** bt_component_notification_iterator */
144 /**
145 * Function returning an iterator's current notification.
146 *
147 * @param iterator Notification iterator instance
148 * @returns A notification instance
149 */
150 typedef struct bt_notification *(*bt_notification_iterator_get_cb)(
151 struct bt_notification_iterator *iterator);
152
153 /**
154 * Function advancing an iterator's position of one element.
155 *
156 * @param iterator Notification iterator instance
157 * @returns One of #bt_notification_iterator_status values
158 */
159 typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb)(
160 struct bt_notification_iterator *iterator);
161
162 /**
163 * Function cleaning-up an iterator's private data on destruction.
164 *
165 * @param iterator Notification iterator instance
166 */
167 typedef void (*bt_notification_iterator_destroy_cb)(
168 struct bt_notification_iterator *iterator);
169
170 /**
171 * Set an iterator's "get" callback which return the current notification.
172 *
173 * @param iterator Notification iterator instance
174 * @param get Notification return callback
175 * @returns One of #bt_notification_iterator_status values
176 */
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);
180
181 /**
182 * Set an iterator's "next" callback which advances the iterator's position.
183 *
184 * @param iterator Notification iterator instance
185 * @param next Iterator "next" callback
186 * @returns One of #bt_notification_iterator_status values
187 */
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);
191
192 /**
193 * Set an iterator's "destroy" callback.
194 *
195 * @param iterator Notification iterator instance
196 * @param next Iterator destruction callback
197 * @returns One of #bt_notification_iterator_status values
198 */
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);
203
204 /**
205 * Set an iterator's private data.
206 *
207 * @param iterator Notification iterator instance
208 * @param data Iterator private data
209 * @returns One of #bt_notification_iterator_status values
210 */
211 extern enum bt_notification_iterator_status
212 bt_notification_iterator_set_private_data(
213 struct bt_notification_iterator *iterator, void *data);
214
215 /**
216 * Get an iterator's private data.
217 *
218 * @param iterator Notification iterator instance
219 * @returns Iterator instance private data
220 */
221 extern void *bt_notification_iterator_get_private_data(
222 struct bt_notification_iterator *iterator);
223
224 #ifdef __cplusplus
225 }
226 #endif
227
228 #endif /* BABELTRACE_PLUGIN_SYSTEM_H */
This page took 0.034955 seconds and 4 git commands to generate.