1 #ifndef BABELTRACE_GRAPH_PRIVATE_GRAPH_H
2 #define BABELTRACE_GRAPH_PRIVATE_GRAPH_H
5 * Copyright 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
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
29 #include <babeltrace/types.h>
31 /* For enum bt_graph_status */
32 #include <babeltrace/graph/graph.h>
39 struct bt_private_graph
;
41 struct bt_port_output
;
44 struct bt_component_source
;
45 struct bt_component_filter
;
46 struct bt_component_sink
;
47 struct bt_component_class
;
50 typedef void (*bt_private_graph_filter_component_input_port_added_listener
)(
51 struct bt_component_filter
*component
,
52 struct bt_port_input
*port
, void *data
);
54 typedef void (*bt_private_graph_sink_component_input_port_added_listener
)(
55 struct bt_component_sink
*component
,
56 struct bt_port_input
*port
, void *data
);
58 typedef void (*bt_private_graph_source_component_output_port_added_listener
)(
59 struct bt_component_source
*component
,
60 struct bt_port_output
*port
, void *data
);
62 typedef void (*bt_private_graph_filter_component_output_port_added_listener
)(
63 struct bt_component_filter
*component
,
64 struct bt_port_output
*port
, void *data
);
66 typedef void (*bt_private_graph_filter_component_input_port_removed_listener
)(
67 struct bt_component_filter
*component
,
68 struct bt_port_input
*port
, void *data
);
70 typedef void (*bt_private_graph_sink_component_input_port_removed_listener
)(
71 struct bt_component_sink
*component
,
72 struct bt_port_input
*port
, void *data
);
74 typedef void (*bt_private_graph_source_component_output_port_removed_listener
)(
75 struct bt_component_source
*component
,
76 struct bt_port_output
*port
, void *data
);
78 typedef void (*bt_private_graph_filter_component_output_port_removed_listener
)(
79 struct bt_component_filter
*component
,
80 struct bt_port_output
*port
, void *data
);
82 typedef void (*bt_private_graph_source_filter_component_ports_connected_listener
)(
83 struct bt_component_source
*source_component
,
84 struct bt_component_filter
*filter_component
,
85 struct bt_port_output
*upstream_port
,
86 struct bt_port_input
*downstream_port
, void *data
);
88 typedef void (*bt_private_graph_source_sink_component_ports_connected_listener
)(
89 struct bt_component_source
*source_component
,
90 struct bt_component_sink
*sink_component
,
91 struct bt_port_output
*upstream_port
,
92 struct bt_port_input
*downstream_port
, void *data
);
94 typedef void (*bt_private_graph_filter_sink_component_ports_connected_listener
)(
95 struct bt_component_filter
*filter_component
,
96 struct bt_component_sink
*sink_component
,
97 struct bt_port_output
*upstream_port
,
98 struct bt_port_input
*downstream_port
, void *data
);
100 typedef void (*bt_private_graph_source_filter_component_ports_disconnected_listener
)(
101 struct bt_component_source
*source_component
,
102 struct bt_component_filter
*filter_component
,
103 struct bt_port_output
*upstream_port
,
104 struct bt_port_input
*downstream_port
,
107 typedef void (*bt_private_graph_source_sink_component_ports_disconnected_listener
)(
108 struct bt_component_source
*source_component
,
109 struct bt_component_sink
*sink_component
,
110 struct bt_port_output
*upstream_port
,
111 struct bt_port_input
*downstream_port
,
114 typedef void (*bt_private_graph_filter_sink_component_ports_disconnected_listener
)(
115 struct bt_component_filter
*filter_component
,
116 struct bt_component_sink
*sink_component
,
117 struct bt_port_output
*upstream_port
,
118 struct bt_port_input
*downstream_port
,
121 typedef void (* bt_private_graph_listener_removed
)(void *data
);
124 struct bt_graph
*bt_private_graph_as_graph(struct bt_private_graph
*graph
)
126 return (void *) graph
;
129 extern struct bt_private_graph
*bt_private_graph_create(void);
131 extern enum bt_graph_status
bt_private_graph_add_source_component(
132 struct bt_private_graph
*graph
,
133 struct bt_component_class_source
*component_class
,
134 const char *name
, struct bt_value
*params
,
135 struct bt_component_source
**component
);
137 extern enum bt_graph_status
138 bt_private_graph_add_source_component_with_init_method_data(
139 struct bt_private_graph
*graph
,
140 struct bt_component_class_source
*component_class
,
141 const char *name
, struct bt_value
*params
,
142 void *init_method_data
, struct bt_component_source
**component
);
144 extern enum bt_graph_status
bt_private_graph_add_filter_component(
145 struct bt_private_graph
*graph
,
146 struct bt_component_class_filter
*component_class
,
147 const char *name
, struct bt_value
*params
,
148 struct bt_component_filter
**component
);
150 extern enum bt_graph_status
151 bt_private_graph_add_filter_component_with_init_method_data(
152 struct bt_private_graph
*graph
,
153 struct bt_component_class_filter
*component_class
,
154 const char *name
, struct bt_value
*params
,
155 void *init_method_data
, struct bt_component_filter
**component
);
157 extern enum bt_graph_status
bt_private_graph_add_sink_component(
158 struct bt_private_graph
*graph
,
159 struct bt_component_class_sink
*component_class
,
160 const char *name
, struct bt_value
*params
,
161 struct bt_component_sink
**component
);
163 extern enum bt_graph_status
164 bt_private_graph_add_sink_component_with_init_method_data(
165 struct bt_private_graph
*graph
,
166 struct bt_component_class_sink
*component_class
,
167 const char *name
, struct bt_value
*params
,
168 void *init_method_data
, struct bt_component_sink
**component
);
170 extern enum bt_graph_status
bt_private_graph_connect_ports(
171 struct bt_private_graph
*graph
,
172 struct bt_port_output
*upstream
,
173 struct bt_port_input
*downstream
,
174 struct bt_connection
**connection
);
176 extern enum bt_graph_status
bt_private_graph_run(
177 struct bt_private_graph
*graph
);
179 extern enum bt_graph_status
bt_private_graph_consume(
180 struct bt_private_graph
*graph
);
182 extern enum bt_graph_status
183 bt_private_graph_add_filter_component_input_port_added_listener(
184 struct bt_private_graph
*graph
,
185 bt_private_graph_filter_component_input_port_added_listener listener
,
186 bt_private_graph_listener_removed listener_removed
, void *data
,
189 extern enum bt_graph_status
190 bt_private_graph_add_sink_component_input_port_added_listener(
191 struct bt_private_graph
*graph
,
192 bt_private_graph_sink_component_input_port_added_listener listener
,
193 bt_private_graph_listener_removed listener_removed
, void *data
,
196 extern enum bt_graph_status
197 bt_private_graph_add_source_component_output_port_added_listener(
198 struct bt_private_graph
*graph
,
199 bt_private_graph_source_component_output_port_added_listener listener
,
200 bt_private_graph_listener_removed listener_removed
, void *data
,
203 extern enum bt_graph_status
204 bt_private_graph_add_filter_component_output_port_added_listener(
205 struct bt_private_graph
*graph
,
206 bt_private_graph_filter_component_output_port_added_listener listener
,
207 bt_private_graph_listener_removed listener_removed
, void *data
,
210 extern enum bt_graph_status
211 bt_private_graph_add_filter_component_input_port_removed_listener(
212 struct bt_private_graph
*graph
,
213 bt_private_graph_filter_component_input_port_removed_listener listener
,
214 bt_private_graph_listener_removed listener_removed
, void *data
,
217 extern enum bt_graph_status
218 bt_private_graph_add_sink_component_input_port_removed_listener(
219 struct bt_private_graph
*graph
,
220 bt_private_graph_sink_component_input_port_removed_listener listener
,
221 bt_private_graph_listener_removed listener_removed
, void *data
,
224 extern enum bt_graph_status
225 bt_private_graph_add_source_component_output_port_removed_listener(
226 struct bt_private_graph
*graph
,
227 bt_private_graph_source_component_output_port_removed_listener listener
,
228 bt_private_graph_listener_removed listener_removed
, void *data
,
231 extern enum bt_graph_status
232 bt_private_graph_add_filter_component_output_port_removed_listener(
233 struct bt_private_graph
*graph
,
234 bt_private_graph_filter_component_output_port_removed_listener listener
,
235 bt_private_graph_listener_removed listener_removed
, void *data
,
238 extern enum bt_graph_status
239 bt_private_graph_add_source_filter_component_ports_connected_listener(
240 struct bt_private_graph
*graph
,
241 bt_private_graph_source_filter_component_ports_connected_listener listener
,
242 bt_private_graph_listener_removed listener_removed
, void *data
,
245 extern enum bt_graph_status
246 bt_private_graph_add_source_sink_component_ports_connected_listener(
247 struct bt_private_graph
*graph
,
248 bt_private_graph_source_sink_component_ports_connected_listener listener
,
249 bt_private_graph_listener_removed listener_removed
, void *data
,
252 extern enum bt_graph_status
253 bt_private_graph_add_filter_sink_component_ports_connected_listener(
254 struct bt_private_graph
*graph
,
255 bt_private_graph_filter_sink_component_ports_connected_listener listener
,
256 bt_private_graph_listener_removed listener_removed
, void *data
,
259 extern enum bt_graph_status
260 bt_private_graph_add_source_filter_component_ports_disconnected_listener(
261 struct bt_private_graph
*graph
,
262 bt_private_graph_source_filter_component_ports_disconnected_listener listener
,
263 bt_private_graph_listener_removed listener_removed
, void *data
,
266 extern enum bt_graph_status
267 bt_private_graph_add_source_sink_component_ports_disconnected_listener(
268 struct bt_private_graph
*graph
,
269 bt_private_graph_source_sink_component_ports_disconnected_listener listener
,
270 bt_private_graph_listener_removed listener_removed
, void *data
,
273 extern enum bt_graph_status
274 bt_private_graph_add_filter_sink_component_ports_disconnected_listener(
275 struct bt_private_graph
*graph
,
276 bt_private_graph_filter_sink_component_ports_disconnected_listener listener
,
277 bt_private_graph_listener_removed listener_removed
, void *data
,
280 extern enum bt_graph_status
bt_private_graph_cancel(
281 struct bt_private_graph
*graph
);
287 #endif /* BABELTRACE_GRAPH_PRIVATE_GRAPH_H */