+ ret = bt_self_component_sink_add_input_port(component,
+ "in", NULL, NULL);
+ if (ret != BT_SELF_COMPONENT_STATUS_OK) {
+ goto error;
+ }
+
+ bt_self_component_set_data(
+ bt_self_component_sink_as_self_component(component), dummy);
+ goto end;
+
+error:
+ destroy_private_dummy_data(dummy);
+
+end:
+ return ret;
+}
+
+BT_HIDDEN
+bt_self_component_status dummy_graph_is_configured(
+ bt_self_component_sink *comp)
+{
+ bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ struct dummy *dummy;
+ bt_self_component_port_input_message_iterator *iterator;
+
+ dummy = bt_self_component_get_data(
+ bt_self_component_sink_as_self_component(comp));
+ BT_ASSERT(dummy);
+ iterator = bt_self_component_port_input_message_iterator_create(
+ bt_self_component_sink_borrow_input_port_by_name(comp,
+ in_port_name));
+ if (!iterator) {
+ status = BT_SELF_COMPONENT_STATUS_NOMEM;
+ goto end;
+ }
+
+ BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+ dummy->msg_iter, iterator);
+
+end:
+ return status;
+}
+
+BT_HIDDEN
+bt_self_component_status dummy_consume(
+ bt_self_component_sink *component)
+{
+ bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_message_array_const msgs;
+ uint64_t count;
+ struct dummy *dummy;
+ bt_message_iterator_status it_ret;
+ uint64_t i;
+
+ dummy = bt_self_component_get_data(
+ bt_self_component_sink_as_self_component(component));
+ BT_ASSERT(dummy);
+
+ if (unlikely(!dummy->msg_iter)) {
+ ret = BT_SELF_COMPONENT_STATUS_END;
+ goto end;
+ }
+
+ /* Consume one message */
+ it_ret = bt_self_component_port_input_message_iterator_next(
+ dummy->msg_iter, &msgs, &count);
+ switch (it_ret) {
+ case BT_MESSAGE_ITERATOR_STATUS_OK:
+ ret = BT_SELF_COMPONENT_STATUS_OK;
+
+ for (i = 0; i < count; i++) {
+ bt_message_put_ref(msgs[i]);
+ }
+
+ break;
+ case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+ ret = BT_SELF_COMPONENT_STATUS_AGAIN;
+ goto end;
+ case BT_MESSAGE_ITERATOR_STATUS_END:
+ ret = BT_SELF_COMPONENT_STATUS_END;
+ goto end;
+ case BT_MESSAGE_ITERATOR_STATUS_ERROR:
+ ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ goto end;
+ case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
+ ret = BT_SELF_COMPONENT_STATUS_NOMEM;
+ goto end;
+ default:
+ break;