57a394fd6313cc945a8ecf253695bdb463a898dd
[babeltrace.git] / include / babeltrace / graph / graph.h
1 #ifndef BABELTRACE_GRAPH_GRAPH_H
2 #define BABELTRACE_GRAPH_GRAPH_H
3
4 /*
5 * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 *
7 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28 /* For bt_bool */
29 #include <babeltrace/types.h>
30
31 /* For enum bt_graph_status */
32 #include <babeltrace/graph/graph-const.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 struct bt_component;
39 struct bt_component_class;
40 struct bt_component_class_filter;
41 struct bt_component_class_sink;
42 struct bt_component_class_source;
43 struct bt_component_filter;
44 struct bt_component_sink;
45 struct bt_component_source;
46 struct bt_connection;
47 struct bt_graph;
48 struct bt_port_input;
49 struct bt_port_output;
50 struct bt_value;
51
52 typedef void (*bt_graph_filter_component_input_port_added_listener_func)(
53 const struct bt_component_filter *component,
54 const struct bt_port_input *port, void *data);
55
56 typedef void (*bt_graph_sink_component_input_port_added_listener_func)(
57 const struct bt_component_sink *component,
58 const struct bt_port_input *port, void *data);
59
60 typedef void (*bt_graph_source_component_output_port_added_listener_func)(
61 const struct bt_component_source *component,
62 const struct bt_port_output *port, void *data);
63
64 typedef void (*bt_graph_filter_component_output_port_added_listener_func)(
65 const struct bt_component_filter *component,
66 const struct bt_port_output *port, void *data);
67
68 typedef void (*bt_graph_filter_component_input_port_removed_listener_func)(
69 const struct bt_component_filter *component,
70 const struct bt_port_input *port, void *data);
71
72 typedef void (*bt_graph_sink_component_input_port_removed_listener_func)(
73 const struct bt_component_sink *component,
74 const struct bt_port_input *port, void *data);
75
76 typedef void (*bt_graph_source_component_output_port_removed_listener_func)(
77 const struct bt_component_source *component,
78 const struct bt_port_output *port, void *data);
79
80 typedef void (*bt_graph_filter_component_output_port_removed_listener_func)(
81 const struct bt_component_filter *component,
82 const struct bt_port_output *port, void *data);
83
84 typedef void (*bt_graph_source_filter_component_ports_connected_listener_func)(
85 const struct bt_component_source *source_component,
86 const struct bt_component_filter *filter_component,
87 const struct bt_port_output *upstream_port,
88 const struct bt_port_input *downstream_port, void *data);
89
90 typedef void (*bt_graph_source_sink_component_ports_connected_listener_func)(
91 const struct bt_component_source *source_component,
92 const struct bt_component_sink *sink_component,
93 const struct bt_port_output *upstream_port,
94 const struct bt_port_input *downstream_port, void *data);
95
96 typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func)(
97 const struct bt_component_filter *filter_component,
98 const struct bt_component_sink *sink_component,
99 const struct bt_port_output *upstream_port,
100 const struct bt_port_input *downstream_port, void *data);
101
102 typedef void (*bt_graph_source_filter_component_ports_disconnected_listener_func)(
103 const struct bt_component_source *source_component,
104 const struct bt_component_filter *filter_component,
105 const struct bt_port_output *upstream_port,
106 const struct bt_port_input *downstream_port,
107 void *data);
108
109 typedef void (*bt_graph_source_sink_component_ports_disconnected_listener_func)(
110 const struct bt_component_source *source_component,
111 const struct bt_component_sink *sink_component,
112 const struct bt_port_output *upstream_port,
113 const struct bt_port_input *downstream_port,
114 void *data);
115
116 typedef void (*bt_graph_filter_sink_component_ports_disconnected_listener_func)(
117 const struct bt_component_filter *filter_component,
118 const struct bt_component_sink *sink_component,
119 const struct bt_port_output *upstream_port,
120 const struct bt_port_input *downstream_port,
121 void *data);
122
123 typedef void (* bt_graph_listener_removed_func)(void *data);
124
125 extern struct bt_graph *bt_graph_create(void);
126
127 extern enum bt_graph_status bt_graph_add_source_component(
128 struct bt_graph *graph,
129 const struct bt_component_class_source *component_class,
130 const char *name, const struct bt_value *params,
131 const struct bt_component_source **component);
132
133 extern enum bt_graph_status
134 bt_graph_add_source_component_with_init_method_data(
135 struct bt_graph *graph,
136 const struct bt_component_class_source *component_class,
137 const char *name, const struct bt_value *params,
138 void *init_method_data,
139 const struct bt_component_source **component);
140
141 extern enum bt_graph_status bt_graph_add_filter_component(
142 struct bt_graph *graph,
143 const struct bt_component_class_filter *component_class,
144 const char *name, const struct bt_value *params,
145 const struct bt_component_filter **component);
146
147 extern enum bt_graph_status
148 bt_graph_add_filter_component_with_init_method_data(
149 struct bt_graph *graph,
150 const struct bt_component_class_filter *component_class,
151 const char *name, const struct bt_value *params,
152 void *init_method_data,
153 const struct bt_component_filter **component);
154
155 extern enum bt_graph_status bt_graph_add_sink_component(
156 struct bt_graph *graph,
157 const struct bt_component_class_sink *component_class,
158 const char *name, const struct bt_value *params,
159 const struct bt_component_sink **component);
160
161 extern enum bt_graph_status
162 bt_graph_add_sink_component_with_init_method_data(
163 struct bt_graph *graph,
164 const struct bt_component_class_sink *component_class,
165 const char *name, const struct bt_value *params,
166 void *init_method_data,
167 const struct bt_component_sink **component);
168
169 extern enum bt_graph_status bt_graph_connect_ports(
170 struct bt_graph *graph,
171 const struct bt_port_output *upstream,
172 const struct bt_port_input *downstream,
173 const struct bt_connection **connection);
174
175 extern enum bt_graph_status bt_graph_run(struct bt_graph *graph);
176
177 extern enum bt_graph_status bt_graph_consume(
178 struct bt_graph *graph);
179
180 extern enum bt_graph_status
181 bt_graph_add_filter_component_input_port_added_listener(
182 struct bt_graph *graph,
183 bt_graph_filter_component_input_port_added_listener_func listener,
184 bt_graph_listener_removed_func listener_removed, void *data,
185 int *listener_id);
186
187 extern enum bt_graph_status
188 bt_graph_add_sink_component_input_port_added_listener(
189 struct bt_graph *graph,
190 bt_graph_sink_component_input_port_added_listener_func listener,
191 bt_graph_listener_removed_func listener_removed, void *data,
192 int *listener_id);
193
194 extern enum bt_graph_status
195 bt_graph_add_source_component_output_port_added_listener(
196 struct bt_graph *graph,
197 bt_graph_source_component_output_port_added_listener_func listener,
198 bt_graph_listener_removed_func listener_removed, void *data,
199 int *listener_id);
200
201 extern enum bt_graph_status
202 bt_graph_add_filter_component_output_port_added_listener(
203 struct bt_graph *graph,
204 bt_graph_filter_component_output_port_added_listener_func listener,
205 bt_graph_listener_removed_func listener_removed, void *data,
206 int *listener_id);
207
208 extern enum bt_graph_status
209 bt_graph_add_filter_component_input_port_removed_listener(
210 struct bt_graph *graph,
211 bt_graph_filter_component_input_port_removed_listener_func listener,
212 bt_graph_listener_removed_func listener_removed, void *data,
213 int *listener_id);
214
215 extern enum bt_graph_status
216 bt_graph_add_sink_component_input_port_removed_listener(
217 struct bt_graph *graph,
218 bt_graph_sink_component_input_port_removed_listener_func listener,
219 bt_graph_listener_removed_func listener_removed, void *data,
220 int *listener_id);
221
222 extern enum bt_graph_status
223 bt_graph_add_source_component_output_port_removed_listener(
224 struct bt_graph *graph,
225 bt_graph_source_component_output_port_removed_listener_func listener,
226 bt_graph_listener_removed_func listener_removed, void *data,
227 int *listener_id);
228
229 extern enum bt_graph_status
230 bt_graph_add_filter_component_output_port_removed_listener(
231 struct bt_graph *graph,
232 bt_graph_filter_component_output_port_removed_listener_func listener,
233 bt_graph_listener_removed_func listener_removed, void *data,
234 int *listener_id);
235
236 extern enum bt_graph_status
237 bt_graph_add_source_filter_component_ports_connected_listener(
238 struct bt_graph *graph,
239 bt_graph_source_filter_component_ports_connected_listener_func listener,
240 bt_graph_listener_removed_func listener_removed, void *data,
241 int *listener_id);
242
243 extern enum bt_graph_status
244 bt_graph_add_source_sink_component_ports_connected_listener(
245 struct bt_graph *graph,
246 bt_graph_source_sink_component_ports_connected_listener_func listener,
247 bt_graph_listener_removed_func listener_removed, void *data,
248 int *listener_id);
249
250 extern enum bt_graph_status
251 bt_graph_add_filter_sink_component_ports_connected_listener(
252 struct bt_graph *graph,
253 bt_graph_filter_sink_component_ports_connected_listener_func listener,
254 bt_graph_listener_removed_func listener_removed, void *data,
255 int *listener_id);
256
257 extern enum bt_graph_status
258 bt_graph_add_source_filter_component_ports_disconnected_listener(
259 struct bt_graph *graph,
260 bt_graph_source_filter_component_ports_disconnected_listener_func listener,
261 bt_graph_listener_removed_func listener_removed, void *data,
262 int *listener_id);
263
264 extern enum bt_graph_status
265 bt_graph_add_source_sink_component_ports_disconnected_listener(
266 struct bt_graph *graph,
267 bt_graph_source_sink_component_ports_disconnected_listener_func listener,
268 bt_graph_listener_removed_func listener_removed, void *data,
269 int *listener_id);
270
271 extern enum bt_graph_status
272 bt_graph_add_filter_sink_component_ports_disconnected_listener(
273 struct bt_graph *graph,
274 bt_graph_filter_sink_component_ports_disconnected_listener_func listener,
275 bt_graph_listener_removed_func listener_removed, void *data,
276 int *listener_id);
277
278 extern enum bt_graph_status bt_graph_cancel(struct bt_graph *graph);
279
280 #ifdef __cplusplus
281 }
282 #endif
283
284 #endif /* BABELTRACE_GRAPH_GRAPH_H */
This page took 0.03577 seconds and 3 git commands to generate.