+enum bt_graph_status
+bt_private_graph_add_source_sink_component_ports_connected_listener(
+ struct bt_private_graph *priv_graph,
+ bt_private_graph_source_sink_component_ports_connected_listener func,
+ bt_private_graph_listener_removed listener_removed, void *data,
+ int *out_listener_id)
+{
+ struct bt_graph *graph = (void *) priv_graph;
+ struct bt_graph_listener_ports_connected listener = {
+ .base = {
+ .removed = listener_removed,
+ .data = data,
+ },
+ .func = (ports_connected_func_t) func,
+ };
+ int listener_id;
+
+ BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_NON_NULL(func, "Listener");
+ BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
+ BT_ASSERT_PRE(!graph->in_remove_listener,
+ "Graph currently executing a \"listener removed\" listener: "
+ "%!+g", graph);
+ g_array_append_val(graph->listeners.source_sink_ports_connected,
+ listener);
+ listener_id = graph->listeners.source_sink_ports_connected->len - 1;
+ BT_LIB_LOGV("Added \"source to sink component ports connected\" listener to graph: "
+ "%![graph-]+g, listener-addr=%p, id=%d", graph, listener,
+ listener_id);
+
+ if (listener_id) {
+ *out_listener_id = listener_id;
+ }
+
+ return BT_GRAPH_STATUS_OK;
+}
+
+enum bt_graph_status
+bt_private_graph_add_filter_sink_component_ports_connected_listener(
+ struct bt_private_graph *priv_graph,
+ bt_private_graph_filter_sink_component_ports_connected_listener func,
+ bt_private_graph_listener_removed listener_removed, void *data,
+ int *out_listener_id)
+{
+ struct bt_graph *graph = (void *) priv_graph;
+ struct bt_graph_listener_ports_connected listener = {
+ .base = {
+ .removed = listener_removed,
+ .data = data,
+ },
+ .func = (ports_connected_func_t) func,
+ };
+ int listener_id;
+
+ BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_NON_NULL(func, "Listener");
+ BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
+ BT_ASSERT_PRE(!graph->in_remove_listener,
+ "Graph currently executing a \"listener removed\" listener: "
+ "%!+g", graph);
+ g_array_append_val(graph->listeners.filter_sink_ports_connected,
+ listener);
+ listener_id = graph->listeners.filter_sink_ports_connected->len - 1;
+ BT_LIB_LOGV("Added \"filter to sink component ports connected\" listener to graph: "
+ "%![graph-]+g, listener-addr=%p, id=%d", graph, listener,
+ listener_id);
+
+ if (listener_id) {
+ *out_listener_id = listener_id;
+ }
+
+ return BT_GRAPH_STATUS_OK;
+}
+
+enum bt_graph_status
+bt_private_graph_add_source_filter_component_ports_disconnected_listener(
+ struct bt_private_graph *priv_graph,
+ bt_private_graph_source_filter_component_ports_disconnected_listener func,
+ bt_private_graph_listener_removed listener_removed, void *data,
+ int *out_listener_id)
+{
+ struct bt_graph *graph = (void *) priv_graph;
+ struct bt_graph_listener_ports_disconnected listener = {
+ .base = {
+ .removed = listener_removed,
+ .data = data,
+ },
+ .func = (ports_disconnected_func_t) func,
+ };
+ int listener_id;
+
+ BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_NON_NULL(func, "Listener");
+ BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
+ BT_ASSERT_PRE(!graph->in_remove_listener,
+ "Graph currently executing a \"listener removed\" listener: "
+ "%!+g", graph);
+ g_array_append_val(graph->listeners.source_filter_ports_disconnected,
+ listener);
+ listener_id = graph->listeners.source_filter_ports_disconnected->len - 1;
+ BT_LIB_LOGV("Added \"source to filter component ports disconnected\" listener to graph: "
+ "%![graph-]+g, listener-addr=%p, id=%d", graph, listener,
+ listener_id);
+
+ if (listener_id) {
+ *out_listener_id = listener_id;
+ }
+
+ return BT_GRAPH_STATUS_OK;
+}
+
+enum bt_graph_status
+bt_private_graph_add_source_sink_component_ports_disconnected_listener(
+ struct bt_private_graph *priv_graph,
+ bt_private_graph_source_sink_component_ports_disconnected_listener func,
+ bt_private_graph_listener_removed listener_removed, void *data,
+ int *out_listener_id)
+{
+ struct bt_graph *graph = (void *) priv_graph;
+ struct bt_graph_listener_ports_disconnected listener = {
+ .base = {
+ .removed = listener_removed,
+ .data = data,
+ },
+ .func = (ports_disconnected_func_t) func,
+ };
+ int listener_id;
+
+ BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_NON_NULL(func, "Listener");
+ BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
+ BT_ASSERT_PRE(!graph->in_remove_listener,
+ "Graph currently executing a \"listener removed\" listener: "
+ "%!+g", graph);
+ g_array_append_val(graph->listeners.source_sink_ports_disconnected,
+ listener);
+ listener_id = graph->listeners.source_sink_ports_disconnected->len - 1;
+ BT_LIB_LOGV("Added \"source to sink component ports disconnected\" listener to graph: "
+ "%![graph-]+g, listener-addr=%p, id=%d", graph, listener,
+ listener_id);
+
+ if (listener_id) {
+ *out_listener_id = listener_id;
+ }
+
+ return BT_GRAPH_STATUS_OK;
+}
+
+enum bt_graph_status
+bt_private_graph_add_filter_sink_component_ports_disconnected_listener(
+ struct bt_private_graph *priv_graph,
+ bt_private_graph_filter_sink_component_ports_disconnected_listener func,
+ bt_private_graph_listener_removed listener_removed, void *data,
+ int *out_listener_id)
+{
+ struct bt_graph *graph = (void *) priv_graph;
+ struct bt_graph_listener_ports_disconnected listener = {
+ .base = {
+ .removed = listener_removed,
+ .data = data,
+ },
+ .func = (ports_disconnected_func_t) func,
+ };
+ int listener_id;
+
+ BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_NON_NULL(func, "Listener");
+ BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
+ BT_ASSERT_PRE(!graph->in_remove_listener,
+ "Graph currently executing a \"listener removed\" listener: "
+ "%!+g", graph);
+ g_array_append_val(graph->listeners.filter_sink_ports_disconnected,
+ listener);
+ listener_id = graph->listeners.filter_sink_ports_disconnected->len - 1;
+ BT_LIB_LOGV("Added \"filter to sink component ports disconnected\" listener to graph: "
+ "%![graph-]+g, listener-addr=%p, id=%d", graph, listener,
+ listener_id);
+
+ if (listener_id) {
+ *out_listener_id = listener_id;
+ }
+
+ return BT_GRAPH_STATUS_OK;