Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_GRAPH_GRAPH_H |
2 | #define BABELTRACE_GRAPH_GRAPH_H | |
c0418dd9 JG |
3 | |
4 | /* | |
e2f7325d | 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 | ||
9d408fca | 27 | /* For bt_bool */ |
202a3a13 | 28 | #include <babeltrace/types.h> |
c0418dd9 | 29 | |
0d72b8c3 PP |
30 | /* For enum bt_graph_status */ |
31 | #include <babeltrace/graph/graph-const.h> | |
32 | ||
c0418dd9 JG |
33 | #ifdef __cplusplus |
34 | extern "C" { | |
35 | #endif | |
36 | ||
0d72b8c3 PP |
37 | struct bt_component; |
38 | struct bt_component_class; | |
39 | struct bt_component_class_filter; | |
40 | struct bt_component_class_sink; | |
41 | struct bt_component_class_source; | |
42 | struct bt_component_filter; | |
43 | struct bt_component_sink; | |
44 | struct bt_component_source; | |
45 | struct bt_connection; | |
a2d06fd5 | 46 | struct bt_graph; |
0d72b8c3 PP |
47 | struct bt_port_input; |
48 | struct bt_port_output; | |
49 | struct bt_value; | |
50 | ||
51 | typedef void (*bt_graph_filter_component_input_port_added_listener_func)( | |
52 | const struct bt_component_filter *component, | |
53 | const struct bt_port_input *port, void *data); | |
54 | ||
55 | typedef void (*bt_graph_sink_component_input_port_added_listener_func)( | |
56 | const struct bt_component_sink *component, | |
57 | const struct bt_port_input *port, void *data); | |
58 | ||
59 | typedef void (*bt_graph_source_component_output_port_added_listener_func)( | |
60 | const struct bt_component_source *component, | |
61 | const struct bt_port_output *port, void *data); | |
62 | ||
63 | typedef void (*bt_graph_filter_component_output_port_added_listener_func)( | |
64 | const struct bt_component_filter *component, | |
65 | const struct bt_port_output *port, void *data); | |
66 | ||
67 | typedef void (*bt_graph_filter_component_input_port_removed_listener_func)( | |
68 | const struct bt_component_filter *component, | |
69 | const struct bt_port_input *port, void *data); | |
70 | ||
71 | typedef void (*bt_graph_sink_component_input_port_removed_listener_func)( | |
72 | const struct bt_component_sink *component, | |
73 | const struct bt_port_input *port, void *data); | |
74 | ||
75 | typedef void (*bt_graph_source_component_output_port_removed_listener_func)( | |
76 | const struct bt_component_source *component, | |
77 | const struct bt_port_output *port, void *data); | |
78 | ||
79 | typedef void (*bt_graph_filter_component_output_port_removed_listener_func)( | |
80 | const struct bt_component_filter *component, | |
81 | const struct bt_port_output *port, void *data); | |
82 | ||
83 | typedef void (*bt_graph_source_filter_component_ports_connected_listener_func)( | |
84 | const struct bt_component_source *source_component, | |
85 | const struct bt_component_filter *filter_component, | |
86 | const struct bt_port_output *upstream_port, | |
87 | const struct bt_port_input *downstream_port, void *data); | |
88 | ||
89 | typedef void (*bt_graph_source_sink_component_ports_connected_listener_func)( | |
90 | const struct bt_component_source *source_component, | |
91 | const struct bt_component_sink *sink_component, | |
92 | const struct bt_port_output *upstream_port, | |
93 | const struct bt_port_input *downstream_port, void *data); | |
94 | ||
95 | typedef void (*bt_graph_filter_sink_component_ports_connected_listener_func)( | |
96 | const struct bt_component_filter *filter_component, | |
97 | const struct bt_component_sink *sink_component, | |
98 | const struct bt_port_output *upstream_port, | |
99 | const struct bt_port_input *downstream_port, void *data); | |
100 | ||
101 | typedef void (*bt_graph_source_filter_component_ports_disconnected_listener_func)( | |
102 | const struct bt_component_source *source_component, | |
103 | const struct bt_component_filter *filter_component, | |
104 | const struct bt_port_output *upstream_port, | |
105 | const struct bt_port_input *downstream_port, | |
106 | void *data); | |
107 | ||
108 | typedef void (*bt_graph_source_sink_component_ports_disconnected_listener_func)( | |
109 | const struct bt_component_source *source_component, | |
110 | const struct bt_component_sink *sink_component, | |
111 | const struct bt_port_output *upstream_port, | |
112 | const struct bt_port_input *downstream_port, | |
113 | void *data); | |
114 | ||
115 | typedef void (*bt_graph_filter_sink_component_ports_disconnected_listener_func)( | |
116 | const struct bt_component_filter *filter_component, | |
117 | const struct bt_component_sink *sink_component, | |
118 | const struct bt_port_output *upstream_port, | |
119 | const struct bt_port_input *downstream_port, | |
120 | void *data); | |
121 | ||
122 | typedef void (* bt_graph_listener_removed_func)(void *data); | |
123 | ||
124 | extern struct bt_graph *bt_graph_create(void); | |
125 | ||
126 | extern enum bt_graph_status bt_graph_add_source_component( | |
127 | struct bt_graph *graph, | |
128 | const struct bt_component_class_source *component_class, | |
129 | const char *name, const struct bt_value *params, | |
130 | const struct bt_component_source **component); | |
131 | ||
132 | extern enum bt_graph_status | |
133 | bt_graph_add_source_component_with_init_method_data( | |
134 | struct bt_graph *graph, | |
135 | const struct bt_component_class_source *component_class, | |
136 | const char *name, const struct bt_value *params, | |
137 | void *init_method_data, | |
138 | const struct bt_component_source **component); | |
139 | ||
140 | extern enum bt_graph_status bt_graph_add_filter_component( | |
141 | struct bt_graph *graph, | |
142 | const struct bt_component_class_filter *component_class, | |
143 | const char *name, const struct bt_value *params, | |
144 | const struct bt_component_filter **component); | |
145 | ||
146 | extern enum bt_graph_status | |
147 | bt_graph_add_filter_component_with_init_method_data( | |
148 | struct bt_graph *graph, | |
149 | const struct bt_component_class_filter *component_class, | |
150 | const char *name, const struct bt_value *params, | |
151 | void *init_method_data, | |
152 | const struct bt_component_filter **component); | |
153 | ||
154 | extern enum bt_graph_status bt_graph_add_sink_component( | |
155 | struct bt_graph *graph, | |
156 | const struct bt_component_class_sink *component_class, | |
157 | const char *name, const struct bt_value *params, | |
158 | const struct bt_component_sink **component); | |
159 | ||
160 | extern enum bt_graph_status | |
161 | bt_graph_add_sink_component_with_init_method_data( | |
162 | struct bt_graph *graph, | |
163 | const struct bt_component_class_sink *component_class, | |
164 | const char *name, const struct bt_value *params, | |
165 | void *init_method_data, | |
166 | const struct bt_component_sink **component); | |
167 | ||
168 | extern enum bt_graph_status bt_graph_connect_ports( | |
169 | struct bt_graph *graph, | |
170 | const struct bt_port_output *upstream, | |
171 | const struct bt_port_input *downstream, | |
172 | const struct bt_connection **connection); | |
173 | ||
174 | extern enum bt_graph_status bt_graph_run(struct bt_graph *graph); | |
175 | ||
176 | extern enum bt_graph_status bt_graph_consume( | |
177 | struct bt_graph *graph); | |
178 | ||
179 | extern enum bt_graph_status | |
180 | bt_graph_add_filter_component_input_port_added_listener( | |
181 | struct bt_graph *graph, | |
182 | bt_graph_filter_component_input_port_added_listener_func listener, | |
183 | bt_graph_listener_removed_func listener_removed, void *data, | |
184 | int *listener_id); | |
185 | ||
186 | extern enum bt_graph_status | |
187 | bt_graph_add_sink_component_input_port_added_listener( | |
188 | struct bt_graph *graph, | |
189 | bt_graph_sink_component_input_port_added_listener_func listener, | |
190 | bt_graph_listener_removed_func listener_removed, void *data, | |
191 | int *listener_id); | |
192 | ||
193 | extern enum bt_graph_status | |
194 | bt_graph_add_source_component_output_port_added_listener( | |
195 | struct bt_graph *graph, | |
196 | bt_graph_source_component_output_port_added_listener_func listener, | |
197 | bt_graph_listener_removed_func listener_removed, void *data, | |
198 | int *listener_id); | |
199 | ||
200 | extern enum bt_graph_status | |
201 | bt_graph_add_filter_component_output_port_added_listener( | |
202 | struct bt_graph *graph, | |
203 | bt_graph_filter_component_output_port_added_listener_func listener, | |
204 | bt_graph_listener_removed_func listener_removed, void *data, | |
205 | int *listener_id); | |
206 | ||
207 | extern enum bt_graph_status | |
208 | bt_graph_add_filter_component_input_port_removed_listener( | |
209 | struct bt_graph *graph, | |
210 | bt_graph_filter_component_input_port_removed_listener_func listener, | |
211 | bt_graph_listener_removed_func listener_removed, void *data, | |
212 | int *listener_id); | |
213 | ||
214 | extern enum bt_graph_status | |
215 | bt_graph_add_sink_component_input_port_removed_listener( | |
216 | struct bt_graph *graph, | |
217 | bt_graph_sink_component_input_port_removed_listener_func listener, | |
218 | bt_graph_listener_removed_func listener_removed, void *data, | |
219 | int *listener_id); | |
220 | ||
221 | extern enum bt_graph_status | |
222 | bt_graph_add_source_component_output_port_removed_listener( | |
223 | struct bt_graph *graph, | |
224 | bt_graph_source_component_output_port_removed_listener_func listener, | |
225 | bt_graph_listener_removed_func listener_removed, void *data, | |
226 | int *listener_id); | |
227 | ||
228 | extern enum bt_graph_status | |
229 | bt_graph_add_filter_component_output_port_removed_listener( | |
230 | struct bt_graph *graph, | |
231 | bt_graph_filter_component_output_port_removed_listener_func listener, | |
232 | bt_graph_listener_removed_func listener_removed, void *data, | |
233 | int *listener_id); | |
234 | ||
235 | extern enum bt_graph_status | |
236 | bt_graph_add_source_filter_component_ports_connected_listener( | |
237 | struct bt_graph *graph, | |
238 | bt_graph_source_filter_component_ports_connected_listener_func listener, | |
239 | bt_graph_listener_removed_func listener_removed, void *data, | |
240 | int *listener_id); | |
241 | ||
242 | extern enum bt_graph_status | |
243 | bt_graph_add_source_sink_component_ports_connected_listener( | |
244 | struct bt_graph *graph, | |
245 | bt_graph_source_sink_component_ports_connected_listener_func listener, | |
246 | bt_graph_listener_removed_func listener_removed, void *data, | |
247 | int *listener_id); | |
248 | ||
249 | extern enum bt_graph_status | |
250 | bt_graph_add_filter_sink_component_ports_connected_listener( | |
251 | struct bt_graph *graph, | |
252 | bt_graph_filter_sink_component_ports_connected_listener_func listener, | |
253 | bt_graph_listener_removed_func listener_removed, void *data, | |
254 | int *listener_id); | |
255 | ||
256 | extern enum bt_graph_status | |
257 | bt_graph_add_source_filter_component_ports_disconnected_listener( | |
258 | struct bt_graph *graph, | |
259 | bt_graph_source_filter_component_ports_disconnected_listener_func listener, | |
260 | bt_graph_listener_removed_func listener_removed, void *data, | |
261 | int *listener_id); | |
262 | ||
263 | extern enum bt_graph_status | |
264 | bt_graph_add_source_sink_component_ports_disconnected_listener( | |
265 | struct bt_graph *graph, | |
266 | bt_graph_source_sink_component_ports_disconnected_listener_func listener, | |
267 | bt_graph_listener_removed_func listener_removed, void *data, | |
268 | int *listener_id); | |
269 | ||
270 | extern enum bt_graph_status | |
271 | bt_graph_add_filter_sink_component_ports_disconnected_listener( | |
272 | struct bt_graph *graph, | |
273 | bt_graph_filter_sink_component_ports_disconnected_listener_func listener, | |
274 | bt_graph_listener_removed_func listener_removed, void *data, | |
275 | int *listener_id); | |
c0418dd9 | 276 | |
0d72b8c3 | 277 | extern enum bt_graph_status bt_graph_cancel(struct bt_graph *graph); |
202a3a13 | 278 | |
c0418dd9 JG |
279 | #ifdef __cplusplus |
280 | } | |
281 | #endif | |
282 | ||
1ca80abd | 283 | #endif /* BABELTRACE_GRAPH_GRAPH_H */ |