| 1 | #ifndef BABELTRACE_GRAPH_PRIVATE_GRAPH_H |
| 2 | #define BABELTRACE_GRAPH_PRIVATE_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.h> |
| 33 | |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" { |
| 36 | #endif |
| 37 | |
| 38 | struct bt_graph; |
| 39 | struct bt_private_graph; |
| 40 | struct bt_port_input; |
| 41 | struct bt_port_output; |
| 42 | struct bt_connection; |
| 43 | struct bt_component; |
| 44 | struct bt_component_source; |
| 45 | struct bt_component_filter; |
| 46 | struct bt_component_sink; |
| 47 | struct bt_component_class; |
| 48 | struct bt_value; |
| 49 | |
| 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); |
| 53 | |
| 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); |
| 57 | |
| 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); |
| 61 | |
| 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); |
| 65 | |
| 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); |
| 69 | |
| 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); |
| 73 | |
| 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); |
| 77 | |
| 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); |
| 81 | |
| 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); |
| 87 | |
| 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); |
| 93 | |
| 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); |
| 99 | |
| 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, |
| 105 | void *data); |
| 106 | |
| 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, |
| 112 | void *data); |
| 113 | |
| 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, |
| 119 | void *data); |
| 120 | |
| 121 | typedef void (* bt_private_graph_listener_removed)(void *data); |
| 122 | |
| 123 | static inline |
| 124 | struct bt_graph *bt_private_graph_as_graph(struct bt_private_graph *graph) |
| 125 | { |
| 126 | return (void *) graph; |
| 127 | } |
| 128 | |
| 129 | extern struct bt_private_graph *bt_private_graph_create(void); |
| 130 | |
| 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, const struct bt_value *params, |
| 135 | struct bt_component_source **component); |
| 136 | |
| 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, const struct bt_value *params, |
| 142 | void *init_method_data, struct bt_component_source **component); |
| 143 | |
| 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, const struct bt_value *params, |
| 148 | struct bt_component_filter **component); |
| 149 | |
| 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, const struct bt_value *params, |
| 155 | void *init_method_data, struct bt_component_filter **component); |
| 156 | |
| 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, const struct bt_value *params, |
| 161 | struct bt_component_sink **component); |
| 162 | |
| 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, const struct bt_value *params, |
| 168 | void *init_method_data, struct bt_component_sink **component); |
| 169 | |
| 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); |
| 175 | |
| 176 | extern enum bt_graph_status bt_private_graph_run( |
| 177 | struct bt_private_graph *graph); |
| 178 | |
| 179 | extern enum bt_graph_status bt_private_graph_consume( |
| 180 | struct bt_private_graph *graph); |
| 181 | |
| 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, |
| 187 | int *listener_id); |
| 188 | |
| 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, |
| 194 | int *listener_id); |
| 195 | |
| 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, |
| 201 | int *listener_id); |
| 202 | |
| 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, |
| 208 | int *listener_id); |
| 209 | |
| 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, |
| 215 | int *listener_id); |
| 216 | |
| 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, |
| 222 | int *listener_id); |
| 223 | |
| 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, |
| 229 | int *listener_id); |
| 230 | |
| 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, |
| 236 | int *listener_id); |
| 237 | |
| 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, |
| 243 | int *listener_id); |
| 244 | |
| 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, |
| 250 | int *listener_id); |
| 251 | |
| 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, |
| 257 | int *listener_id); |
| 258 | |
| 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, |
| 264 | int *listener_id); |
| 265 | |
| 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, |
| 271 | int *listener_id); |
| 272 | |
| 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, |
| 278 | int *listener_id); |
| 279 | |
| 280 | extern enum bt_graph_status bt_private_graph_cancel( |
| 281 | struct bt_private_graph *graph); |
| 282 | |
| 283 | #ifdef __cplusplus |
| 284 | } |
| 285 | #endif |
| 286 | |
| 287 | #endif /* BABELTRACE_GRAPH_PRIVATE_GRAPH_H */ |