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