lib: rename "notification" -> "message"
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 8 Dec 2018 18:07:25 +0000 (13:07 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
The term "notification" is usually used, in APIs, for asynchronous
alerts of some sort. You get notified for something that you were not
actively waiting for, like an interrupt.

From Merriam-Webster, a _message_ is:

> a communication in writing, in speech, or by signals

and a _communication_ is:

> information communicated : information transmitted or conveyed

Therefore, "message" seems more adapted than "notification" for
Babeltrace's API, where you actively iterate messages which are
communications from an upstream component to a downstream component.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
128 files changed:
.gitignore
cli/babeltrace.c
configure.ac
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/graph/component-class-filter.h
include/babeltrace/graph/component-class-internal.h
include/babeltrace/graph/component-class-sink-colander-internal.h
include/babeltrace/graph/component-class-source.h
include/babeltrace/graph/connection-internal.h
include/babeltrace/graph/graph-internal.h
include/babeltrace/graph/message-const.h [new file with mode: 0644]
include/babeltrace/graph/message-event-const.h [new file with mode: 0644]
include/babeltrace/graph/message-event-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-event.h [new file with mode: 0644]
include/babeltrace/graph/message-inactivity-const.h [new file with mode: 0644]
include/babeltrace/graph/message-inactivity-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-inactivity.h [new file with mode: 0644]
include/babeltrace/graph/message-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-iterator-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-iterator.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-const.h [new file with mode: 0644]
include/babeltrace/graph/message-packet-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-packet.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-const.h [new file with mode: 0644]
include/babeltrace/graph/message-stream-internal.h [new file with mode: 0644]
include/babeltrace/graph/message-stream.h [new file with mode: 0644]
include/babeltrace/graph/notification-const.h [deleted file]
include/babeltrace/graph/notification-event-const.h [deleted file]
include/babeltrace/graph/notification-event-internal.h [deleted file]
include/babeltrace/graph/notification-event.h [deleted file]
include/babeltrace/graph/notification-inactivity-const.h [deleted file]
include/babeltrace/graph/notification-inactivity-internal.h [deleted file]
include/babeltrace/graph/notification-inactivity.h [deleted file]
include/babeltrace/graph/notification-internal.h [deleted file]
include/babeltrace/graph/notification-iterator-internal.h [deleted file]
include/babeltrace/graph/notification-iterator.h [deleted file]
include/babeltrace/graph/notification-packet-const.h [deleted file]
include/babeltrace/graph/notification-packet-internal.h [deleted file]
include/babeltrace/graph/notification-packet.h [deleted file]
include/babeltrace/graph/notification-stream-const.h [deleted file]
include/babeltrace/graph/notification-stream-internal.h [deleted file]
include/babeltrace/graph/notification-stream.h [deleted file]
include/babeltrace/graph/port-output-message-iterator.h [new file with mode: 0644]
include/babeltrace/graph/port-output-notification-iterator.h [deleted file]
include/babeltrace/graph/self-component-port-input-message-iterator.h [new file with mode: 0644]
include/babeltrace/graph/self-component-port-input-notification-iterator.h [deleted file]
include/babeltrace/graph/self-message-iterator.h [new file with mode: 0644]
include/babeltrace/graph/self-notification-iterator.h [deleted file]
include/babeltrace/lib-logging-internal.h
include/babeltrace/plugin/plugin-dev.h
include/babeltrace/types.h
lib/graph/Makefile.am
lib/graph/component-class-sink-colander.c
lib/graph/component-class.c
lib/graph/component-source.c
lib/graph/component.c
lib/graph/connection.c
lib/graph/graph.c
lib/graph/iterator.c
lib/graph/message/Makefile.am [new file with mode: 0644]
lib/graph/message/discarded-events.c [new file with mode: 0644]
lib/graph/message/discarded-packets.c [new file with mode: 0644]
lib/graph/message/event.c [new file with mode: 0644]
lib/graph/message/inactivity.c [new file with mode: 0644]
lib/graph/message/message.c [new file with mode: 0644]
lib/graph/message/packet.c [new file with mode: 0644]
lib/graph/message/stream.c [new file with mode: 0644]
lib/graph/notification/Makefile.am [deleted file]
lib/graph/notification/discarded-events.c [deleted file]
lib/graph/notification/discarded-packets.c [deleted file]
lib/graph/notification/event.c [deleted file]
lib/graph/notification/inactivity.c [deleted file]
lib/graph/notification/notification.c [deleted file]
lib/graph/notification/packet.c [deleted file]
lib/graph/notification/stream.c [deleted file]
lib/lib-logging.c
lib/plugin/plugin-so.c
plugins/ctf/common/Makefile.am
plugins/ctf/common/bfcr/bfcr.h
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/msg-iter/Makefile.am [new file with mode: 0644]
plugins/ctf/common/msg-iter/logging.c [new file with mode: 0644]
plugins/ctf/common/msg-iter/logging.h [new file with mode: 0644]
plugins/ctf/common/msg-iter/msg-iter.c [new file with mode: 0644]
plugins/ctf/common/msg-iter/msg-iter.h [new file with mode: 0644]
plugins/ctf/common/notif-iter/Makefile.am [deleted file]
plugins/ctf/common/notif-iter/logging.c [deleted file]
plugins/ctf/common/notif-iter/logging.h [deleted file]
plugins/ctf/common/notif-iter/notif-iter.c [deleted file]
plugins/ctf/common/notif-iter/notif-iter.h [deleted file]
plugins/ctf/fs-sink/writer.c
plugins/ctf/fs-sink/writer.h
plugins/ctf/fs-src/data-stream-file.c
plugins/ctf/fs-src/data-stream-file.h
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/fs.h
plugins/ctf/lttng-live/data-stream.c
plugins/ctf/lttng-live/data-stream.h
plugins/ctf/lttng-live/lttng-live-internal.h
plugins/ctf/lttng-live/lttng-live.c
plugins/ctf/lttng-live/lttng-viewer-abi.h
plugins/ctf/lttng-live/viewer-connection.c
plugins/ctf/plugin.c
plugins/lttng-utils/copy.c
plugins/lttng-utils/debug-info.h
plugins/lttng-utils/plugin.c
plugins/text/dmesg/dmesg.c
plugins/text/dmesg/dmesg.h
plugins/text/plugin.c
plugins/text/pretty/pretty.c
plugins/text/pretty/pretty.h
plugins/text/pretty/print.c
plugins/utils/counter/counter.c
plugins/utils/counter/counter.h
plugins/utils/dummy/dummy.c
plugins/utils/dummy/dummy.h
plugins/utils/muxer/muxer.c
plugins/utils/muxer/muxer.h
plugins/utils/plugin.c
plugins/utils/trimmer/copy.c
plugins/utils/trimmer/iterator.c
plugins/utils/trimmer/iterator.h
tests/lib/Makefile.am
tests/lib/test-plugin-plugins/sfs.c
tests/lib/test_bt_message_iterator.c [new file with mode: 0644]
tests/lib/test_bt_notification_iterator.c [deleted file]
tests/lib/test_graph_topo.c

index 0ef95c97367d7329c79f77de2b2c8b317f17d0ca..71a74bf4863592e2bbef0c691c4c413761026311 100644 (file)
@@ -15,7 +15,6 @@
 /tests/lib/test_bin_info_complete
 /tests/lib/test_bitfield
 /tests/lib/test_bt_ctf_field_type_validation
-/tests/lib/test_bt_notification_heap
 /tests/lib/test_bt_objects
 /tests/lib/test_bt_values
 /tests/lib/test_trace_ir_ref
@@ -30,7 +29,7 @@
 /tests/lib/writer/bt_python_helper.py
 /tests/lib/writer/test_ctf_writer_empty_packet.py
 /tests/lib/writer/test_ctf_writer_no_packet_context.py
-/tests/lib/test_bt_notification_iterator
+/tests/lib/test_bt_message_iterator
 /tests/lib/test_cc_prio_map
 /tests/lib/test_graph_topo
 /tests/lib/trace-ir/test_trace_ir
index ae1a9263454e3030c9b031554163d973cf7fbd0d..101fb5f5a010cf8f9fa669822b88869d5e5c02ed 100644 (file)
@@ -56,7 +56,7 @@ static const char* log_level_env_var_names[] = {
        "BABELTRACE_SRC_CTF_FS_LOG_LEVEL",
        "BABELTRACE_SRC_CTF_LTTNG_LIVE_LOG_LEVEL",
        "BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL",
-       "BABELTRACE_PLUGIN_CTF_NOTIF_ITER_LOG_LEVEL",
+       "BABELTRACE_PLUGIN_CTF_MSG_ITER_LOG_LEVEL",
        "BABELTRACE_PLUGIN_CTFCOPYTRACE_LIB_LOG_LEVEL",
        "BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL",
        "BABELTRACE_SRC_TEXT_DMESG_LOG_LEVEL",
index d03990f085093ec959dc7f1d892996a1d3eef136..ce51dbeddd8bfe57c24b363411eee24f883804f4 100644 (file)
@@ -743,7 +743,7 @@ AC_CONFIG_FILES([
        lib/prio_heap/Makefile
        lib/plugin/Makefile
        lib/graph/Makefile
-       lib/graph/notification/Makefile
+       lib/graph/message/Makefile
        lib/trace-ir/Makefile
        lib/ctf-writer/Makefile
        include/Makefile
@@ -772,7 +772,7 @@ AC_CONFIG_FILES([
        plugins/ctf/common/Makefile
        plugins/ctf/common/bfcr/Makefile
        plugins/ctf/common/metadata/Makefile
-       plugins/ctf/common/notif-iter/Makefile
+       plugins/ctf/common/msg-iter/Makefile
        plugins/ctf/common/utils/Makefile
        plugins/ctf/fs-src/Makefile
        plugins/ctf/fs-sink/Makefile
index 09bfcf750fbf0d4028a76fe9333204bf29b34037..0edf60da0b8d2b928b9babcaade5fa0475afff9f 100644 (file)
@@ -150,7 +150,7 @@ babeltraceplugininclude_HEADERS = \
        babeltrace/plugin/plugin-const.h \
        babeltrace/plugin/plugin-set-const.h
 
-# Graph, component, and notification API
+# Graph, component, and message API
 babeltracegraphincludedir = "$(includedir)/babeltrace/graph"
 babeltracegraphinclude_HEADERS = \
        babeltrace/graph/component-class-const.h \
@@ -168,33 +168,33 @@ babeltracegraphinclude_HEADERS = \
        babeltrace/graph/connection-const.h \
        babeltrace/graph/graph-const.h \
        babeltrace/graph/graph.h \
-       babeltrace/graph/notification-const.h \
-       babeltrace/graph/notification-event-const.h \
-       babeltrace/graph/notification-event.h \
-       babeltrace/graph/notification-inactivity-const.h \
-       babeltrace/graph/notification-inactivity.h \
-       babeltrace/graph/notification-packet-const.h \
-       babeltrace/graph/notification-packet.h \
-       babeltrace/graph/notification-stream-const.h \
-       babeltrace/graph/notification-stream.h \
+       babeltrace/graph/message-const.h \
+       babeltrace/graph/message-event-const.h \
+       babeltrace/graph/message-event.h \
+       babeltrace/graph/message-inactivity-const.h \
+       babeltrace/graph/message-inactivity.h \
+       babeltrace/graph/message-packet-const.h \
+       babeltrace/graph/message-packet.h \
+       babeltrace/graph/message-stream-const.h \
+       babeltrace/graph/message-stream.h \
        babeltrace/graph/port-const.h \
        babeltrace/graph/port-input-const.h \
        babeltrace/graph/port-output-const.h \
-       babeltrace/graph/port-output-notification-iterator.h \
+       babeltrace/graph/port-output-message-iterator.h \
        babeltrace/graph/query-executor-const.h \
        babeltrace/graph/query-executor.h \
        babeltrace/graph/self-component-class-filter.h \
        babeltrace/graph/self-component-class-sink.h \
        babeltrace/graph/self-component-class-source.h \
        babeltrace/graph/self-component-filter.h \
-       babeltrace/graph/self-component-port-input-notification-iterator.h \
+       babeltrace/graph/self-component-port-input-message-iterator.h \
        babeltrace/graph/self-component-port-input.h \
        babeltrace/graph/self-component-port-output.h \
        babeltrace/graph/self-component-port.h \
        babeltrace/graph/self-component-sink.h \
        babeltrace/graph/self-component-source.h \
        babeltrace/graph/self-component.h \
-       babeltrace/graph/self-notification-iterator.h
+       babeltrace/graph/self-message-iterator.h
 
 noinst_HEADERS = \
        babeltrace/compat/stdlib-internal.h \
@@ -271,12 +271,12 @@ noinst_HEADERS = \
        babeltrace/graph/component-source-internal.h \
        babeltrace/graph/connection-internal.h \
        babeltrace/graph/graph-internal.h \
-       babeltrace/graph/notification-event-internal.h \
-       babeltrace/graph/notification-inactivity-internal.h \
-       babeltrace/graph/notification-internal.h \
-       babeltrace/graph/notification-iterator-internal.h \
-       babeltrace/graph/notification-packet-internal.h \
-       babeltrace/graph/notification-stream-internal.h \
+       babeltrace/graph/message-event-internal.h \
+       babeltrace/graph/message-inactivity-internal.h \
+       babeltrace/graph/message-internal.h \
+       babeltrace/graph/message-iterator-internal.h \
+       babeltrace/graph/message-packet-internal.h \
+       babeltrace/graph/message-stream-internal.h \
        babeltrace/graph/port-internal.h \
        babeltrace/graph/query-executor-internal.h \
        babeltrace/list-internal.h \
index 0d3499951a0cfb7504d434134eea65e945459992..01b220d1bb3dad0847a8b6ff050ac192162325e2 100644 (file)
@@ -94,7 +94,7 @@
 #include <babeltrace/plugin/plugin-dev.h>
 #include <babeltrace/plugin/plugin-set-const.h>
 
-/* Graph, component, and notification API */
+/* Graph, component, and message API */
 #include <babeltrace/graph/component-class-const.h>
 #include <babeltrace/graph/component-class-filter-const.h>
 #include <babeltrace/graph/component-class-filter.h>
 #include <babeltrace/graph/connection-const.h>
 #include <babeltrace/graph/graph-const.h>
 #include <babeltrace/graph/graph.h>
-#include <babeltrace/graph/notification-const.h>
-#include <babeltrace/graph/notification-event-const.h>
-#include <babeltrace/graph/notification-event.h>
-#include <babeltrace/graph/notification-inactivity-const.h>
-#include <babeltrace/graph/notification-inactivity.h>
-#include <babeltrace/graph/notification-packet-const.h>
-#include <babeltrace/graph/notification-packet.h>
-#include <babeltrace/graph/notification-stream-const.h>
-#include <babeltrace/graph/notification-stream.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/graph/message-event-const.h>
+#include <babeltrace/graph/message-event.h>
+#include <babeltrace/graph/message-inactivity-const.h>
+#include <babeltrace/graph/message-inactivity.h>
+#include <babeltrace/graph/message-packet-const.h>
+#include <babeltrace/graph/message-packet.h>
+#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream.h>
 #include <babeltrace/graph/port-const.h>
 #include <babeltrace/graph/port-input-const.h>
 #include <babeltrace/graph/port-output-const.h>
-#include <babeltrace/graph/port-output-notification-iterator.h>
+#include <babeltrace/graph/port-output-message-iterator.h>
 #include <babeltrace/graph/query-executor-const.h>
 #include <babeltrace/graph/query-executor.h>
 #include <babeltrace/graph/self-component-class-filter.h>
 #include <babeltrace/graph/self-component-class-sink.h>
 #include <babeltrace/graph/self-component-class-source.h>
 #include <babeltrace/graph/self-component-filter.h>
-#include <babeltrace/graph/self-component-port-input-notification-iterator.h>
+#include <babeltrace/graph/self-component-port-input-message-iterator.h>
 #include <babeltrace/graph/self-component-port-input.h>
 #include <babeltrace/graph/self-component-port-output.h>
 #include <babeltrace/graph/self-component-port.h>
 #include <babeltrace/graph/self-component-sink.h>
 #include <babeltrace/graph/self-component-source.h>
 #include <babeltrace/graph/self-component.h>
-#include <babeltrace/graph/self-notification-iterator.h>
+#include <babeltrace/graph/self-message-iterator.h>
 
 #endif /* BABELTRACE_BABELTRACE_H */
index d7832cff0bb23da71bcb3b513f0fa91501d130d5..80aeeb7475d06404a0d788c73e8c187d7b5f04ee 100644 (file)
@@ -29,8 +29,8 @@
 /* For enum bt_self_component_status */
 #include <babeltrace/graph/self-component.h>
 
-/* For enum bt_self_notification_iterator_status */
-#include <babeltrace/graph/self-notification-iterator.h>
+/* For enum bt_self_message_iterator_status */
+#include <babeltrace/graph/self-message-iterator.h>
 
 /* For enum bt_query_status */
 #include <babeltrace/graph/component-class.h>
@@ -39,7 +39,7 @@
  * For bt_component_class, bt_component_class_filter, bt_port_input,
  * bt_port_output, bt_query_executor, bt_self_component_class_filter,
  * bt_self_component_filter, bt_self_component_port_input,
- * bt_self_component_port_output, bt_value, bt_notification_array_const
+ * bt_self_component_port_output, bt_value, bt_message_array_const
  */
 #include <babeltrace/types.h>
 
@@ -55,20 +55,20 @@ typedef enum bt_self_component_status
 typedef void (*bt_component_class_filter_finalize_method)(
                bt_self_component_filter *self_component);
 
-typedef enum bt_self_notification_iterator_status
-(*bt_component_class_filter_notification_iterator_init_method)(
-               bt_self_notification_iterator *notification_iterator,
+typedef enum bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_init_method)(
+               bt_self_message_iterator *message_iterator,
                bt_self_component_filter *self_component,
                bt_self_component_port_output *port);
 
 typedef void
-(*bt_component_class_filter_notification_iterator_finalize_method)(
-               bt_self_notification_iterator *notification_iterator);
+(*bt_component_class_filter_message_iterator_finalize_method)(
+               bt_self_message_iterator *message_iterator);
 
-typedef enum bt_self_notification_iterator_status
-(*bt_component_class_filter_notification_iterator_next_method)(
-               bt_self_notification_iterator *notification_iterator,
-               bt_notification_array_const notifs, uint64_t capacity,
+typedef enum bt_self_message_iterator_status
+(*bt_component_class_filter_message_iterator_next_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count);
 
 typedef enum bt_query_status
@@ -122,7 +122,7 @@ bt_component_class *bt_component_class_filter_as_component_class(
 extern
 bt_component_class_filter *bt_component_class_filter_create(
                const char *name,
-               bt_component_class_filter_notification_iterator_next_method method);
+               bt_component_class_filter_message_iterator_next_method method);
 
 extern int bt_component_class_filter_set_init_method(
                bt_component_class_filter *comp_class,
@@ -160,13 +160,13 @@ extern int bt_component_class_filter_set_query_method(
                bt_component_class_filter *comp_class,
                bt_component_class_filter_query_method method);
 
-extern int bt_component_class_filter_set_notification_iterator_init_method(
+extern int bt_component_class_filter_set_message_iterator_init_method(
                bt_component_class_filter *comp_class,
-               bt_component_class_filter_notification_iterator_init_method method);
+               bt_component_class_filter_message_iterator_init_method method);
 
-extern int bt_component_class_filter_set_notification_iterator_finalize_method(
+extern int bt_component_class_filter_set_message_iterator_finalize_method(
                bt_component_class_filter *comp_class,
-               bt_component_class_filter_notification_iterator_finalize_method method);
+               bt_component_class_filter_message_iterator_finalize_method method);
 
 #ifdef __cplusplus
 }
index 909d450ea5bf71a103fc6ab7923bb1e6d3daf75a..741129ee95c08c864c741dff40a414ab4f61d6c2 100644 (file)
@@ -67,9 +67,9 @@ struct bt_component_class_source {
        struct {
                bt_component_class_source_init_method init;
                bt_component_class_source_finalize_method finalize;
-               bt_component_class_source_notification_iterator_init_method notif_iter_init;
-               bt_component_class_source_notification_iterator_finalize_method notif_iter_finalize;
-               bt_component_class_source_notification_iterator_next_method notif_iter_next;
+               bt_component_class_source_message_iterator_init_method msg_iter_init;
+               bt_component_class_source_message_iterator_finalize_method msg_iter_finalize;
+               bt_component_class_source_message_iterator_next_method msg_iter_next;
                bt_component_class_source_query_method query;
                bt_component_class_source_accept_output_port_connection_method accept_output_port_connection;
                bt_component_class_source_output_port_connected_method output_port_connected;
@@ -95,9 +95,9 @@ struct bt_component_class_filter {
        struct {
                bt_component_class_filter_init_method init;
                bt_component_class_filter_finalize_method finalize;
-               bt_component_class_filter_notification_iterator_init_method notif_iter_init;
-               bt_component_class_filter_notification_iterator_finalize_method notif_iter_finalize;
-               bt_component_class_filter_notification_iterator_next_method notif_iter_next;
+               bt_component_class_filter_message_iterator_init_method msg_iter_init;
+               bt_component_class_filter_message_iterator_finalize_method msg_iter_finalize;
+               bt_component_class_filter_message_iterator_next_method msg_iter_next;
                bt_component_class_filter_query_method query;
                bt_component_class_filter_accept_input_port_connection_method accept_input_port_connection;
                bt_component_class_filter_accept_output_port_connection_method accept_output_port_connection;
index 037c64b1428f4c236be7fb678b62163acdf51d88..a56f0b4e5a6757b7b56a4062d84d52d330c5cb2a 100644 (file)
 
 #include <stdint.h>
 #include <babeltrace/types.h>
-#include <babeltrace/graph/notification-const.h>
+#include <babeltrace/graph/message-const.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct bt_component_class_sink_colander_data {
-       bt_notification_array_const notifs;
+       bt_message_array_const msgs;
        uint64_t *count_addr;
 };
 
index 77444ec2083cd732b1c59103db58e1cc7b03f35e..d0fed047dbc89037ce6d2688679a46d09d8231f7 100644 (file)
@@ -29,8 +29,8 @@
 /* For enum bt_self_component_status */
 #include <babeltrace/graph/self-component.h>
 
-/* For enum bt_self_notification_iterator_status */
-#include <babeltrace/graph/self-notification-iterator.h>
+/* For enum bt_self_message_iterator_status */
+#include <babeltrace/graph/self-message-iterator.h>
 
 /* For enum bt_query_status */
 #include <babeltrace/graph/component-class.h>
@@ -39,7 +39,7 @@
  * For bt_component_class, bt_component_class_source, bt_port_input,
  * bt_query_executor, bt_self_component_class_source,
  * bt_self_component_source, bt_self_component_port_output, bt_value,
- * bt_notification_array_const
+ * bt_message_array_const
  */
 #include <babeltrace/types.h>
 
@@ -55,20 +55,20 @@ typedef enum bt_self_component_status
 typedef void (*bt_component_class_source_finalize_method)(
                bt_self_component_source *self_component);
 
-typedef enum bt_self_notification_iterator_status
-(*bt_component_class_source_notification_iterator_init_method)(
-               bt_self_notification_iterator *notification_iterator,
+typedef enum bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_init_method)(
+               bt_self_message_iterator *message_iterator,
                bt_self_component_source *self_component,
                bt_self_component_port_output *port);
 
 typedef void
-(*bt_component_class_source_notification_iterator_finalize_method)(
-               bt_self_notification_iterator *notification_iterator);
+(*bt_component_class_source_message_iterator_finalize_method)(
+               bt_self_message_iterator *message_iterator);
 
-typedef enum bt_self_notification_iterator_status
-(*bt_component_class_source_notification_iterator_next_method)(
-               bt_self_notification_iterator *notification_iterator,
-               bt_notification_array_const notifs, uint64_t capacity,
+typedef enum bt_self_message_iterator_status
+(*bt_component_class_source_message_iterator_next_method)(
+               bt_self_message_iterator *message_iterator,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count);
 
 typedef enum bt_query_status
@@ -105,7 +105,7 @@ bt_component_class *bt_component_class_source_as_component_class(
 extern
 bt_component_class_source *bt_component_class_source_create(
                const char *name,
-               bt_component_class_source_notification_iterator_next_method method);
+               bt_component_class_source_message_iterator_next_method method);
 
 extern int bt_component_class_source_set_init_method(
                bt_component_class_source *comp_class,
@@ -131,13 +131,13 @@ extern int bt_component_class_source_set_query_method(
                bt_component_class_source *comp_class,
                bt_component_class_source_query_method method);
 
-extern int bt_component_class_source_set_notification_iterator_init_method(
+extern int bt_component_class_source_set_message_iterator_init_method(
                bt_component_class_source *comp_class,
-               bt_component_class_source_notification_iterator_init_method method);
+               bt_component_class_source_message_iterator_init_method method);
 
-extern int bt_component_class_source_set_notification_iterator_finalize_method(
+extern int bt_component_class_source_set_message_iterator_finalize_method(
                bt_component_class_source *comp_class,
-               bt_component_class_source_notification_iterator_finalize_method method);
+               bt_component_class_source_message_iterator_finalize_method method);
 
 #ifdef __cplusplus
 }
index 2395fcd3cf5d7056dd84c16c8676ef14b3ba78ac..c86bc82dfc3fd15c7ec0bd365e527c9a5e475a8e 100644 (file)
@@ -25,8 +25,8 @@
  */
 
 #include <babeltrace/graph/connection-const.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/message-iterator.h>
+#include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/assert-internal.h>
 #include <stdbool.h>
@@ -50,17 +50,17 @@ struct bt_connection {
        struct bt_port *upstream_port;
 
        /*
-        * Weak references to all the notification iterators that were
+        * Weak references to all the message iterators that were
         * created on this connection.
         */
        GPtrArray *iterators;
 
-       bool notified_upstream_port_connected;
-       bool notified_upstream_port_disconnected;
-       bool notified_downstream_port_connected;
-       bool notified_downstream_port_disconnected;
-       bool notified_graph_ports_connected;
-       bool notified_graph_ports_disconnected;
+       bool msgied_upstream_port_connected;
+       bool msgied_upstream_port_disconnected;
+       bool msgied_downstream_port_connected;
+       bool msgied_downstream_port_disconnected;
+       bool msgied_graph_ports_connected;
+       bool msgied_graph_ports_disconnected;
 };
 
 BT_HIDDEN
@@ -73,7 +73,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph);
 
 BT_HIDDEN
 void bt_connection_remove_iterator(struct bt_connection *conn,
-               struct bt_self_component_port_input_notification_iterator *iterator);
+               struct bt_self_component_port_input_message_iterator *iterator);
 
 static inline
 struct bt_graph *bt_connection_borrow_graph(struct bt_connection *conn)
index 2ff92d35f741e63b20800589c7fb8ec831107172..09927fcf0aeb740538636111772082dd2cbb7e8b 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <babeltrace/graph/graph.h>
 #include <babeltrace/graph/connection-internal.h>
-#include <babeltrace/graph/notification-const.h>
+#include <babeltrace/graph/message-const.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/object-pool-internal.h>
@@ -67,7 +67,7 @@ struct bt_graph {
         * BT_GRAPH_STATUS_CANNOT_CONSUME. The internal "no check"
         * functions always work.
         *
-        * In bt_port_output_notification_iterator_create(), on success,
+        * In bt_port_output_message_iterator_create(), on success,
         * this flag is cleared so that the iterator remains the only
         * consumer for the graph's lifetime.
         */
@@ -90,30 +90,30 @@ struct bt_graph {
                GArray *filter_sink_ports_disconnected;
        } listeners;
 
-       /* Pool of `struct bt_notification_event *` */
-       struct bt_object_pool event_notif_pool;
+       /* Pool of `struct bt_message_event *` */
+       struct bt_object_pool event_msg_pool;
 
-       /* Pool of `struct bt_notification_packet_beginning *` */
-       struct bt_object_pool packet_begin_notif_pool;
+       /* Pool of `struct bt_message_packet_beginning *` */
+       struct bt_object_pool packet_begin_msg_pool;
 
-       /* Pool of `struct bt_notification_packet_end *` */
-       struct bt_object_pool packet_end_notif_pool;
+       /* Pool of `struct bt_message_packet_end *` */
+       struct bt_object_pool packet_end_msg_pool;
 
        /*
-        * Array of `struct bt_notification *` (weak).
+        * Array of `struct bt_message *` (weak).
         *
-        * This is an array of all the notifications ever created from
+        * This is an array of all the messages ever created from
         * this graph. Some of them can be in one of the pools above,
-        * some of them can be at large. Because each notification has a
+        * some of them can be at large. Because each message has a
         * weak pointer to the graph containing its pool, we need to
-        * notify each notification that the graph is gone on graph
+        * notify each message that the graph is gone on graph
         * destruction.
         *
         * TODO: When we support a maximum size for object pools,
-        * add a way for a notification to remove itself from this
+        * add a way for a message to remove itself from this
         * array (on destruction).
         */
-       GPtrArray *notifications;
+       GPtrArray *messages;
 };
 
 static inline
@@ -168,8 +168,8 @@ int bt_graph_remove_unconnected_component(struct bt_graph *graph,
                struct bt_component *component);
 
 BT_HIDDEN
-void bt_graph_add_notification(struct bt_graph *graph,
-               struct bt_notification *notif);
+void bt_graph_add_message(struct bt_graph *graph,
+               struct bt_message *msg);
 
 static inline
 const char *bt_graph_status_string(enum bt_graph_status status)
diff --git a/include/babeltrace/graph/message-const.h b/include/babeltrace/graph/message-const.h
new file mode 100644 (file)
index 0000000..e345ca4
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Message types. Unhandled message types should be ignored.
+ */
+enum bt_message_type {
+       BT_MESSAGE_TYPE_EVENT =                 0,
+       BT_MESSAGE_TYPE_INACTIVITY =            1,
+       BT_MESSAGE_TYPE_STREAM_BEGINNING =      2,
+       BT_MESSAGE_TYPE_STREAM_END =            3,
+       BT_MESSAGE_TYPE_PACKET_BEGINNING =      4,
+       BT_MESSAGE_TYPE_PACKET_END =            5,
+};
+
+/**
+ * Get a message's type.
+ *
+ * @param message      Message instance
+ * @returns            One of #bt_message_type
+ */
+extern enum bt_message_type bt_message_get_type(
+               const bt_message *message);
+
+extern void bt_message_get_ref(const bt_message *message);
+
+extern void bt_message_put_ref(const bt_message *message);
+
+#define BT_MESSAGE_PUT_REF_AND_RESET(_var)             \
+       do {                                            \
+               bt_message_put_ref(_var);               \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_MESSAGE_MOVE_REF(_var_dst, _var_src)        \
+       do {                                            \
+               bt_message_put_ref(_var_dst);   \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_CONST_H */
diff --git a/include/babeltrace/graph/message-event-const.h b/include/babeltrace/graph/message-event-const.h
new file mode 100644 (file)
index 0000000..8d0d6fc
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_EVENT_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_EVENT_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_event */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_event *bt_message_event_borrow_event_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_EVENT_CONST_H */
diff --git a/include/babeltrace/graph/message-event-internal.h b/include/babeltrace/graph/message-event-internal.h
new file mode 100644 (file)
index 0000000..5727df2
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_EVENT_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_EVENT_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/event-class.h>
+#include <babeltrace/trace-ir/event.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/assert-internal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_message_event {
+       struct bt_message parent;
+       struct bt_event *event;
+};
+
+BT_HIDDEN
+struct bt_message *bt_message_event_new(struct bt_graph *graph);
+
+BT_HIDDEN
+void bt_message_event_recycle(struct bt_message *msg);
+
+BT_HIDDEN
+void bt_message_event_destroy(struct bt_message *msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_EVENT_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-event.h b/include/babeltrace/graph/message-event.h
new file mode 100644 (file)
index 0000000..9a72747
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_EVENT_H
+#define BABELTRACE_GRAPH_MESSAGE_EVENT_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * For bt_self_message_iterator, bt_event, bt_packet,
+ * bt_event_class, bt_message
+ */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_event_create(
+               bt_self_message_iterator *message_iterator,
+               bt_event_class *event_class,
+               bt_packet *packet);
+
+extern bt_event *bt_message_event_borrow_event(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_EVENT_H */
diff --git a/include/babeltrace/graph/message-inactivity-const.h b/include/babeltrace/graph/message-inactivity-const.h
new file mode 100644 (file)
index 0000000..7aab72b
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_value */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_clock_value *
+bt_message_inactivity_borrow_default_clock_value_const(
+               const bt_message *msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_CONST_H */
diff --git a/include/babeltrace/graph/message-inactivity-internal.h b/include/babeltrace/graph/message-inactivity-internal.h
new file mode 100644 (file)
index 0000000..b0523ca
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <glib.h>
+#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/graph/message-const.h>
+
+struct bt_message_inactivity {
+       struct bt_message parent;
+       struct bt_clock_value *default_cv;
+};
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-inactivity.h b/include/babeltrace/graph/message-inactivity.h
new file mode 100644 (file)
index 0000000..8425d57
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H
+#define BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_self_message_iterator, bt_message, bt_clock_class */
+#include <babeltrace/types.h>
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_inactivity_create(
+               bt_self_message_iterator *message_iterator,
+               bt_clock_class *default_clock_class);
+
+extern void bt_message_inactivity_set_default_clock_value(
+               bt_message *msg, uint64_t raw_value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_INACTIVITY_H */
diff --git a/include/babeltrace/graph/message-internal.h b/include/babeltrace/graph/message-internal.h
new file mode 100644 (file)
index 0000000..8f6158e
--- /dev/null
@@ -0,0 +1,134 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/graph/graph.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/trace-ir/stream.h>
+#include <babeltrace/object-pool-internal.h>
+#include <babeltrace/types.h>
+
+typedef struct bt_stream *(*get_stream_func)(
+               struct bt_message *message);
+
+struct bt_message {
+       struct bt_object base;
+       enum bt_message_type type;
+       uint64_t seq_num;
+       bt_bool frozen;
+
+       /* Owned by this; keeps the graph alive while the msg. is alive */
+       struct bt_graph *graph;
+};
+
+#define BT_ASSERT_PRE_MSG_IS_TYPE(_msg, _type)                 \
+       BT_ASSERT_PRE(((struct bt_message *) (_msg))->type == (_type), \
+               "Message has the wrong type: expected-type=%s, "        \
+               "%![msg-]+n", bt_message_type_string(_type),    \
+               (_msg))
+
+BT_HIDDEN
+void bt_message_init(struct bt_message *message,
+               enum bt_message_type type,
+               bt_object_release_func release,
+               struct bt_graph *graph);
+
+static inline
+void bt_message_reset(struct bt_message *message)
+{
+       BT_ASSERT(message);
+
+#ifdef BT_DEV_MODE
+       message->frozen = BT_FALSE;
+       message->seq_num = UINT64_C(-1);
+#endif
+}
+
+static inline
+struct bt_message *bt_message_create_from_pool(
+               struct bt_object_pool *pool, struct bt_graph *graph)
+{
+       struct bt_message *msg = bt_object_pool_create_object(pool);
+
+       if (unlikely(!msg)) {
+#ifdef BT_LIB_LOGE
+               BT_LIB_LOGE("Cannot allocate one message from message pool: "
+                       "%![pool-]+o, %![graph-]+g", pool, graph);
+#endif
+               goto error;
+       }
+
+       if (likely(!msg->graph)) {
+               msg->graph = graph;
+       }
+
+       goto end;
+
+error:
+       BT_ASSERT(!msg);
+
+end:
+       return msg;
+}
+
+static inline void _bt_message_freeze(struct bt_message *message)
+{
+       message->frozen = BT_TRUE;
+}
+
+BT_HIDDEN
+void bt_message_unlink_graph(struct bt_message *msg);
+
+#ifdef BT_DEV_MODE
+# define bt_message_freeze             _bt_message_freeze
+#else
+# define bt_message_freeze(_x)
+#endif /* BT_DEV_MODE */
+
+static inline
+const char *bt_message_type_string(enum bt_message_type type)
+{
+       switch (type) {
+       case BT_MESSAGE_TYPE_EVENT:
+               return "BT_MESSAGE_TYPE_EVENT";
+       case BT_MESSAGE_TYPE_INACTIVITY:
+               return "BT_MESSAGE_TYPE_INACTIVITY";
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+               return "BT_MESSAGE_TYPE_STREAM_BEGINNING";
+       case BT_MESSAGE_TYPE_STREAM_END:
+               return "BT_MESSAGE_TYPE_STREAM_END";
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               return "BT_MESSAGE_TYPE_PACKET_BEGINNING";
+       case BT_MESSAGE_TYPE_PACKET_END:
+               return "BT_MESSAGE_TYPE_PACKET_END";
+       default:
+               return "(unknown)";
+       }
+}
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-iterator-internal.h b/include/babeltrace/graph/message-iterator-internal.h
new file mode 100644 (file)
index 0000000..bc60424
--- /dev/null
@@ -0,0 +1,170 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_ITERATOR_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_ITERATOR_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/graph/connection-const.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/graph/message-iterator.h>
+#include <babeltrace/types.h>
+#include <babeltrace/assert-internal.h>
+#include <stdbool.h>
+
+struct bt_port;
+struct bt_graph;
+
+enum bt_message_iterator_type {
+       BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT,
+       BT_MESSAGE_ITERATOR_TYPE_PORT_OUTPUT,
+};
+
+enum bt_self_component_port_input_message_iterator_state {
+       /* Iterator is not initialized. */
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED,
+
+       /* Iterator is active, not at the end yet, and not finalized. */
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE,
+
+       /*
+        * Iterator is ended, not finalized yet: the "next" method
+        * returns BT_MESSAGE_ITERATOR_STATUS_END.
+        */
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED,
+
+       /*
+        * Iterator is finalized, but not at the end yet. This means
+        * that the "next" method can still return queued messages
+        * before returning the BT_MESSAGE_ITERATOR_STATUS_CANCELED
+        * status.
+        */
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED,
+
+       /*
+        * Iterator is finalized and ended: the "next" method always
+        * returns BT_MESSAGE_ITERATOR_STATUS_CANCELED.
+        */
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED,
+};
+
+struct bt_message_iterator {
+       struct bt_object base;
+       enum bt_message_iterator_type type;
+       GPtrArray *msgs;
+};
+
+struct bt_self_component_port_input_message_iterator {
+       struct bt_message_iterator base;
+       struct bt_component *upstream_component; /* Weak */
+       struct bt_port *upstream_port; /* Weak */
+       struct bt_connection *connection; /* Weak */
+       struct bt_graph *graph; /* Weak */
+
+       /*
+        * This hash table keeps the state of a stream as viewed by
+        * this message iterator. This is used to, in developer
+        * mode:
+        *
+        * * Automatically enqueue "stream begin", "packet begin",
+        *   "packet end", and "stream end" messages depending
+        *   on the stream's state and on the next message returned
+        *   by the upstream component.
+        *
+        * * Make sure that, once the message iterator has seen a
+        *   "stream end" message for a given stream, no other
+        *   messages which refer to this stream can be delivered
+        *   by this iterator.
+        *
+        * The key (struct bt_stream *) is not owned by this. The
+        * value is an allocated state structure.
+        */
+       GHashTable *stream_states;
+
+       enum bt_self_component_port_input_message_iterator_state state;
+       void *user_data;
+};
+
+struct bt_port_output_message_iterator {
+       struct bt_message_iterator base;
+       struct bt_graph *graph; /* Owned by this */
+       struct bt_component_sink *colander; /* Owned by this */
+
+       /*
+        * Only used temporarily as a bridge between a colander sink and
+        * the user.
+        */
+       uint64_t count;
+};
+
+BT_HIDDEN
+void bt_self_component_port_input_message_iterator_finalize(
+               struct bt_self_component_port_input_message_iterator *iterator);
+
+BT_HIDDEN
+void bt_self_component_port_input_message_iterator_set_connection(
+               struct bt_self_component_port_input_message_iterator *iterator,
+               struct bt_connection *connection);
+
+static inline
+const char *bt_message_iterator_status_string(
+               enum bt_message_iterator_status status)
+{
+       switch (status) {
+       case BT_MESSAGE_ITERATOR_STATUS_CANCELED:
+               return "BT_MESSAGE_ITERATOR_STATUS_CANCELED";
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+               return "BT_MESSAGE_ITERATOR_STATUS_AGAIN";
+       case BT_MESSAGE_ITERATOR_STATUS_END:
+               return "BT_MESSAGE_ITERATOR_STATUS_END";
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
+               return "BT_MESSAGE_ITERATOR_STATUS_OK";
+       case BT_MESSAGE_ITERATOR_STATUS_ERROR:
+               return "BT_MESSAGE_ITERATOR_STATUS_ERROR";
+       case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
+               return "BT_MESSAGE_ITERATOR_STATUS_NOMEM";
+       default:
+               return "(unknown)";
+       }
+};
+
+static inline
+const char *bt_self_component_port_input_message_iterator_state_string(
+               enum bt_self_component_port_input_message_iterator_state state)
+{
+       switch (state) {
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE:
+               return "BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE";
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED:
+               return "BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED";
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED:
+               return "BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED";
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED:
+               return "BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED";
+       default:
+               return "(unknown)";
+       }
+};
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_ITERATOR_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-iterator.h b/include/babeltrace/graph/message-iterator.h
new file mode 100644 (file)
index 0000000..b54df9c
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_ITERATOR_H
+#define BABELTRACE_GRAPH_MESSAGE_ITERATOR_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_message_iterator */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum bt_message_iterator_status {
+       BT_MESSAGE_ITERATOR_STATUS_OK = 0,
+       BT_MESSAGE_ITERATOR_STATUS_END = 1,
+       BT_MESSAGE_ITERATOR_STATUS_AGAIN = 11,
+       BT_MESSAGE_ITERATOR_STATUS_CANCELED = 125,
+       BT_MESSAGE_ITERATOR_STATUS_ERROR = -1,
+       BT_MESSAGE_ITERATOR_STATUS_NOMEM = -12,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_ITERATOR_H */
diff --git a/include/babeltrace/graph/message-packet-const.h b/include/babeltrace/graph/message-packet-const.h
new file mode 100644 (file)
index 0000000..997b39e
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
+               const bt_message *message);
+
+extern const bt_packet *bt_message_packet_end_borrow_packet_const(
+               const bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_CONST_H */
diff --git a/include/babeltrace/graph/message-packet-internal.h b/include/babeltrace/graph/message-packet-internal.h
new file mode 100644 (file)
index 0000000..5a60e00
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/packet.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/assert-internal.h>
+
+struct bt_message_packet_beginning {
+       struct bt_message parent;
+       struct bt_packet *packet;
+};
+
+struct bt_message_packet_end {
+       struct bt_message parent;
+       struct bt_packet *packet;
+};
+
+BT_HIDDEN
+struct bt_message *bt_message_packet_beginning_new(
+               struct bt_graph *graph);
+BT_HIDDEN
+void bt_message_packet_beginning_recycle(struct bt_message *msg);
+
+BT_HIDDEN
+void bt_message_packet_beginning_destroy(struct bt_message *msg);
+
+BT_HIDDEN
+struct bt_message *bt_message_packet_end_new(struct bt_graph *graph);
+
+BT_HIDDEN
+void bt_message_packet_end_recycle(struct bt_message *msg);
+
+BT_HIDDEN
+void bt_message_packet_end_destroy(struct bt_message *msg);
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-packet.h b/include/babeltrace/graph/message-packet.h
new file mode 100644 (file)
index 0000000..0ee0f6d
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_PACKET_H
+#define BABELTRACE_GRAPH_MESSAGE_PACKET_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_packet */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_packet_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               bt_packet *packet);
+
+extern
+bt_message *bt_message_packet_end_create(
+               bt_self_message_iterator *message_iterator,
+               bt_packet *packet);
+
+extern bt_packet *bt_message_packet_beginning_borrow_packet(
+               bt_message *message);
+
+extern bt_packet *bt_message_packet_end_borrow_packet(
+               bt_message *message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_PACKET_H */
diff --git a/include/babeltrace/graph/message-stream-const.h b/include/babeltrace/graph/message-stream-const.h
new file mode 100644 (file)
index 0000000..9c050e9
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_clock_value, bt_stream */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const bt_stream *bt_message_stream_beginning_borrow_stream_const(
+               const bt_message *message);
+
+extern const bt_clock_value *
+bt_message_stream_beginning_borrow_default_clock_value_const(
+               const bt_message *msg);
+
+extern const bt_stream *bt_message_stream_end_borrow_stream_const(
+               const bt_message *message);
+
+extern const bt_clock_value *
+bt_message_stream_end_borrow_default_clock_value_const(
+               const bt_message *msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_CONST_H */
diff --git a/include/babeltrace/graph/message-stream-internal.h b/include/babeltrace/graph/message-stream-internal.h
new file mode 100644 (file)
index 0000000..b9601b4
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_INTERNAL_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_INTERNAL_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/packet.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/assert-internal.h>
+
+struct bt_message_stream_beginning {
+       struct bt_message parent;
+       struct bt_stream *stream;
+       struct bt_clock_value *default_cv;
+};
+
+struct bt_message_stream_end {
+       struct bt_message parent;
+       struct bt_stream *stream;
+       struct bt_clock_value *default_cv;
+};
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_INTERNAL_H */
diff --git a/include/babeltrace/graph/message-stream.h b/include/babeltrace/graph/message-stream.h
new file mode 100644 (file)
index 0000000..f025396
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef BABELTRACE_GRAPH_MESSAGE_STREAM_H
+#define BABELTRACE_GRAPH_MESSAGE_STREAM_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For bt_message, bt_self_message_iterator, bt_stream */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern
+bt_message *bt_message_stream_beginning_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern
+bt_message *bt_message_stream_end_create(
+               bt_self_message_iterator *message_iterator,
+               bt_stream *stream);
+
+extern bt_stream *bt_message_stream_beginning_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_stream_beginning_set_default_clock_value(
+               bt_message *msg, uint64_t value_cycles);
+
+extern bt_stream *bt_message_stream_end_borrow_stream(
+               bt_message *message);
+
+extern void bt_message_stream_end_set_default_clock_value(
+               bt_message *msg, uint64_t value_cycles);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_MESSAGE_STREAM_H */
diff --git a/include/babeltrace/graph/notification-const.h b/include/babeltrace/graph/notification-const.h
deleted file mode 100644 (file)
index 8754088..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Notification types. Unhandled notification types should be ignored.
- */
-enum bt_notification_type {
-       BT_NOTIFICATION_TYPE_EVENT =                    0,
-       BT_NOTIFICATION_TYPE_INACTIVITY =               1,
-       BT_NOTIFICATION_TYPE_STREAM_BEGINNING =         2,
-       BT_NOTIFICATION_TYPE_STREAM_END =               3,
-       BT_NOTIFICATION_TYPE_PACKET_BEGINNING =         4,
-       BT_NOTIFICATION_TYPE_PACKET_END =               5,
-};
-
-/**
- * Get a notification's type.
- *
- * @param notification Notification instance
- * @returns            One of #bt_notification_type
- */
-extern enum bt_notification_type bt_notification_get_type(
-               const bt_notification *notification);
-
-extern void bt_notification_get_ref(const bt_notification *notification);
-
-extern void bt_notification_put_ref(const bt_notification *notification);
-
-#define BT_NOTIFICATION_PUT_REF_AND_RESET(_var)                \
-       do {                                            \
-               bt_notification_put_ref(_var);          \
-               (_var) = NULL;                          \
-       } while (0)
-
-#define BT_NOTIFICATION_MOVE_REF(_var_dst, _var_src)   \
-       do {                                            \
-               bt_notification_put_ref(_var_dst);      \
-               (_var_dst) = (_var_src);                \
-               (_var_src) = NULL;                      \
-       } while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_CONST_H */
diff --git a/include/babeltrace/graph/notification-event-const.h b/include/babeltrace/graph/notification-event-const.h
deleted file mode 100644 (file)
index a9e47dc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_EVENT_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_EVENT_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_event */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_event *bt_notification_event_borrow_event_const(
-               const bt_notification *notification);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_EVENT_CONST_H */
diff --git a/include/babeltrace/graph/notification-event-internal.h b/include/babeltrace/graph/notification-event-internal.h
deleted file mode 100644 (file)
index ff165e3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_EVENT_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_EVENT_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/event-class.h>
-#include <babeltrace/trace-ir/event.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/assert-internal.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_notification_event {
-       struct bt_notification parent;
-       struct bt_event *event;
-};
-
-BT_HIDDEN
-struct bt_notification *bt_notification_event_new(struct bt_graph *graph);
-
-BT_HIDDEN
-void bt_notification_event_recycle(struct bt_notification *notif);
-
-BT_HIDDEN
-void bt_notification_event_destroy(struct bt_notification *notif);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_EVENT_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-event.h b/include/babeltrace/graph/notification-event.h
deleted file mode 100644 (file)
index be5b94e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_EVENT_H
-#define BABELTRACE_GRAPH_NOTIFICATION_EVENT_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * For bt_self_notification_iterator, bt_event, bt_packet,
- * bt_event_class, bt_notification
- */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_notification *bt_notification_event_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_event_class *event_class,
-               bt_packet *packet);
-
-extern bt_event *bt_notification_event_borrow_event(
-               bt_notification *notification);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_EVENT_H */
diff --git a/include/babeltrace/graph/notification-inactivity-const.h b/include/babeltrace/graph/notification-inactivity-const.h
deleted file mode 100644 (file)
index 9f5bf00..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_clock_value */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_clock_value *
-bt_notification_inactivity_borrow_default_clock_value_const(
-               const bt_notification *notif);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_CONST_H */
diff --git a/include/babeltrace/graph/notification-inactivity-internal.h b/include/babeltrace/graph/notification-inactivity-internal.h
deleted file mode 100644 (file)
index 662c995..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <glib.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/graph/notification-const.h>
-
-struct bt_notification_inactivity {
-       struct bt_notification parent;
-       struct bt_clock_value *default_cv;
-};
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-inactivity.h b/include/babeltrace/graph/notification-inactivity.h
deleted file mode 100644 (file)
index ee9937a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_H
-#define BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_self_notification_iterator, bt_notification, bt_clock_class */
-#include <babeltrace/types.h>
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_notification *bt_notification_inactivity_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_clock_class *default_clock_class);
-
-extern void bt_notification_inactivity_set_default_clock_value(
-               bt_notification *notif, uint64_t raw_value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_INACTIVITY_H */
diff --git a/include/babeltrace/graph/notification-internal.h b/include/babeltrace/graph/notification-internal.h
deleted file mode 100644 (file)
index 1375bc8..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_NOTIFICATION_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_NOTIFICATION_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/babeltrace-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/graph/graph.h>
-#include <babeltrace/graph/notification-const.h>
-#include <babeltrace/trace-ir/stream.h>
-#include <babeltrace/object-pool-internal.h>
-#include <babeltrace/types.h>
-
-typedef struct bt_stream *(*get_stream_func)(
-               struct bt_notification *notification);
-
-struct bt_notification {
-       struct bt_object base;
-       enum bt_notification_type type;
-       uint64_t seq_num;
-       bt_bool frozen;
-
-       /* Owned by this; keeps the graph alive while the notif. is alive */
-       struct bt_graph *graph;
-};
-
-#define BT_ASSERT_PRE_NOTIF_IS_TYPE(_notif, _type)                     \
-       BT_ASSERT_PRE(((struct bt_notification *) (_notif))->type == (_type), \
-               "Notification has the wrong type: expected-type=%s, "   \
-               "%![notif-]+n", bt_notification_type_string(_type),     \
-               (_notif))
-
-BT_HIDDEN
-void bt_notification_init(struct bt_notification *notification,
-               enum bt_notification_type type,
-               bt_object_release_func release,
-               struct bt_graph *graph);
-
-static inline
-void bt_notification_reset(struct bt_notification *notification)
-{
-       BT_ASSERT(notification);
-
-#ifdef BT_DEV_MODE
-       notification->frozen = BT_FALSE;
-       notification->seq_num = UINT64_C(-1);
-#endif
-}
-
-static inline
-struct bt_notification *bt_notification_create_from_pool(
-               struct bt_object_pool *pool, struct bt_graph *graph)
-{
-       struct bt_notification *notif = bt_object_pool_create_object(pool);
-
-       if (unlikely(!notif)) {
-#ifdef BT_LIB_LOGE
-               BT_LIB_LOGE("Cannot allocate one notification from notification pool: "
-                       "%![pool-]+o, %![graph-]+g", pool, graph);
-#endif
-               goto error;
-       }
-
-       if (likely(!notif->graph)) {
-               notif->graph = graph;
-       }
-
-       goto end;
-
-error:
-       BT_ASSERT(!notif);
-
-end:
-       return notif;
-}
-
-static inline void _bt_notification_freeze(struct bt_notification *notification)
-{
-       notification->frozen = BT_TRUE;
-}
-
-BT_HIDDEN
-void bt_notification_unlink_graph(struct bt_notification *notif);
-
-#ifdef BT_DEV_MODE
-# define bt_notification_freeze                _bt_notification_freeze
-#else
-# define bt_notification_freeze(_x)
-#endif /* BT_DEV_MODE */
-
-static inline
-const char *bt_notification_type_string(enum bt_notification_type type)
-{
-       switch (type) {
-       case BT_NOTIFICATION_TYPE_EVENT:
-               return "BT_NOTIFICATION_TYPE_EVENT";
-       case BT_NOTIFICATION_TYPE_INACTIVITY:
-               return "BT_NOTIFICATION_TYPE_INACTIVITY";
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
-               return "BT_NOTIFICATION_TYPE_STREAM_BEGINNING";
-       case BT_NOTIFICATION_TYPE_STREAM_END:
-               return "BT_NOTIFICATION_TYPE_STREAM_END";
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               return "BT_NOTIFICATION_TYPE_PACKET_BEGINNING";
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               return "BT_NOTIFICATION_TYPE_PACKET_END";
-       default:
-               return "(unknown)";
-       }
-}
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_NOTIFICATION_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-iterator-internal.h b/include/babeltrace/graph/notification-iterator-internal.h
deleted file mode 100644 (file)
index 28a322f..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/babeltrace-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/graph/connection-const.h>
-#include <babeltrace/graph/notification-const.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/types.h>
-#include <babeltrace/assert-internal.h>
-#include <stdbool.h>
-
-struct bt_port;
-struct bt_graph;
-
-enum bt_notification_iterator_type {
-       BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT,
-       BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT,
-};
-
-enum bt_self_component_port_input_notification_iterator_state {
-       /* Iterator is not initialized. */
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_NON_INITIALIZED,
-
-       /* Iterator is active, not at the end yet, and not finalized. */
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE,
-
-       /*
-        * Iterator is ended, not finalized yet: the "next" method
-        * returns BT_NOTIFICATION_ITERATOR_STATUS_END.
-        */
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ENDED,
-
-       /*
-        * Iterator is finalized, but not at the end yet. This means
-        * that the "next" method can still return queued notifications
-        * before returning the BT_NOTIFICATION_ITERATOR_STATUS_CANCELED
-        * status.
-        */
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED,
-
-       /*
-        * Iterator is finalized and ended: the "next" method always
-        * returns BT_NOTIFICATION_ITERATOR_STATUS_CANCELED.
-        */
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED,
-};
-
-struct bt_notification_iterator {
-       struct bt_object base;
-       enum bt_notification_iterator_type type;
-       GPtrArray *notifs;
-};
-
-struct bt_self_component_port_input_notification_iterator {
-       struct bt_notification_iterator base;
-       struct bt_component *upstream_component; /* Weak */
-       struct bt_port *upstream_port; /* Weak */
-       struct bt_connection *connection; /* Weak */
-       struct bt_graph *graph; /* Weak */
-
-       /*
-        * This hash table keeps the state of a stream as viewed by
-        * this notification iterator. This is used to, in developer
-        * mode:
-        *
-        * * Automatically enqueue "stream begin", "packet begin",
-        *   "packet end", and "stream end" notifications depending
-        *   on the stream's state and on the next notification returned
-        *   by the upstream component.
-        *
-        * * Make sure that, once the notification iterator has seen a
-        *   "stream end" notification for a given stream, no other
-        *   notifications which refer to this stream can be delivered
-        *   by this iterator.
-        *
-        * The key (struct bt_stream *) is not owned by this. The
-        * value is an allocated state structure.
-        */
-       GHashTable *stream_states;
-
-       enum bt_self_component_port_input_notification_iterator_state state;
-       void *user_data;
-};
-
-struct bt_port_output_notification_iterator {
-       struct bt_notification_iterator base;
-       struct bt_graph *graph; /* Owned by this */
-       struct bt_component_sink *colander; /* Owned by this */
-
-       /*
-        * Only used temporarily as a bridge between a colander sink and
-        * the user.
-        */
-       uint64_t count;
-};
-
-BT_HIDDEN
-void bt_self_component_port_input_notification_iterator_finalize(
-               struct bt_self_component_port_input_notification_iterator *iterator);
-
-BT_HIDDEN
-void bt_self_component_port_input_notification_iterator_set_connection(
-               struct bt_self_component_port_input_notification_iterator *iterator,
-               struct bt_connection *connection);
-
-static inline
-const char *bt_notification_iterator_status_string(
-               enum bt_notification_iterator_status status)
-{
-       switch (status) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_CANCELED";
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_AGAIN";
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_END";
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_OK";
-       case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_ERROR";
-       case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
-               return "BT_NOTIFICATION_ITERATOR_STATUS_NOMEM";
-       default:
-               return "(unknown)";
-       }
-};
-
-static inline
-const char *bt_self_component_port_input_notification_iterator_state_string(
-               enum bt_self_component_port_input_notification_iterator_state state)
-{
-       switch (state) {
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE:
-               return "BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE";
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ENDED:
-               return "BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ENDED";
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED:
-               return "BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED";
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED:
-               return "BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED";
-       default:
-               return "(unknown)";
-       }
-};
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-iterator.h b/include/babeltrace/graph/notification-iterator.h
deleted file mode 100644 (file)
index bd58398..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H
-#define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_notification_iterator */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum bt_notification_iterator_status {
-       BT_NOTIFICATION_ITERATOR_STATUS_OK = 0,
-       BT_NOTIFICATION_ITERATOR_STATUS_END = 1,
-       BT_NOTIFICATION_ITERATOR_STATUS_AGAIN = 11,
-       BT_NOTIFICATION_ITERATOR_STATUS_CANCELED = 125,
-       BT_NOTIFICATION_ITERATOR_STATUS_ERROR = -1,
-       BT_NOTIFICATION_ITERATOR_STATUS_NOMEM = -12,
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H */
diff --git a/include/babeltrace/graph/notification-packet-const.h b/include/babeltrace/graph/notification-packet-const.h
deleted file mode 100644 (file)
index 48778a8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_PACKET_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_PACKET_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_packet */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_packet *bt_notification_packet_beginning_borrow_packet_const(
-               const bt_notification *notification);
-
-extern const bt_packet *bt_notification_packet_end_borrow_packet_const(
-               const bt_notification *notification);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_PACKET_CONST_H */
diff --git a/include/babeltrace/graph/notification-packet-internal.h b/include/babeltrace/graph/notification-packet-internal.h
deleted file mode 100644 (file)
index 20fe613..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_PACKET_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_PACKET_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/packet.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/assert-internal.h>
-
-struct bt_notification_packet_beginning {
-       struct bt_notification parent;
-       struct bt_packet *packet;
-};
-
-struct bt_notification_packet_end {
-       struct bt_notification parent;
-       struct bt_packet *packet;
-};
-
-BT_HIDDEN
-struct bt_notification *bt_notification_packet_beginning_new(
-               struct bt_graph *graph);
-BT_HIDDEN
-void bt_notification_packet_beginning_recycle(struct bt_notification *notif);
-
-BT_HIDDEN
-void bt_notification_packet_beginning_destroy(struct bt_notification *notif);
-
-BT_HIDDEN
-struct bt_notification *bt_notification_packet_end_new(struct bt_graph *graph);
-
-BT_HIDDEN
-void bt_notification_packet_end_recycle(struct bt_notification *notif);
-
-BT_HIDDEN
-void bt_notification_packet_end_destroy(struct bt_notification *notif);
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_PACKET_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-packet.h b/include/babeltrace/graph/notification-packet.h
deleted file mode 100644 (file)
index 0b4cca9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_PACKET_H
-#define BABELTRACE_GRAPH_NOTIFICATION_PACKET_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_self_notification_iterator, bt_packet */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_notification *bt_notification_packet_beginning_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_packet *packet);
-
-extern
-bt_notification *bt_notification_packet_end_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_packet *packet);
-
-extern bt_packet *bt_notification_packet_beginning_borrow_packet(
-               bt_notification *notification);
-
-extern bt_packet *bt_notification_packet_end_borrow_packet(
-               bt_notification *notification);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_PACKET_H */
diff --git a/include/babeltrace/graph/notification-stream-const.h b/include/babeltrace/graph/notification-stream-const.h
deleted file mode 100644 (file)
index fdbcecf..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_STREAM_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_STREAM_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_clock_value, bt_stream */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const bt_stream *bt_notification_stream_beginning_borrow_stream_const(
-               const bt_notification *notification);
-
-extern const bt_clock_value *
-bt_notification_stream_beginning_borrow_default_clock_value_const(
-               const bt_notification *notif);
-
-extern const bt_stream *bt_notification_stream_end_borrow_stream_const(
-               const bt_notification *notification);
-
-extern const bt_clock_value *
-bt_notification_stream_end_borrow_default_clock_value_const(
-               const bt_notification *notif);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_STREAM_CONST_H */
diff --git a/include/babeltrace/graph/notification-stream-internal.h b/include/babeltrace/graph/notification-stream-internal.h
deleted file mode 100644 (file)
index 2cfe268..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_STREAM_INTERNAL_H
-#define BABELTRACE_GRAPH_NOTIFICATION_STREAM_INTERNAL_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/packet.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/assert-internal.h>
-
-struct bt_notification_stream_beginning {
-       struct bt_notification parent;
-       struct bt_stream *stream;
-       struct bt_clock_value *default_cv;
-};
-
-struct bt_notification_stream_end {
-       struct bt_notification parent;
-       struct bt_stream *stream;
-       struct bt_clock_value *default_cv;
-};
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_STREAM_INTERNAL_H */
diff --git a/include/babeltrace/graph/notification-stream.h b/include/babeltrace/graph/notification-stream.h
deleted file mode 100644 (file)
index ac9ee65..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_STREAM_H
-#define BABELTRACE_GRAPH_NOTIFICATION_STREAM_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For bt_notification, bt_self_notification_iterator, bt_stream */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern
-bt_notification *bt_notification_stream_beginning_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_stream *stream);
-
-extern
-bt_notification *bt_notification_stream_end_create(
-               bt_self_notification_iterator *notification_iterator,
-               bt_stream *stream);
-
-extern bt_stream *bt_notification_stream_beginning_borrow_stream(
-               bt_notification *notification);
-
-extern void bt_notification_stream_beginning_set_default_clock_value(
-               bt_notification *notif, uint64_t value_cycles);
-
-extern bt_stream *bt_notification_stream_end_borrow_stream(
-               bt_notification *notification);
-
-extern void bt_notification_stream_end_set_default_clock_value(
-               bt_notification *notif, uint64_t value_cycles);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_STREAM_H */
diff --git a/include/babeltrace/graph/port-output-message-iterator.h b/include/babeltrace/graph/port-output-message-iterator.h
new file mode 100644 (file)
index 0000000..41d8d28
--- /dev/null
@@ -0,0 +1,83 @@
+#ifndef BABELTRACE_GRAPH_PORT_OUTPUT_MESSAGE_ITERATOR_H
+#define BABELTRACE_GRAPH_PORT_OUTPUT_MESSAGE_ITERATOR_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+/* For enum bt_message_iterator_status */
+#include <babeltrace/graph/message-iterator.h>
+
+/*
+ * For bt_port, bt_message, bt_message_iterator,
+ * bt_port_output_message_iterator, bt_graph, bt_port_output,
+ * bt_message_array_const
+ */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline
+bt_message_iterator *
+bt_port_output_message_iterator_as_message_iterator(
+               bt_port_output_message_iterator *iterator)
+{
+       return (void *) iterator;
+}
+
+extern bt_port_output_message_iterator *
+bt_port_output_message_iterator_create(
+               bt_graph *graph,
+               const bt_port_output *output_port);
+
+extern enum bt_message_iterator_status
+bt_port_output_message_iterator_next(
+               bt_port_output_message_iterator *iterator,
+               bt_message_array_const *msgs, uint64_t *count);
+
+extern void bt_port_output_message_iterator_get_ref(
+               const bt_port_output_message_iterator *port_output_message_iterator);
+
+extern void bt_port_output_message_iterator_put_ref(
+               const bt_port_output_message_iterator *port_output_message_iterator);
+
+#define BT_PORT_OUTPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var)        \
+       do {                                                            \
+               bt_port_output_message_iterator_put_ref(_var);  \
+               (_var) = NULL;                                          \
+       } while (0)
+
+#define BT_PORT_OUTPUT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \
+       do {                                                            \
+               bt_port_output_message_iterator_put_ref(_var_dst);      \
+               (_var_dst) = (_var_src);                                \
+               (_var_src) = NULL;                                      \
+       } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_PORT_OUTPUT_MESSAGE_ITERATOR_H */
diff --git a/include/babeltrace/graph/port-output-notification-iterator.h b/include/babeltrace/graph/port-output-notification-iterator.h
deleted file mode 100644 (file)
index ceec914..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef BABELTRACE_GRAPH_PORT_OUTPUT_NOTIFICATION_ITERATOR_H
-#define BABELTRACE_GRAPH_PORT_OUTPUT_NOTIFICATION_ITERATOR_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-
-/* For enum bt_notification_iterator_status */
-#include <babeltrace/graph/notification-iterator.h>
-
-/*
- * For bt_port, bt_notification, bt_notification_iterator,
- * bt_port_output_notification_iterator, bt_graph, bt_port_output,
- * bt_notification_array_const
- */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static inline
-bt_notification_iterator *
-bt_port_output_notification_iterator_as_notification_iterator(
-               bt_port_output_notification_iterator *iterator)
-{
-       return (void *) iterator;
-}
-
-extern bt_port_output_notification_iterator *
-bt_port_output_notification_iterator_create(
-               bt_graph *graph,
-               const bt_port_output *output_port);
-
-extern enum bt_notification_iterator_status
-bt_port_output_notification_iterator_next(
-               bt_port_output_notification_iterator *iterator,
-               bt_notification_array_const *notifs, uint64_t *count);
-
-extern void bt_port_output_notification_iterator_get_ref(
-               const bt_port_output_notification_iterator *port_output_notification_iterator);
-
-extern void bt_port_output_notification_iterator_put_ref(
-               const bt_port_output_notification_iterator *port_output_notification_iterator);
-
-#define BT_PORT_OUTPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(_var)   \
-       do {                                                            \
-               bt_port_output_notification_iterator_put_ref(_var);     \
-               (_var) = NULL;                                          \
-       } while (0)
-
-#define BT_PORT_OUTPUT_NOTIFICATION_ITERATOR_MOVE_REF(_var_dst, _var_src) \
-       do {                                                            \
-               bt_port_output_notification_iterator_put_ref(_var_dst); \
-               (_var_dst) = (_var_src);                                \
-               (_var_src) = NULL;                                      \
-       } while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_PORT_OUTPUT_NOTIFICATION_ITERATOR_H */
diff --git a/include/babeltrace/graph/self-component-port-input-message-iterator.h b/include/babeltrace/graph/self-component-port-input-message-iterator.h
new file mode 100644 (file)
index 0000000..c952f52
--- /dev/null
@@ -0,0 +1,86 @@
+#ifndef BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H
+#define BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+/* For enum bt_message_iterator_status */
+#include <babeltrace/graph/message-iterator.h>
+
+/*
+ * For bt_component, bt_message_iterator,
+ * bt_self_component_port_input_message_iterator,
+ * bt_self_component_port_input, bt_message_array_const
+ */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline
+bt_message_iterator *
+bt_self_component_port_input_message_iterator_as_message_iterator(
+               bt_self_component_port_input_message_iterator *iterator)
+{
+       return (void *) iterator;
+}
+
+extern bt_self_component_port_input_message_iterator *
+bt_self_component_port_input_message_iterator_create(
+               bt_self_component_port_input *input_port);
+
+extern bt_component *
+bt_self_component_port_input_message_iterator_borrow_component(
+               bt_self_component_port_input_message_iterator *iterator);
+
+extern enum bt_message_iterator_status
+bt_self_component_port_input_message_iterator_next(
+               bt_self_component_port_input_message_iterator *iterator,
+               bt_message_array_const *msgs, uint64_t *count);
+
+extern void bt_self_component_port_input_message_iterator_get_ref(
+               const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
+
+extern void bt_self_component_port_input_message_iterator_put_ref(
+               const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
+
+#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \
+       do {                                                            \
+               bt_self_component_port_input_message_iterator_put_ref(_var); \
+               (_var) = NULL;                                          \
+       } while (0)
+
+#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \
+       do {                                                            \
+               bt_self_component_port_input_message_iterator_put_ref(_var_dst); \
+               (_var_dst) = (_var_src);                                \
+               (_var_src) = NULL;                                      \
+       } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H */
diff --git a/include/babeltrace/graph/self-component-port-input-notification-iterator.h b/include/babeltrace/graph/self-component-port-input-notification-iterator.h
deleted file mode 100644 (file)
index 0f8712b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_H
-#define BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-
-/* For enum bt_notification_iterator_status */
-#include <babeltrace/graph/notification-iterator.h>
-
-/*
- * For bt_component, bt_notification_iterator,
- * bt_self_component_port_input_notification_iterator,
- * bt_self_component_port_input, bt_notification_array_const
- */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static inline
-bt_notification_iterator *
-bt_self_component_port_input_notification_iterator_as_notification_iterator(
-               bt_self_component_port_input_notification_iterator *iterator)
-{
-       return (void *) iterator;
-}
-
-extern bt_self_component_port_input_notification_iterator *
-bt_self_component_port_input_notification_iterator_create(
-               bt_self_component_port_input *input_port);
-
-extern bt_component *
-bt_self_component_port_input_notification_iterator_borrow_component(
-               bt_self_component_port_input_notification_iterator *iterator);
-
-extern enum bt_notification_iterator_status
-bt_self_component_port_input_notification_iterator_next(
-               bt_self_component_port_input_notification_iterator *iterator,
-               bt_notification_array_const *notifs, uint64_t *count);
-
-extern void bt_self_component_port_input_notification_iterator_get_ref(
-               const bt_self_component_port_input_notification_iterator *self_component_port_input_notification_iterator);
-
-extern void bt_self_component_port_input_notification_iterator_put_ref(
-               const bt_self_component_port_input_notification_iterator *self_component_port_input_notification_iterator);
-
-#define BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(_var) \
-       do {                                                            \
-               bt_self_component_port_input_notification_iterator_put_ref(_var); \
-               (_var) = NULL;                                          \
-       } while (0)
-
-#define BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(_var_dst, _var_src) \
-       do {                                                            \
-               bt_self_component_port_input_notification_iterator_put_ref(_var_dst); \
-               (_var_dst) = (_var_src);                                \
-               (_var_src) = NULL;                                      \
-       } while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_H */
diff --git a/include/babeltrace/graph/self-message-iterator.h b/include/babeltrace/graph/self-message-iterator.h
new file mode 100644 (file)
index 0000000..90143e3
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef BABELTRACE_GRAPH_SELF_MESSAGE_ITERATOR_H
+#define BABELTRACE_GRAPH_SELF_MESSAGE_ITERATOR_H
+
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* For BT_MESSAGE_ITERATOR_STATUS_* */
+#include <babeltrace/graph/message-iterator.h>
+
+/* For bt_self_component, bt_self_message_iterator, bt_self_port_output */
+#include <babeltrace/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum bt_self_message_iterator_status {
+       BT_SELF_MESSAGE_ITERATOR_STATUS_OK = BT_MESSAGE_ITERATOR_STATUS_OK,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_END = BT_MESSAGE_ITERATOR_STATUS_END,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_AGAIN = BT_MESSAGE_ITERATOR_STATUS_AGAIN,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR = BT_MESSAGE_ITERATOR_STATUS_ERROR,
+       BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM = BT_MESSAGE_ITERATOR_STATUS_NOMEM,
+};
+
+extern bt_self_component *
+bt_self_message_iterator_borrow_component(
+               bt_self_message_iterator *message_iterator);
+
+extern bt_self_port_output *
+bt_self_message_iterator_borrow_port(
+               bt_self_message_iterator *message_iterator);
+
+extern void bt_self_message_iterator_set_data(
+               bt_self_message_iterator *message_iterator,
+               void *user_data);
+
+extern void *bt_self_message_iterator_get_data(
+               const bt_self_message_iterator *message_iterator);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_GRAPH_SELF_MESSAGE_ITERATOR_H */
diff --git a/include/babeltrace/graph/self-notification-iterator.h b/include/babeltrace/graph/self-notification-iterator.h
deleted file mode 100644 (file)
index bac1875..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef BABELTRACE_GRAPH_SELF_NOTIFICATION_ITERATOR_H
-#define BABELTRACE_GRAPH_SELF_NOTIFICATION_ITERATOR_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* For BT_NOTIFICATION_ITERATOR_STATUS_* */
-#include <babeltrace/graph/notification-iterator.h>
-
-/* For bt_self_component, bt_self_notification_iterator, bt_self_port_output */
-#include <babeltrace/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum bt_self_notification_iterator_status {
-       BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK = BT_NOTIFICATION_ITERATOR_STATUS_OK,
-       BT_SELF_NOTIFICATION_ITERATOR_STATUS_END = BT_NOTIFICATION_ITERATOR_STATUS_END,
-       BT_SELF_NOTIFICATION_ITERATOR_STATUS_AGAIN = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN,
-       BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR = BT_NOTIFICATION_ITERATOR_STATUS_ERROR,
-       BT_SELF_NOTIFICATION_ITERATOR_STATUS_NOMEM = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM,
-};
-
-extern bt_self_component *
-bt_self_notification_iterator_borrow_component(
-               bt_self_notification_iterator *notification_iterator);
-
-extern bt_self_port_output *
-bt_self_notification_iterator_borrow_port(
-               bt_self_notification_iterator *notification_iterator);
-
-extern void bt_self_notification_iterator_set_data(
-               bt_self_notification_iterator *notification_iterator,
-               void *user_data);
-
-extern void *bt_self_notification_iterator_get_data(
-               const bt_self_notification_iterator *notification_iterator);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_SELF_NOTIFICATION_ITERATOR_H */
index a936488bb4c8b31db4830f8009d287c56255724e..5c3fad42a88e585f4ccbd19d497f663ade88ca27 100644 (file)
@@ -121,11 +121,11 @@ int bt_lib_log_level;
  *       Value. The parameter type is `struct bt_value *`.
  *
  *   `n`:
- *       Notification. The parameter type is `struct bt_notification *`.
+ *       Message. The parameter type is `struct bt_message *`.
  *
  *   `i`:
- *       Notification iterator. The parameter type is
- *       `struct bt_notification_iterator *`.
+ *       Message iterator. The parameter type is
+ *       `struct bt_message_iterator *`.
  *
  *   `C`:
  *       Component class. The parameter type is `struct
index ca6e9080606dbe34b88e1fd23f0da86c5a7183e3..94bfb700866e463c59f69ce0730e89c7993e1982 100644 (file)
@@ -150,12 +150,12 @@ struct __bt_plugin_component_class_descriptor {
        union {
                /* BT_COMPONENT_CLASS_TYPE_SOURCE */
                struct {
-                       bt_component_class_source_notification_iterator_next_method notif_iter_next;
+                       bt_component_class_source_message_iterator_next_method msg_iter_next;
                } source;
 
                /* BT_COMPONENT_CLASS_TYPE_FILTER */
                struct {
-                       bt_component_class_filter_notification_iterator_next_method notif_iter_next;
+                       bt_component_class_filter_message_iterator_next_method msg_iter_next;
                } filter;
 
                /* BT_COMPONENT_CLASS_TYPE_SINK */
@@ -178,8 +178,8 @@ enum __bt_plugin_component_class_descriptor_attribute_type {
        BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_OUTPUT_PORT_CONNECTED_METHOD                = 8,
        BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INPUT_PORT_DISCONNECTED_METHOD              = 9,
        BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_OUTPUT_PORT_DISCONNECTED_METHOD             = 10,
-       BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD                      = 11,
-       BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD                  = 12,
+       BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD                        = 11,
+       BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD                    = 12,
 };
 
 /* Component class attribute (internal use) */
@@ -243,13 +243,13 @@ struct __bt_plugin_component_class_descriptor_attribute {
                bt_component_class_source_output_port_disconnected_method source_output_port_disconnected_method;
                bt_component_class_filter_output_port_disconnected_method filter_output_port_disconnected_method;
 
-               /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD */
-               bt_component_class_source_notification_iterator_init_method source_notif_iter_init_method;
-               bt_component_class_filter_notification_iterator_init_method filter_notif_iter_init_method;
+               /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD */
+               bt_component_class_source_message_iterator_init_method source_msg_iter_init_method;
+               bt_component_class_filter_message_iterator_init_method filter_msg_iter_init_method;
 
-               /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD */
-               bt_component_class_source_notification_iterator_finalize_method source_notif_iter_finalize_method;
-               bt_component_class_filter_notification_iterator_finalize_method filter_notif_iter_finalize_method;
+               /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD */
+               bt_component_class_source_message_iterator_finalize_method source_msg_iter_finalize_method;
+               bt_component_class_filter_message_iterator_finalize_method filter_msg_iter_finalize_method;
        } value;
 } __attribute__((packed));
 
@@ -514,16 +514,16 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:                     ID (any valid C identifier except `auto`).
  * _comp_class_id:          Component class ID (C identifier).
  * _name:                   Component class name (C string).
- * _notif_iter_next_method: Component class's iterator next method
- *                          (bt_component_class_source_notification_iterator_next_method).
+ * _msg_iter_next_method: Component class's iterator next method
+ *                          (bt_component_class_source_message_iterator_next_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_next_method) \
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
        static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
                .plugin_descriptor = &__bt_plugin_descriptor_##_id,     \
                .name = _name,                                          \
                .type = BT_COMPONENT_CLASS_TYPE_SOURCE,                 \
                .methods.source = {                                     \
-                       .notif_iter_next = _notif_iter_next_method,     \
+                       .msg_iter_next = _msg_iter_next_method, \
                },                                                      \
        };                                                              \
        static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id
@@ -534,16 +534,16 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:                     ID (any valid C identifier except `auto`).
  * _comp_class_id:          Component class ID (C identifier).
  * _name:                   Component class name (C string).
- * _notif_iter_next_method: Component class's iterator next method
- *                          (bt_component_class_filter_notification_iterator_next_method).
+ * _msg_iter_next_method: Component class's iterator next method
+ *                          (bt_component_class_filter_message_iterator_next_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_next_method) \
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
        static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
                .plugin_descriptor = &__bt_plugin_descriptor_##_id,     \
                .name = _name,                                          \
                .type = BT_COMPONENT_CLASS_TYPE_FILTER,                 \
                .methods.filter = {                                     \
-                       .notif_iter_next = _notif_iter_next_method,     \
+                       .msg_iter_next = _msg_iter_next_method, \
                },                                                      \
        };                                                              \
        static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id
@@ -905,10 +905,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:            Plugin descriptor ID (C identifier).
  * _comp_class_id: Component class descriptor ID (C identifier).
  * _x:             Iterator initialization method
- *                 (bt_component_class_source_notification_iterator_init_method).
+ *                 (bt_component_class_source_message_iterator_init_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
-       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, source, _x)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_msg_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD, _id, _comp_class_id, source, _x)
 
 /*
  * Defines an iterator finalize method attribute attached to a specific
@@ -917,10 +917,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:            Plugin descriptor ID (C identifier).
  * _comp_class_id: Component class descriptor ID (C identifier).
  * _x:             Iterator finalize method
- *                 (bt_component_class_source_notification_iterator_finalize_method).
+ *                 (bt_component_class_source_message_iterator_finalize_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
-       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, source, _x)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_msg_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD, _id, _comp_class_id, source, _x)
 
 /*
  * Defines an iterator initialization method attribute attached to a
@@ -929,10 +929,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:            Plugin descriptor ID (C identifier).
  * _comp_class_id: Component class descriptor ID (C identifier).
  * _x:             Iterator initialization method
- *                 (bt_component_class_filter_notification_iterator_init_method).
+ *                 (bt_component_class_filter_message_iterator_init_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
-       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, filter, _x)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_msg_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD, _id, _comp_class_id, filter, _x)
 
 /*
  * Defines an iterator finalize method attribute attached to a specific
@@ -941,10 +941,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * _id:            Plugin descriptor ID (C identifier).
  * _comp_class_id: Component class descriptor ID (C identifier).
  * _x:             Iterator finalize method
- *                 (bt_component_class_filter_notification_iterator_finalize_method).
+ *                 (bt_component_class_filter_message_iterator_finalize_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
-       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, filter, _x)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+       __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_msg_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD, _id, _comp_class_id, filter, _x)
 
 /*
  * Defines a plugin descriptor with an automatic ID.
@@ -1010,11 +1010,11 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * C identifier in this version.
  *
  * _name:                   Component class name (C identifier).
- * _notif_iter_next_method: Component class's iterator next method
- *                          (bt_component_class_source_notification_iterator_next_method).
+ * _msg_iter_next_method: Component class's iterator next method
+ *                          (bt_component_class_source_message_iterator_next_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _notif_iter_next_method) \
-       BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_next_method)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _msg_iter_next_method) \
+       BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _msg_iter_next_method)
 
 /*
  * Defines a filter component class attached to the automatic plugin
@@ -1022,11 +1022,11 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  * C identifier in this version.
  *
  * _name:                   Component class name (C identifier).
- * _notif_iter_next_method: Component class's iterator next method
- *                          (bt_component_class_filter_notification_iterator_next_method).
+ * _msg_iter_next_method: Component class's iterator next method
+ *                          (bt_component_class_filter_message_iterator_next_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _notif_iter_next_method) \
-       BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_next_method)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _msg_iter_next_method) \
+       BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _msg_iter_next_method)
 
 /*
  * Defines a sink component class attached to the automatic plugin
@@ -1341,10 +1341,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  *
  * _name: Component class name (C identifier).
  * _x:    Iterator initialization method
- *        (bt_component_class_source_notification_iterator_init_method).
+ *        (bt_component_class_source_message_iterator_init_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \
-       BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(_name, _x) \
+       BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
 
 /*
  * Defines an iterator finalize method attribute attached to a source
@@ -1353,10 +1353,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  *
  * _name: Component class name (C identifier).
  * _x:    Iterator finalize method
- *        (bt_component_class_source_notification_iterator_finalize_method).
+ *        (bt_component_class_source_message_iterator_finalize_method).
  */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \
-       BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(_name, _x) \
+       BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
 
 /*
  * Defines an iterator initialization method attribute attached to a
@@ -1365,10 +1365,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  *
  * _name: Component class name (C identifier).
  * _x:    Iterator initialization method
- *        (bt_component_class_filter_notification_iterator_init_method).
+ *        (bt_component_class_filter_message_iterator_init_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \
-       BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(_name, _x) \
+       BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
 
 /*
  * Defines an iterator finalize method attribute attached to a filter
@@ -1377,10 +1377,10 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_
  *
  * _name: Component class name (C identifier).
  * _x:    Iterator finalize method
- *        (bt_component_class_filter_notification_iterator_finalize_method).
+ *        (bt_component_class_filter_message_iterator_finalize_method).
  */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \
-       BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(_name, _x) \
+       BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
 
 #define BT_PLUGIN_MODULE() \
        static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_dummy __BT_PLUGIN_DESCRIPTOR_ATTRS = NULL; \
index f63e7d944215ebd25b38a3d48e58c062c398abd9..bf4c72d93f7a47925709283124dd2a347f0d2b55 100644 (file)
@@ -97,8 +97,8 @@ typedef struct bt_field_class_signed_enumeration_mapping_ranges bt_field_class_s
 typedef struct bt_field_class_unsigned_enumeration_mapping_ranges bt_field_class_unsigned_enumeration_mapping_ranges;
 typedef struct bt_field_path bt_field_path;
 typedef struct bt_graph bt_graph;
-typedef struct bt_notification bt_notification;
-typedef struct bt_notification_iterator bt_notification_iterator;
+typedef struct bt_message bt_message;
+typedef struct bt_message_iterator bt_message_iterator;
 typedef struct bt_object bt_object;
 typedef struct bt_packet bt_packet;
 typedef struct bt_packet_context_field bt_packet_context_field;
@@ -109,7 +109,7 @@ typedef struct bt_plugin_so_shared_lib_handle bt_plugin_so_shared_lib_handle;
 typedef struct bt_port bt_port;
 typedef struct bt_port_input bt_port_input;
 typedef struct bt_port_output bt_port_output;
-typedef struct bt_port_output_notification_iterator bt_port_output_notification_iterator;
+typedef struct bt_port_output_message_iterator bt_port_output_message_iterator;
 typedef struct bt_query_executor bt_query_executor;
 typedef struct bt_self_component bt_self_component;
 typedef struct bt_self_component_class_filter bt_self_component_class_filter;
@@ -118,14 +118,14 @@ typedef struct bt_self_component_class_source bt_self_component_class_source;
 typedef struct bt_self_component_filter bt_self_component_filter;
 typedef struct bt_self_component_port bt_self_component_port;
 typedef struct bt_self_component_port_input bt_self_component_port_input;
-typedef struct bt_self_component_port_input_notification_iterator bt_self_component_port_input_notification_iterator;
+typedef struct bt_self_component_port_input_message_iterator bt_self_component_port_input_message_iterator;
 typedef struct bt_self_component_port_output bt_self_component_port_output;
 typedef struct bt_self_component_sink bt_self_component_sink;
 typedef struct bt_self_component_source bt_self_component_source;
-typedef struct bt_self_notification_iterator bt_self_notification_iterator;
+typedef struct bt_self_message_iterator bt_self_message_iterator;
+typedef struct bt_self_port bt_self_port;
 typedef struct bt_self_port_input bt_self_port_input;
 typedef struct bt_self_port_output bt_self_port_output;
-typedef struct bt_self_port bt_self_port;
 typedef struct bt_stream bt_stream;
 typedef struct bt_stream_class bt_stream_class;
 typedef struct bt_trace bt_trace;
@@ -133,7 +133,7 @@ typedef struct bt_trace_class bt_trace_class;
 typedef struct bt_value bt_value;
 
 typedef const char * const *bt_field_class_enumeration_mapping_label_array;
-typedef const struct bt_notification **bt_notification_array_const;
+typedef const struct bt_message **bt_message_array_const;
 
 /** @} */
 
index 6be6669633f1f93cc236b9799f706dc0fe036c7c..bd373ef71ea7b9c80796ba04294424b55473abf7 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = notification
+SUBDIRS = message
 
 noinst_LTLIBRARIES = libgraph.la
 
@@ -17,4 +17,4 @@ libgraph_la_SOURCES = \
        query-executor.c
 
 libgraph_la_LIBADD = \
-       notification/libgraph-notification.la
+       message/libgraph-message.la
index 582176753d4c47cc18c9d272e5356107a1a16470..36d764e3d5e0bdd68f35eea090cf17a3e84b6357 100644 (file)
@@ -29,7 +29,7 @@
 #include <babeltrace/graph/component-class-sink.h>
 #include <babeltrace/graph/self-component-sink.h>
 #include <babeltrace/graph/self-component-port.h>
-#include <babeltrace/graph/self-component-port-input-notification-iterator.h>
+#include <babeltrace/graph/self-component-port-input-message-iterator.h>
 #include <babeltrace/graph/self-component.h>
 #include <babeltrace/graph/component-class-sink-colander-internal.h>
 #include <glib.h>
@@ -38,9 +38,9 @@ static
 struct bt_component_class_sink *colander_comp_cls;
 
 struct colander_data {
-       bt_notification_array_const notifs;
+       bt_message_array_const msgs;
        uint64_t *count_addr;
-       struct bt_self_component_port_input_notification_iterator *notif_iter;
+       struct bt_self_component_port_input_message_iterator *msg_iter;
 };
 
 static
@@ -66,7 +66,7 @@ enum bt_self_component_status colander_init(
                goto end;
        }
 
-       colander_data->notifs = user_provided_data->notifs;
+       colander_data->msgs = user_provided_data->msgs;
        colander_data->count_addr = user_provided_data->count_addr;
        status = bt_self_component_sink_add_input_port(self_comp, "in",
                NULL, NULL);
@@ -94,7 +94,7 @@ void colander_finalize(struct bt_self_component_sink *self_comp)
                return;
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(colander_data->notif_iter);
+       BT_OBJECT_PUT_REF_AND_RESET(colander_data->msg_iter);
        g_free(colander_data);
 }
 
@@ -110,12 +110,12 @@ enum bt_self_component_status colander_input_port_connected(
                        bt_self_component_sink_as_self_component(self_comp));
 
        BT_ASSERT(colander_data);
-       BT_OBJECT_PUT_REF_AND_RESET(colander_data->notif_iter);
-       colander_data->notif_iter =
-               bt_self_component_port_input_notification_iterator_create(
+       BT_OBJECT_PUT_REF_AND_RESET(colander_data->msg_iter);
+       colander_data->msg_iter =
+               bt_self_component_port_input_message_iterator_create(
                        self_port);
-       if (!colander_data->notif_iter) {
-               BT_LIB_LOGE("Cannot create notification iterator on "
+       if (!colander_data->msg_iter) {
+               BT_LIB_LOGE("Cannot create message iterator on "
                        "self component input port: %![port-]+p",
                        self_port);
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
@@ -131,39 +131,39 @@ enum bt_self_component_status colander_consume(
                struct bt_self_component_sink *self_comp)
 {
        enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
-       enum bt_notification_iterator_status notif_iter_status;
+       enum bt_message_iterator_status msg_iter_status;
        struct colander_data *colander_data =
                bt_self_component_get_data(
                        bt_self_component_sink_as_self_component(self_comp));
-       bt_notification_array_const notifs;
+       bt_message_array_const msgs;
 
        BT_ASSERT(colander_data);
 
-       if (!colander_data->notif_iter) {
+       if (!colander_data->msg_iter) {
                BT_LIB_LOGW("Trying to consume without an "
-                       "upstream notification iterator: %![comp-]+c",
+                       "upstream message iterator: %![comp-]+c",
                        self_comp);
                goto end;
        }
 
-       notif_iter_status =
-               bt_self_component_port_input_notification_iterator_next(
-                       colander_data->notif_iter, &notifs,
+       msg_iter_status =
+               bt_self_component_port_input_message_iterator_next(
+                       colander_data->msg_iter, &msgs,
                        colander_data->count_addr);
-       switch (notif_iter_status) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED:
+       switch (msg_iter_status) {
+       case BT_MESSAGE_ITERATOR_STATUS_CANCELED:
                status = BT_SELF_COMPONENT_STATUS_OK;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                status = BT_SELF_COMPONENT_STATUS_AGAIN;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+       case BT_MESSAGE_ITERATOR_STATUS_END:
                status = BT_SELF_COMPONENT_STATUS_END;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
-               /* Move notifications to user (count already set) */
-               memcpy(colander_data->notifs, notifs,
-                       sizeof(*notifs) * *colander_data->count_addr);
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
+               /* Move messages to user (count already set) */
+               memcpy(colander_data->msgs, msgs,
+                       sizeof(*msgs) * *colander_data->count_addr);
                break;
        default:
                status = BT_SELF_COMPONENT_STATUS_ERROR;
index 12a3eec0307331f39d246b486af60e9870c1c1dc..7ecf6a18a2f1f93d5e2c00f8e0ea437785d644ca 100644 (file)
@@ -134,15 +134,15 @@ end:
 
 struct bt_component_class_source *bt_component_class_source_create(
                const char *name,
-               bt_component_class_source_notification_iterator_next_method method)
+               bt_component_class_source_message_iterator_next_method method)
 {
        struct bt_component_class_source *source_class = NULL;
        int ret;
 
        BT_ASSERT_PRE_NON_NULL(name, "Name");
-       BT_ASSERT_PRE_NON_NULL(method, "Notification iterator next method");
+       BT_ASSERT_PRE_NON_NULL(method, "Message iterator next method");
        BT_LOGD("Creating source component class: "
-               "name=\"%s\", notif-iter-next-method-addr=%p",
+               "name=\"%s\", msg-iter-next-method-addr=%p",
                name, method);
        source_class = g_new0(struct bt_component_class_source, 1);
        if (!source_class) {
@@ -163,7 +163,7 @@ struct bt_component_class_source *bt_component_class_source_create(
                goto end;
        }
 
-       source_class->methods.notif_iter_next = method;
+       source_class->methods.msg_iter_next = method;
        BT_LIB_LOGD("Created source component class: %!+C", source_class);
 
 end:
@@ -172,15 +172,15 @@ end:
 
 struct bt_component_class_filter *bt_component_class_filter_create(
                const char *name,
-               bt_component_class_filter_notification_iterator_next_method method)
+               bt_component_class_filter_message_iterator_next_method method)
 {
        struct bt_component_class_filter *filter_class = NULL;
        int ret;
 
        BT_ASSERT_PRE_NON_NULL(name, "Name");
-       BT_ASSERT_PRE_NON_NULL(method, "Notification iterator next method");
+       BT_ASSERT_PRE_NON_NULL(method, "Message iterator next method");
        BT_LOGD("Creating filter component class: "
-               "name=\"%s\", notif-iter-next-method-addr=%p",
+               "name=\"%s\", msg-iter-next-method-addr=%p",
                name, method);
        filter_class = g_new0(struct bt_component_class_filter, 1);
        if (!filter_class) {
@@ -201,7 +201,7 @@ struct bt_component_class_filter *bt_component_class_filter_create(
                goto end;
        }
 
-       filter_class->methods.notif_iter_next = method;
+       filter_class->methods.msg_iter_next = method;
        BT_LIB_LOGD("Created filter component class: %!+C", filter_class);
 
 end:
@@ -518,54 +518,54 @@ int bt_component_class_filter_set_output_port_disconnected_method(
        return 0;
 }
 
-int bt_component_class_source_set_notification_iterator_init_method(
+int bt_component_class_source_set_message_iterator_init_method(
                struct bt_component_class_source *comp_cls,
-               bt_component_class_source_notification_iterator_init_method method)
+               bt_component_class_source_message_iterator_init_method method)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
-       comp_cls->methods.notif_iter_init = method;
-       BT_LIB_LOGV("Set source component class's notification iterator initialization method"
+       comp_cls->methods.msg_iter_init = method;
+       BT_LIB_LOGV("Set source component class's message iterator initialization method"
                ": %!+C", comp_cls);
        return 0;
 }
 
-int bt_component_class_filter_set_notification_iterator_init_method(
+int bt_component_class_filter_set_message_iterator_init_method(
                struct bt_component_class_filter *comp_cls,
-               bt_component_class_filter_notification_iterator_init_method method)
+               bt_component_class_filter_message_iterator_init_method method)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
-       comp_cls->methods.notif_iter_init = method;
-       BT_LIB_LOGV("Set filter component class's notification iterator initialization method"
+       comp_cls->methods.msg_iter_init = method;
+       BT_LIB_LOGV("Set filter component class's message iterator initialization method"
                ": %!+C", comp_cls);
        return 0;
 }
 
-int bt_component_class_source_set_notification_iterator_finalize_method(
+int bt_component_class_source_set_message_iterator_finalize_method(
                struct bt_component_class_source *comp_cls,
-               bt_component_class_source_notification_iterator_finalize_method method)
+               bt_component_class_source_message_iterator_finalize_method method)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
-       comp_cls->methods.notif_iter_finalize = method;
-       BT_LIB_LOGV("Set source component class's notification iterator finalization method"
+       comp_cls->methods.msg_iter_finalize = method;
+       BT_LIB_LOGV("Set source component class's message iterator finalization method"
                ": %!+C", comp_cls);
        return 0;
 }
 
-int bt_component_class_filter_set_notification_iterator_finalize_method(
+int bt_component_class_filter_set_message_iterator_finalize_method(
                struct bt_component_class_filter *comp_cls,
-               bt_component_class_filter_notification_iterator_finalize_method method)
+               bt_component_class_filter_message_iterator_finalize_method method)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
-       comp_cls->methods.notif_iter_finalize = method;
-       BT_LIB_LOGV("Set filter component class's notification iterator finalization method"
+       comp_cls->methods.msg_iter_finalize = method;
+       BT_LIB_LOGV("Set filter component class's message iterator finalization method"
                ": %!+C", comp_cls);
        return 0;
 }
index e23200a508493506a433940522d868be737a493d..b1e441399bce3993c8238fff8023d97d2ae31e5d 100644 (file)
@@ -32,8 +32,8 @@
 #include <babeltrace/graph/component-source-internal.h>
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/port-internal.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/message-iterator.h>
+#include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/graph/graph.h>
 
 BT_HIDDEN
index eb9118613750027fe4279444fbce3fce7bc536a3..13c2aa0d95fb9b5ef065560292759a80705025fe 100644 (file)
@@ -38,7 +38,7 @@
 #include <babeltrace/graph/component-sink-internal.h>
 #include <babeltrace/graph/connection-internal.h>
 #include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
@@ -483,7 +483,7 @@ void remove_port_by_index(struct bt_component *component,
         * below (in which its component is `NULL` as expected because
         * of the bt_object_set_parent() call below).
         *
-        * To avoid a destroyed port during the notification callback,
+        * To avoid a destroyed port during the message callback,
         * get a reference now, and put it (destroying the port if its
         * reference count is 0 at this point) after notifying the
         * graph's user.
index ebe03903025ea30305c80b2d08b977b90b8d9a6f..84b1159f9e9f5cd403101d2bf87cb95b18ad928f 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/connection-internal.h>
 #include <babeltrace/graph/connection-const.h>
@@ -46,13 +46,13 @@ void destroy_connection(struct bt_object *obj)
        BT_LIB_LOGD("Destroying connection: %!+x", connection);
 
        /*
-        * Make sure that each notification iterator which was created
+        * Make sure that each message iterator which was created
         * for this connection is finalized before we destroy it. Once a
-        * notification iterator is finalized, all its method return
-        * NULL or the BT_NOTIFICATION_ITERATOR_STATUS_CANCELED status.
+        * message iterator is finalized, all its method return
+        * NULL or the BT_MESSAGE_ITERATOR_STATUS_CANCELED status.
         *
         * Because connections are destroyed before components within a
-        * graph, this ensures that notification iterators are always
+        * graph, this ensures that message iterators are always
         * finalized before their upstream component.
         *
         * Ending the connection does exactly this. We pass `false` to
@@ -87,7 +87,7 @@ void try_remove_connection_from_graph(struct bt_connection *connection)
         * At this point we know that:
         *
         * 1. The connection is ended (ports were disconnected).
-        * 2. All the notification iterators that this connection
+        * 2. All the message iterators that this connection
         *    created, if any, are finalized.
         * 3. The connection's reference count is 0, so only the
         *    parent (graph) owns this connection after this call.
@@ -168,7 +168,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph)
                conn, try_remove_from_graph);
 
        /*
-        * Any of the following notification callback functions could
+        * Any of the following message callback functions could
         * remove one of the connection's ports from its component. To
         * make sure that at least logging in called functions works
         * with existing objects, get a local reference on both ports.
@@ -194,29 +194,29 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph)
                conn->upstream_port = NULL;
        }
 
-       if (downstream_comp && conn->notified_downstream_port_connected &&
-                       !conn->notified_downstream_port_disconnected) {
+       if (downstream_comp && conn->msgied_downstream_port_connected &&
+                       !conn->msgied_downstream_port_disconnected) {
                /* bt_component_port_disconnected() logs details */
                bt_component_port_disconnected(downstream_comp,
                        downstream_port);
-               conn->notified_downstream_port_disconnected = true;
+               conn->msgied_downstream_port_disconnected = true;
        }
 
-       if (upstream_comp && conn->notified_upstream_port_connected &&
-                       !conn->notified_upstream_port_disconnected) {
+       if (upstream_comp && conn->msgied_upstream_port_connected &&
+                       !conn->msgied_upstream_port_disconnected) {
                /* bt_component_port_disconnected() logs details */
                bt_component_port_disconnected(upstream_comp, upstream_port);
-               conn->notified_upstream_port_disconnected = true;
+               conn->msgied_upstream_port_disconnected = true;
        }
 
        BT_ASSERT(graph);
 
-       if (conn->notified_graph_ports_connected &&
-                       !conn->notified_graph_ports_disconnected) {
+       if (conn->msgied_graph_ports_connected &&
+                       !conn->msgied_graph_ports_disconnected) {
                /* bt_graph_notify_ports_disconnected() logs details */
                bt_graph_notify_ports_disconnected(graph, upstream_comp,
                        downstream_comp, upstream_port, downstream_port);
-               conn->notified_graph_ports_disconnected = true;
+               conn->msgied_graph_ports_disconnected = true;
        }
 
        /*
@@ -228,15 +228,15 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph)
 
        /*
         * Because this connection is ended, finalize (cancel) each
-        * notification iterator created from it.
+        * message iterator created from it.
         */
        for (i = 0; i < conn->iterators->len; i++) {
-               struct bt_self_component_port_input_notification_iterator *iterator =
+               struct bt_self_component_port_input_message_iterator *iterator =
                        g_ptr_array_index(conn->iterators, i);
 
-               BT_LIB_LOGD("Finalizing notification iterator created by "
+               BT_LIB_LOGD("Finalizing message iterator created by "
                        "this ended connection: %![iter-]+i", iterator);
-               bt_self_component_port_input_notification_iterator_finalize(
+               bt_self_component_port_input_message_iterator_finalize(
                        iterator);
 
                /*
@@ -244,7 +244,7 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph)
                 * from this connection's iterators on destruction
                 * because this connection won't exist anymore.
                 */
-               bt_self_component_port_input_notification_iterator_set_connection(
+               bt_self_component_port_input_message_iterator_set_connection(
                        iterator, NULL);
        }
 
@@ -271,10 +271,10 @@ const struct bt_port_input *bt_connection_borrow_downstream_port_const(
 
 BT_HIDDEN
 void bt_connection_remove_iterator(struct bt_connection *conn,
-               struct bt_self_component_port_input_notification_iterator *iterator)
+               struct bt_self_component_port_input_message_iterator *iterator)
 {
        g_ptr_array_remove(conn->iterators, iterator);
-       BT_LIB_LOGV("Removed notification iterator from connection: "
+       BT_LIB_LOGV("Removed message iterator from connection: "
                "%![conn-]+x, %![iter-]+i", conn, iterator);
        try_remove_connection_from_graph(conn);
 }
index 3588c54a054d7a0c954b69fce72987eb57394c98..3b48c561b685718aab9702040d84b3f2cd15a3c2 100644 (file)
@@ -35,9 +35,9 @@
 #include <babeltrace/graph/component-source-const.h>
 #include <babeltrace/graph/component-filter-const.h>
 #include <babeltrace/graph/port-const.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/graph/notification-event-internal.h>
-#include <babeltrace/graph/notification-packet-internal.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/message-event-internal.h>
+#include <babeltrace/graph/message-packet-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/types.h>
@@ -119,14 +119,14 @@ void destroy_graph(struct bt_object *obj)
         *
         * 1. We put and destroy a connection.
         * 2. This connection's destructor finalizes its active
-        *    notification iterators.
-        * 3. A notification iterator's finalization function gets a
+        *    message iterators.
+        * 3. A message iterator's finalization function gets a
         *    new reference on its component (reference count goes from
         *    0 to 1).
         * 4. Since this component's reference count goes to 1, it takes
         *    a reference on its parent (this graph). This graph's
         *    reference count goes from 0 to 1.
-        * 5. The notification iterator's finalization function puts its
+        * 5. The message iterator's finalization function puts its
         *    component reference (reference count goes from 1 to 0).
         * 6. Since this component's reference count goes from 1 to 0,
         *    it puts its parent (this graph). This graph's reference
@@ -143,7 +143,7 @@ void destroy_graph(struct bt_object *obj)
 
        /*
         * Cancel the graph to disallow some operations, like creating
-        * notification iterators and adding ports to components.
+        * message iterators and adding ports to components.
         */
        (void) bt_graph_cancel((void *) graph);
 
@@ -177,9 +177,9 @@ void destroy_graph(struct bt_object *obj)
        CALL_REMOVE_LISTENERS(struct bt_graph_listener_ports_disconnected,
                graph->listeners.filter_sink_ports_disconnected);
 
-       if (graph->notifications) {
-               g_ptr_array_free(graph->notifications, TRUE);
-               graph->notifications = NULL;
+       if (graph->messages) {
+               g_ptr_array_free(graph->messages, TRUE);
+               graph->messages = NULL;
        }
 
        if (graph->connections) {
@@ -275,37 +275,37 @@ void destroy_graph(struct bt_object *obj)
                graph->listeners.filter_sink_ports_disconnected = NULL;
        }
 
-       bt_object_pool_finalize(&graph->event_notif_pool);
-       bt_object_pool_finalize(&graph->packet_begin_notif_pool);
-       bt_object_pool_finalize(&graph->packet_end_notif_pool);
+       bt_object_pool_finalize(&graph->event_msg_pool);
+       bt_object_pool_finalize(&graph->packet_begin_msg_pool);
+       bt_object_pool_finalize(&graph->packet_end_msg_pool);
        g_free(graph);
 }
 
 static
-void destroy_notification_event(struct bt_notification *notif,
+void destroy_message_event(struct bt_message *msg,
                struct bt_graph *graph)
 {
-       bt_notification_event_destroy(notif);
+       bt_message_event_destroy(msg);
 }
 
 static
-void destroy_notification_packet_begin(struct bt_notification *notif,
+void destroy_message_packet_begin(struct bt_message *msg,
                struct bt_graph *graph)
 {
-       bt_notification_packet_beginning_destroy(notif);
+       bt_message_packet_beginning_destroy(msg);
 }
 
 static
-void destroy_notification_packet_end(struct bt_notification *notif,
+void destroy_message_packet_end(struct bt_message *msg,
                struct bt_graph *graph)
 {
-       bt_notification_packet_end_destroy(notif);
+       bt_message_packet_end_destroy(msg);
 }
 
 static
-void notify_notification_graph_is_destroyed(struct bt_notification *notif)
+void notify_message_graph_is_destroyed(struct bt_message *msg)
 {
-       bt_notification_unlink_graph(notif);
+       bt_message_unlink_graph(msg);
 }
 
 struct bt_graph *bt_graph_create(void)
@@ -452,38 +452,38 @@ struct bt_graph *bt_graph_create(void)
                goto error;
        }
 
-       ret = bt_object_pool_initialize(&graph->event_notif_pool,
-               (bt_object_pool_new_object_func) bt_notification_event_new,
-               (bt_object_pool_destroy_object_func) destroy_notification_event,
+       ret = bt_object_pool_initialize(&graph->event_msg_pool,
+               (bt_object_pool_new_object_func) bt_message_event_new,
+               (bt_object_pool_destroy_object_func) destroy_message_event,
                graph);
        if (ret) {
-               BT_LOGE("Failed to initialize event notification pool: ret=%d",
+               BT_LOGE("Failed to initialize event message pool: ret=%d",
                        ret);
                goto error;
        }
 
-       ret = bt_object_pool_initialize(&graph->packet_begin_notif_pool,
-               (bt_object_pool_new_object_func) bt_notification_packet_beginning_new,
-               (bt_object_pool_destroy_object_func) destroy_notification_packet_begin,
+       ret = bt_object_pool_initialize(&graph->packet_begin_msg_pool,
+               (bt_object_pool_new_object_func) bt_message_packet_beginning_new,
+               (bt_object_pool_destroy_object_func) destroy_message_packet_begin,
                graph);
        if (ret) {
-               BT_LOGE("Failed to initialize packet beginning notification pool: ret=%d",
+               BT_LOGE("Failed to initialize packet beginning message pool: ret=%d",
                        ret);
                goto error;
        }
 
-       ret = bt_object_pool_initialize(&graph->packet_end_notif_pool,
-               (bt_object_pool_new_object_func) bt_notification_packet_end_new,
-               (bt_object_pool_destroy_object_func) destroy_notification_packet_end,
+       ret = bt_object_pool_initialize(&graph->packet_end_msg_pool,
+               (bt_object_pool_new_object_func) bt_message_packet_end_new,
+               (bt_object_pool_destroy_object_func) destroy_message_packet_end,
                graph);
        if (ret) {
-               BT_LOGE("Failed to initialize packet end notification pool: ret=%d",
+               BT_LOGE("Failed to initialize packet end message pool: ret=%d",
                        ret);
                goto error;
        }
 
-       graph->notifications = g_ptr_array_new_with_free_func(
-               (GDestroyNotify) notify_notification_graph_is_destroyed);
+       graph->messages = g_ptr_array_new_with_free_func(
+               (GDestroyNotify) notify_message_graph_is_destroyed);
        BT_LIB_LOGD("Created graph object: %!+g", graph);
 
 end:
@@ -608,7 +608,7 @@ enum bt_graph_status bt_graph_connect_ports(
                goto end;
        }
 
-       connection->notified_upstream_port_connected = true;
+       connection->msgied_upstream_port_connected = true;
        BT_LIB_LOGD("Notifying downstream component that its port is connected: "
                "%![comp-]+c, %![port-]+p", downstream_component,
                downstream_port);
@@ -626,14 +626,14 @@ enum bt_graph_status bt_graph_connect_ports(
                goto end;
        }
 
-       connection->notified_downstream_port_connected = true;
+       connection->msgied_downstream_port_connected = true;
 
        /*
         * Notify the graph's creator that both ports are connected.
         */
        BT_LOGD_STR("Notifying graph's user that new component ports are connected.");
        bt_graph_notify_ports_connected(graph, upstream_port, downstream_port);
-       connection->notified_graph_ports_connected = true;
+       connection->msgied_graph_ports_connected = true;
        BT_LIB_LOGD("Connected component ports within graph: "
                "%![graph-]+g, %![up-comp-]+c, %![down-comp-]+c, "
                "%![up-port-]+p, %![down-port-]+p",
@@ -1920,21 +1920,21 @@ end:
 }
 
 BT_HIDDEN
-void bt_graph_add_notification(struct bt_graph *graph,
-               struct bt_notification *notif)
+void bt_graph_add_message(struct bt_graph *graph,
+               struct bt_message *msg)
 {
        BT_ASSERT(graph);
-       BT_ASSERT(notif);
+       BT_ASSERT(msg);
 
        /*
         * It's okay not to take a reference because, when a
-        * notification's reference count drops to 0, either:
+        * message's reference count drops to 0, either:
         *
         * * It is recycled back to one of this graph's pool.
         * * It is destroyed because it doesn't have any link to any
         *   graph, which means the original graph is already destroyed.
         */
-       g_ptr_array_add(graph->notifications, notif);
+       g_ptr_array_add(graph->messages, msg);
 }
 
 void bt_graph_get_ref(const struct bt_graph *graph)
index db774dfd298a6b13d7a6f79ad1807906b2be3e0e..2c2fcadb47733ecb5b822f9875009aeac51898a9 100644 (file)
@@ -21,7 +21,7 @@
  * SOFTWARE.
  */
 
-#define BT_LOG_TAG "NOTIF-ITER"
+#define BT_LOG_TAG "MSG-ITER"
 #include <babeltrace/lib-logging-internal.h>
 
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/graph/component-class-internal.h>
 #include <babeltrace/graph/component-class-sink-colander-internal.h>
 #include <babeltrace/graph/component-sink-const.h>
-#include <babeltrace/graph/notification-const.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
-#include <babeltrace/graph/self-component-port-input-notification-iterator.h>
-#include <babeltrace/graph/port-output-notification-iterator.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/graph/notification-event-const.h>
-#include <babeltrace/graph/notification-event-internal.h>
-#include <babeltrace/graph/notification-packet-const.h>
-#include <babeltrace/graph/notification-packet-internal.h>
-#include <babeltrace/graph/notification-stream-const.h>
-#include <babeltrace/graph/notification-stream-internal.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/graph/message-iterator.h>
+#include <babeltrace/graph/message-iterator-internal.h>
+#include <babeltrace/graph/self-component-port-input-message-iterator.h>
+#include <babeltrace/graph/port-output-message-iterator.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/message-event-const.h>
+#include <babeltrace/graph/message-event-internal.h>
+#include <babeltrace/graph/message-packet-const.h>
+#include <babeltrace/graph/message-packet-internal.h>
+#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream-internal.h>
 #include <babeltrace/graph/port-const.h>
 #include <babeltrace/graph/graph.h>
 #include <babeltrace/graph/graph-const.h>
  * TODO: Use graph's state (number of active iterators, etc.) and
  * possibly system specifications to make a better guess than this.
  */
-#define NOTIF_BATCH_SIZE       15
+#define MSG_BATCH_SIZE 15
 
 struct stream_state {
        const struct bt_stream *stream; /* owned by this */
        const struct bt_packet *cur_packet; /* owned by this */
-       uint64_t expected_notif_seq_num;
+       uint64_t expected_msg_seq_num;
        bt_bool is_ended;
 };
 
@@ -116,32 +116,32 @@ end:
 }
 
 static
-void destroy_base_notification_iterator(struct bt_object *obj)
+void destroy_base_message_iterator(struct bt_object *obj)
 {
-       struct bt_notification_iterator *iterator = (void *) obj;
+       struct bt_message_iterator *iterator = (void *) obj;
 
        BT_ASSERT(iterator);
 
-       if (iterator->notifs) {
-               g_ptr_array_free(iterator->notifs, TRUE);
-               iterator->notifs = NULL;
+       if (iterator->msgs) {
+               g_ptr_array_free(iterator->msgs, TRUE);
+               iterator->msgs = NULL;
        }
 
        g_free(iterator);
 }
 
 static
-void bt_self_component_port_input_notification_iterator_destroy(struct bt_object *obj)
+void bt_self_component_port_input_message_iterator_destroy(struct bt_object *obj)
 {
-       struct bt_self_component_port_input_notification_iterator *iterator;
+       struct bt_self_component_port_input_message_iterator *iterator;
 
        BT_ASSERT(obj);
 
        /*
-        * The notification iterator's reference count is 0 if we're
+        * The message iterator's reference count is 0 if we're
         * here. Increment it to avoid a double-destroy (possibly
         * infinitely recursive). This could happen for example if the
-        * notification iterator's finalization function does
+        * message iterator's finalization function does
         * bt_object_get_ref() (or anything that causes
         * bt_object_get_ref() to be called) on itself (ref. count goes
         * from 0 to 1), and then bt_object_put_ref(): the reference
@@ -150,16 +150,16 @@ void bt_self_component_port_input_notification_iterator_destroy(struct bt_object
         */
        obj->ref_count++;
        iterator = (void *) obj;
-       BT_LIB_LOGD("Destroying self component input port notification iterator object: "
+       BT_LIB_LOGD("Destroying self component input port message iterator object: "
                "%!+i", iterator);
-       bt_self_component_port_input_notification_iterator_finalize(iterator);
+       bt_self_component_port_input_message_iterator_finalize(iterator);
 
        if (iterator->stream_states) {
                /*
                 * Remove our destroy listener from each stream which
                 * has a state in this iterator. Otherwise the destroy
                 * listener would be called with an invalid/other
-                * notification iterator object.
+                * message iterator object.
                 */
                g_hash_table_destroy(iterator->stream_states);
                iterator->stream_states = NULL;
@@ -175,12 +175,12 @@ void bt_self_component_port_input_notification_iterator_destroy(struct bt_object
                iterator->connection = NULL;
        }
 
-       destroy_base_notification_iterator(obj);
+       destroy_base_message_iterator(obj);
 }
 
 BT_HIDDEN
-void bt_self_component_port_input_notification_iterator_finalize(
-               struct bt_self_component_port_input_notification_iterator *iterator)
+void bt_self_component_port_input_message_iterator_finalize(
+               struct bt_self_component_port_input_message_iterator *iterator)
 {
        typedef void (*method_t)(void *);
 
@@ -190,31 +190,31 @@ void bt_self_component_port_input_notification_iterator_finalize(
        BT_ASSERT(iterator);
 
        switch (iterator->state) {
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_NON_INITIALIZED:
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED:
                /* Skip user finalization if user initialization failed */
-               BT_LIB_LOGD("Not finalizing non-initialized notification iterator: "
+               BT_LIB_LOGD("Not finalizing non-initialized message iterator: "
                        "%!+i", iterator);
                return;
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED:
-       case BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED:
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED:
+       case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED:
                /* Already finalized */
-               BT_LIB_LOGD("Not finalizing notification iterator: already finalized: "
+               BT_LIB_LOGD("Not finalizing message iterator: already finalized: "
                        "%!+i", iterator);
                return;
        default:
                break;
        }
 
-       BT_LIB_LOGD("Finalizing notification iterator: %!+i", iterator);
+       BT_LIB_LOGD("Finalizing message iterator: %!+i", iterator);
 
-       if (iterator->state == BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ENDED) {
-               BT_LIB_LOGD("Updating notification iterator's state: "
-                       "new-state=BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED");
-               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED;
+       if (iterator->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED) {
+               BT_LIB_LOGD("Updating message iterator's state: "
+                       "new-state=BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED");
+               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED;
        } else {
-               BT_LIB_LOGD("Updating notification iterator's state: "
-                       "new-state=BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED");
-               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED;
+               BT_LIB_LOGD("Updating message iterator's state: "
+                       "new-state=BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED");
+               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED;
        }
 
        BT_ASSERT(iterator->upstream_component);
@@ -227,7 +227,7 @@ void bt_self_component_port_input_notification_iterator_finalize(
                struct bt_component_class_source *src_comp_cls =
                        (void *) comp_class;
 
-               method = (method_t) src_comp_cls->methods.notif_iter_finalize;
+               method = (method_t) src_comp_cls->methods.msg_iter_finalize;
                break;
        }
        case BT_COMPONENT_CLASS_TYPE_FILTER:
@@ -235,7 +235,7 @@ void bt_self_component_port_input_notification_iterator_finalize(
                struct bt_component_class_filter *flt_comp_cls =
                        (void *) comp_class;
 
-               method = (method_t) flt_comp_cls->methods.notif_iter_finalize;
+               method = (method_t) flt_comp_cls->methods.msg_iter_finalize;
                break;
        }
        default:
@@ -251,73 +251,73 @@ void bt_self_component_port_input_notification_iterator_finalize(
 
        iterator->upstream_component = NULL;
        iterator->upstream_port = NULL;
-       BT_LIB_LOGD("Finalized notification iterator: %!+i", iterator);
+       BT_LIB_LOGD("Finalized message iterator: %!+i", iterator);
 }
 
 BT_HIDDEN
-void bt_self_component_port_input_notification_iterator_set_connection(
-               struct bt_self_component_port_input_notification_iterator *iterator,
+void bt_self_component_port_input_message_iterator_set_connection(
+               struct bt_self_component_port_input_message_iterator *iterator,
                struct bt_connection *connection)
 {
        BT_ASSERT(iterator);
        iterator->connection = connection;
-       BT_LIB_LOGV("Set notification iterator's connection: "
+       BT_LIB_LOGV("Set message iterator's connection: "
                "%![iter-]+i, %![conn-]+x", iterator, connection);
 }
 
 static
-int init_notification_iterator(struct bt_notification_iterator *iterator,
-               enum bt_notification_iterator_type type,
+int init_message_iterator(struct bt_message_iterator *iterator,
+               enum bt_message_iterator_type type,
                bt_object_release_func destroy)
 {
        int ret = 0;
 
        bt_object_init_shared(&iterator->base, destroy);
        iterator->type = type;
-       iterator->notifs = g_ptr_array_new();
-       if (!iterator->notifs) {
+       iterator->msgs = g_ptr_array_new();
+       if (!iterator->msgs) {
                BT_LOGE_STR("Failed to allocate a GPtrArray.");
                ret = -1;
                goto end;
        }
 
-       g_ptr_array_set_size(iterator->notifs, NOTIF_BATCH_SIZE);
+       g_ptr_array_set_size(iterator->msgs, MSG_BATCH_SIZE);
 
 end:
        return ret;
 }
 
 static
-struct bt_self_component_port_input_notification_iterator *
-bt_self_component_port_input_notification_iterator_create_initial(
+struct bt_self_component_port_input_message_iterator *
+bt_self_component_port_input_message_iterator_create_initial(
                struct bt_component *upstream_comp,
                struct bt_port *upstream_port)
 {
        int ret;
-       struct bt_self_component_port_input_notification_iterator *iterator = NULL;
+       struct bt_self_component_port_input_message_iterator *iterator = NULL;
 
        BT_ASSERT(upstream_comp);
        BT_ASSERT(upstream_port);
        BT_ASSERT(bt_port_is_connected(upstream_port));
-       BT_LIB_LOGD("Creating initial notification iterator on self component input port: "
+       BT_LIB_LOGD("Creating initial message iterator on self component input port: "
                "%![up-comp-]+c, %![up-port-]+p", upstream_comp, upstream_port);
        BT_ASSERT(bt_component_get_class_type(upstream_comp) ==
                BT_COMPONENT_CLASS_TYPE_SOURCE ||
                bt_component_get_class_type(upstream_comp) ==
                BT_COMPONENT_CLASS_TYPE_FILTER);
        iterator = g_new0(
-               struct bt_self_component_port_input_notification_iterator, 1);
+               struct bt_self_component_port_input_message_iterator, 1);
        if (!iterator) {
                BT_LOGE_STR("Failed to allocate one self component input port "
-                       "notification iterator.");
+                       "message iterator.");
                goto end;
        }
 
-       ret = init_notification_iterator((void *) iterator,
-               BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT,
-               bt_self_component_port_input_notification_iterator_destroy);
+       ret = init_message_iterator((void *) iterator,
+               BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT,
+               bt_self_component_port_input_message_iterator_destroy);
        if (ret) {
-               /* init_notification_iterator() logs errors */
+               /* init_message_iterator() logs errors */
                BT_OBJECT_PUT_REF_AND_RESET(iterator);
                goto end;
        }
@@ -334,8 +334,8 @@ bt_self_component_port_input_notification_iterator_create_initial(
        iterator->upstream_port = upstream_port;
        iterator->connection = iterator->upstream_port->connection;
        iterator->graph = bt_component_borrow_graph(upstream_comp);
-       iterator->state = BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_NON_INITIALIZED;
-       BT_LIB_LOGD("Created initial notification iterator on self component input port: "
+       iterator->state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED;
+       BT_LIB_LOGD("Created initial message iterator on self component input port: "
                "%![up-port-]+p, %![up-comp-]+c, %![iter-]+i",
                upstream_port, upstream_comp, iterator);
 
@@ -343,15 +343,15 @@ end:
        return iterator;
 }
 
-struct bt_self_component_port_input_notification_iterator *
-bt_self_component_port_input_notification_iterator_create(
+struct bt_self_component_port_input_message_iterator *
+bt_self_component_port_input_message_iterator_create(
                struct bt_self_component_port_input *self_port)
 {
-       typedef enum bt_self_notification_iterator_status (*init_method_t)(
+       typedef enum bt_self_message_iterator_status (*init_method_t)(
                        void *, void *, void *);
 
        init_method_t init_method = NULL;
-       struct bt_self_component_port_input_notification_iterator *iterator =
+       struct bt_self_component_port_input_message_iterator *iterator =
                NULL;
        struct bt_port *port = (void *) self_port;
        struct bt_port *upstream_port;
@@ -378,11 +378,11 @@ bt_self_component_port_input_notification_iterator_create(
                BT_COMPONENT_CLASS_TYPE_SOURCE ||
                upstream_comp->class->type ==
                BT_COMPONENT_CLASS_TYPE_FILTER);
-       iterator = bt_self_component_port_input_notification_iterator_create_initial(
+       iterator = bt_self_component_port_input_message_iterator_create_initial(
                upstream_comp, upstream_port);
        if (!iterator) {
                BT_LOGW_STR("Cannot create self component input port "
-                       "notification iterator.");
+                       "message iterator.");
                goto end;
        }
 
@@ -393,7 +393,7 @@ bt_self_component_port_input_notification_iterator_create(
                        (void *) upstream_comp_cls;
 
                init_method =
-                       (init_method_t) src_comp_cls->methods.notif_iter_init;
+                       (init_method_t) src_comp_cls->methods.msg_iter_init;
                break;
        }
        case BT_COMPONENT_CLASS_TYPE_FILTER:
@@ -402,7 +402,7 @@ bt_self_component_port_input_notification_iterator_create(
                        (void *) upstream_comp_cls;
 
                init_method =
-                       (init_method_t) flt_comp_cls->methods.notif_iter_init;
+                       (init_method_t) flt_comp_cls->methods.msg_iter_init;
                break;
        }
        default:
@@ -417,16 +417,16 @@ bt_self_component_port_input_notification_iterator_create(
                iter_status = init_method(iterator, upstream_comp,
                        upstream_port);
                BT_LOGD("User method returned: status=%s",
-                       bt_notification_iterator_status_string(iter_status));
-               if (iter_status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+                       bt_message_iterator_status_string(iter_status));
+               if (iter_status != BT_MESSAGE_ITERATOR_STATUS_OK) {
                        BT_LOGW_STR("Initialization method failed.");
                        goto end;
                }
        }
 
-       iterator->state = BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE;
+       iterator->state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE;
        g_ptr_array_add(port->connection->iterators, iterator);
-       BT_LIB_LOGD("Created notification iterator on self component input port: "
+       BT_LIB_LOGD("Created message iterator on self component input port: "
                "%![up-port-]+p, %![up-comp-]+c, %![iter-]+i",
                upstream_port, upstream_comp, iterator);
 
@@ -434,54 +434,54 @@ end:
        return iterator;
 }
 
-void *bt_self_notification_iterator_get_data(
-               const struct bt_self_notification_iterator *self_iterator)
+void *bt_self_message_iterator_get_data(
+               const struct bt_self_message_iterator *self_iterator)
 {
-       struct bt_self_component_port_input_notification_iterator *iterator =
+       struct bt_self_component_port_input_message_iterator *iterator =
                (void *) self_iterator;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        return iterator->user_data;
 }
 
-void bt_self_notification_iterator_set_data(
-               struct bt_self_notification_iterator *self_iterator, void *data)
+void bt_self_message_iterator_set_data(
+               struct bt_self_message_iterator *self_iterator, void *data)
 {
-       struct bt_self_component_port_input_notification_iterator *iterator =
+       struct bt_self_component_port_input_message_iterator *iterator =
                (void *) self_iterator;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        iterator->user_data = data;
-       BT_LIB_LOGV("Set notification iterator's user data: "
+       BT_LIB_LOGV("Set message iterator's user data: "
                "%!+i, user-data-addr=%p", iterator, data);
 }
 
 BT_ASSERT_PRE_FUNC
 static inline
-void bt_notification_borrow_packet_stream(const struct bt_notification *notif,
+void bt_message_borrow_packet_stream(const struct bt_message *msg,
                const struct bt_stream **stream,
                const struct bt_packet **packet)
 {
-       BT_ASSERT(notif);
+       BT_ASSERT(msg);
 
-       switch (notif->type) {
-       case BT_NOTIFICATION_TYPE_EVENT:
+       switch (msg->type) {
+       case BT_MESSAGE_TYPE_EVENT:
                *packet = bt_event_borrow_packet_const(
-                       bt_notification_event_borrow_event_const(notif));
+                       bt_message_event_borrow_event_const(msg));
                *stream = bt_packet_borrow_stream_const(*packet);
                break;
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
-               *stream = bt_notification_stream_beginning_borrow_stream_const(notif);
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+               *stream = bt_message_stream_beginning_borrow_stream_const(msg);
                break;
-       case BT_NOTIFICATION_TYPE_STREAM_END:
-               *stream = bt_notification_stream_end_borrow_stream_const(notif);
+       case BT_MESSAGE_TYPE_STREAM_END:
+               *stream = bt_message_stream_end_borrow_stream_const(msg);
                break;
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               *packet = bt_notification_packet_beginning_borrow_packet_const(notif);
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               *packet = bt_message_packet_beginning_borrow_packet_const(msg);
                *stream = bt_packet_borrow_stream_const(*packet);
                break;
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               *packet = bt_notification_packet_end_borrow_packet_const(notif);
+       case BT_MESSAGE_TYPE_PACKET_END:
+               *packet = bt_message_packet_end_borrow_packet_const(msg);
                *stream = bt_packet_borrow_stream_const(*packet);
                break;
        default:
@@ -491,51 +491,51 @@ void bt_notification_borrow_packet_stream(const struct bt_notification *notif,
 
 BT_ASSERT_PRE_FUNC
 static inline
-bool validate_notification(
-               struct bt_self_component_port_input_notification_iterator *iterator,
-               const struct bt_notification *c_notif)
+bool validate_message(
+               struct bt_self_component_port_input_message_iterator *iterator,
+               const struct bt_message *c_msg)
 {
        bool is_valid = true;
        struct stream_state *stream_state;
        const struct bt_stream *stream = NULL;
        const struct bt_packet *packet = NULL;
-       struct bt_notification *notif = (void *) c_notif;
+       struct bt_message *msg = (void *) c_msg;
 
-       BT_ASSERT(notif);
-       bt_notification_borrow_packet_stream(c_notif, &stream, &packet);
+       BT_ASSERT(msg);
+       bt_message_borrow_packet_stream(c_msg, &stream, &packet);
 
        if (!stream) {
-               /* we don't care about notifications not attached to streams */
+               /* we don't care about messages not attached to streams */
                goto end;
        }
 
        stream_state = g_hash_table_lookup(iterator->stream_states, stream);
        if (!stream_state) {
                /*
-                * No stream state for this stream: this notification
-                * MUST be a BT_NOTIFICATION_TYPE_STREAM_BEGINNING notification
+                * No stream state for this stream: this message
+                * MUST be a BT_MESSAGE_TYPE_STREAM_BEGINNING message
                 * and its sequence number must be 0.
                 */
-               if (c_notif->type != BT_NOTIFICATION_TYPE_STREAM_BEGINNING) {
-                       BT_ASSERT_PRE_MSG("Unexpected notification: missing a "
-                               "BT_NOTIFICATION_TYPE_STREAM_BEGINNING "
-                               "notification prior to this notification: "
+               if (c_msg->type != BT_MESSAGE_TYPE_STREAM_BEGINNING) {
+                       BT_ASSERT_PRE_MSG("Unexpected message: missing a "
+                               "BT_MESSAGE_TYPE_STREAM_BEGINNING "
+                               "message prior to this message: "
                                "%![stream-]+s", stream);
                        is_valid = false;
                        goto end;
                }
 
-               if (c_notif->seq_num == -1ULL) {
-                       notif->seq_num = 0;
+               if (c_msg->seq_num == -1ULL) {
+                       msg->seq_num = 0;
                }
 
-               if (c_notif->seq_num != 0) {
-                       BT_ASSERT_PRE_MSG("Unexpected notification sequence "
-                               "number for this notification iterator: "
-                               "this is the first notification for this "
+               if (c_msg->seq_num != 0) {
+                       BT_ASSERT_PRE_MSG("Unexpected message sequence "
+                               "number for this message iterator: "
+                               "this is the first message for this "
                                "stream, expecting sequence number 0: "
                                "seq-num=%" PRIu64 ", %![stream-]+s",
-                               c_notif->seq_num, stream);
+                               c_msg->seq_num, stream);
                        is_valid = false;
                        goto end;
                }
@@ -547,15 +547,15 @@ bool validate_notification(
 
                g_hash_table_insert(iterator->stream_states,
                        (void *) stream, stream_state);
-               stream_state->expected_notif_seq_num++;
+               stream_state->expected_msg_seq_num++;
                goto end;
        }
 
        if (stream_state->is_ended) {
                /*
-                * There's a new notification which has a reference to a
+                * There's a new message which has a reference to a
                 * stream which, from this iterator's point of view, is
-                * ended ("end of stream" notification was returned).
+                * ended ("end of stream" message was returned).
                 * This is bad: the API guarantees that it can never
                 * happen.
                 */
@@ -565,85 +565,85 @@ bool validate_notification(
                goto end;
        }
 
-       if (c_notif->seq_num == -1ULL) {
-               notif->seq_num = stream_state->expected_notif_seq_num;
+       if (c_msg->seq_num == -1ULL) {
+               msg->seq_num = stream_state->expected_msg_seq_num;
        }
 
-       if (c_notif->seq_num != -1ULL &&
-                       c_notif->seq_num != stream_state->expected_notif_seq_num) {
-               BT_ASSERT_PRE_MSG("Unexpected notification sequence number: "
+       if (c_msg->seq_num != -1ULL &&
+                       c_msg->seq_num != stream_state->expected_msg_seq_num) {
+               BT_ASSERT_PRE_MSG("Unexpected message sequence number: "
                        "seq-num=%" PRIu64 ", "
                        "expected-seq-num=%" PRIu64 ", %![stream-]+s",
-                       c_notif->seq_num, stream_state->expected_notif_seq_num,
+                       c_msg->seq_num, stream_state->expected_msg_seq_num,
                        stream);
                is_valid = false;
                goto end;
        }
 
-       switch (c_notif->type) {
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
-               BT_ASSERT_PRE_MSG("Unexpected BT_NOTIFICATION_TYPE_STREAM_BEGINNING "
-                       "notification at this point: notif-seq-num=%" PRIu64 ", "
-                       "%![stream-]+s", c_notif->seq_num, stream);
+       switch (c_msg->type) {
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+               BT_ASSERT_PRE_MSG("Unexpected BT_MESSAGE_TYPE_STREAM_BEGINNING "
+                       "message at this point: msg-seq-num=%" PRIu64 ", "
+                       "%![stream-]+s", c_msg->seq_num, stream);
                is_valid = false;
                goto end;
-       case BT_NOTIFICATION_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_END:
                if (stream_state->cur_packet) {
-                       BT_ASSERT_PRE_MSG("Unexpected BT_NOTIFICATION_TYPE_STREAM_END "
-                               "notification: missing a "
-                               "BT_NOTIFICATION_TYPE_PACKET_END notification "
-                               "prior to this notification: "
-                               "notif-seq-num=%" PRIu64 ", "
-                               "%![stream-]+s", c_notif->seq_num, stream);
+                       BT_ASSERT_PRE_MSG("Unexpected BT_MESSAGE_TYPE_STREAM_END "
+                               "message: missing a "
+                               "BT_MESSAGE_TYPE_PACKET_END message "
+                               "prior to this message: "
+                               "msg-seq-num=%" PRIu64 ", "
+                               "%![stream-]+s", c_msg->seq_num, stream);
                        is_valid = false;
                        goto end;
                }
-               stream_state->expected_notif_seq_num++;
+               stream_state->expected_msg_seq_num++;
                stream_state->is_ended = true;
                goto end;
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                if (stream_state->cur_packet) {
-                       BT_ASSERT_PRE_MSG("Unexpected BT_NOTIFICATION_TYPE_PACKET_BEGINNING "
-                               "notification at this point: missing a "
-                               "BT_NOTIFICATION_TYPE_PACKET_END notification "
-                               "prior to this notification: "
-                               "notif-seq-num=%" PRIu64 ", %![stream-]+s, "
-                               "%![packet-]+a", c_notif->seq_num, stream,
+                       BT_ASSERT_PRE_MSG("Unexpected BT_MESSAGE_TYPE_PACKET_BEGINNING "
+                               "message at this point: missing a "
+                               "BT_MESSAGE_TYPE_PACKET_END message "
+                               "prior to this message: "
+                               "msg-seq-num=%" PRIu64 ", %![stream-]+s, "
+                               "%![packet-]+a", c_msg->seq_num, stream,
                                packet);
                        is_valid = false;
                        goto end;
                }
-               stream_state->expected_notif_seq_num++;
+               stream_state->expected_msg_seq_num++;
                stream_state->cur_packet = packet;
                bt_object_get_no_null_check(stream_state->cur_packet);
                goto end;
-       case BT_NOTIFICATION_TYPE_PACKET_END:
+       case BT_MESSAGE_TYPE_PACKET_END:
                if (!stream_state->cur_packet) {
-                       BT_ASSERT_PRE_MSG("Unexpected BT_NOTIFICATION_TYPE_PACKET_END "
-                               "notification at this point: missing a "
-                               "BT_NOTIFICATION_TYPE_PACKET_BEGINNING notification "
-                               "prior to this notification: "
-                               "notif-seq-num=%" PRIu64 ", %![stream-]+s, "
-                               "%![packet-]+a", c_notif->seq_num, stream,
+                       BT_ASSERT_PRE_MSG("Unexpected BT_MESSAGE_TYPE_PACKET_END "
+                               "message at this point: missing a "
+                               "BT_MESSAGE_TYPE_PACKET_BEGINNING message "
+                               "prior to this message: "
+                               "msg-seq-num=%" PRIu64 ", %![stream-]+s, "
+                               "%![packet-]+a", c_msg->seq_num, stream,
                                packet);
                        is_valid = false;
                        goto end;
                }
-               stream_state->expected_notif_seq_num++;
+               stream_state->expected_msg_seq_num++;
                BT_OBJECT_PUT_REF_AND_RESET(stream_state->cur_packet);
                goto end;
-       case BT_NOTIFICATION_TYPE_EVENT:
+       case BT_MESSAGE_TYPE_EVENT:
                if (packet != stream_state->cur_packet) {
                        BT_ASSERT_PRE_MSG("Unexpected packet for "
-                               "BT_NOTIFICATION_TYPE_EVENT notification: "
-                               "notif-seq-num=%" PRIu64 ", %![stream-]+s, "
-                               "%![notif-packet-]+a, %![expected-packet-]+a",
-                               c_notif->seq_num, stream,
+                               "BT_MESSAGE_TYPE_EVENT message: "
+                               "msg-seq-num=%" PRIu64 ", %![stream-]+s, "
+                               "%![msg-packet-]+a, %![expected-packet-]+a",
+                               c_msg->seq_num, stream,
                                stream_state->cur_packet, packet);
                        is_valid = false;
                        goto end;
                }
-               stream_state->expected_notif_seq_num++;
+               stream_state->expected_msg_seq_num++;
                goto end;
        default:
                break;
@@ -655,17 +655,17 @@ end:
 
 BT_ASSERT_PRE_FUNC
 static inline
-bool validate_notifications(
-               struct bt_self_component_port_input_notification_iterator *iterator,
+bool validate_messages(
+               struct bt_self_component_port_input_message_iterator *iterator,
                uint64_t count)
 {
        bool ret = true;
-       bt_notification_array_const notifs =
-               (void *) iterator->base.notifs->pdata;
+       bt_message_array_const msgs =
+               (void *) iterator->base.msgs->pdata;
        uint64_t i;
 
        for (i = 0; i < count; i++) {
-               ret = validate_notification(iterator, notifs[i]);
+               ret = validate_message(iterator, msgs[i]);
                if (!ret) {
                        break;
                }
@@ -675,8 +675,8 @@ bool validate_notifications(
 }
 
 BT_ASSERT_PRE_FUNC
-static inline bool self_comp_port_input_notif_iter_can_end(
-               struct bt_self_component_port_input_notification_iterator *iterator)
+static inline bool self_comp_port_input_msg_iter_can_end(
+               struct bt_self_component_port_input_message_iterator *iterator)
 {
        GHashTableIter iter;
        gpointer stream_key, state_value;
@@ -684,7 +684,7 @@ static inline bool self_comp_port_input_notif_iter_can_end(
 
        /*
         * Verify that this iterator received a
-        * BT_NOTIFICATION_TYPE_STREAM_END notification for each stream
+        * BT_MESSAGE_TYPE_STREAM_END message for each stream
         * which has a state.
         */
 
@@ -697,7 +697,7 @@ static inline bool self_comp_port_input_notif_iter_can_end(
                BT_ASSERT(stream_key);
 
                if (!stream_state->is_ended) {
-                       BT_ASSERT_PRE_MSG("Ending notification iterator, "
+                       BT_ASSERT_PRE_MSG("Ending message iterator, "
                                "but stream is not ended: "
                                "%![stream-]s", stream_key);
                        ret = false;
@@ -709,29 +709,29 @@ end:
        return ret;
 }
 
-enum bt_notification_iterator_status
-bt_self_component_port_input_notification_iterator_next(
-               struct bt_self_component_port_input_notification_iterator *iterator,
-               bt_notification_array_const *notifs, uint64_t *user_count)
+enum bt_message_iterator_status
+bt_self_component_port_input_message_iterator_next(
+               struct bt_self_component_port_input_message_iterator *iterator,
+               bt_message_array_const *msgs, uint64_t *user_count)
 {
-       typedef enum bt_self_notification_iterator_status (*method_t)(
-                       void *, bt_notification_array_const, uint64_t, uint64_t *);
+       typedef enum bt_self_message_iterator_status (*method_t)(
+                       void *, bt_message_array_const, uint64_t, uint64_t *);
 
        method_t method = NULL;
        struct bt_component_class *comp_cls;
-       int status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       int status = BT_MESSAGE_ITERATOR_STATUS_OK;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(notifs, "Notification array (output)");
-       BT_ASSERT_PRE_NON_NULL(user_count, "Notification count (output)");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(msgs, "Message array (output)");
+       BT_ASSERT_PRE_NON_NULL(user_count, "Message count (output)");
        BT_ASSERT_PRE(iterator->state ==
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE,
-               "Notification iterator's \"next\" called, but "
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE,
+               "Message iterator's \"next\" called, but "
                "iterator is in the wrong state: %!+i", iterator);
        BT_ASSERT(iterator->upstream_component);
        BT_ASSERT(iterator->upstream_component->class);
        BT_LIB_LOGD("Getting next self component input port "
-               "notification iterator's notifications: %!+i", iterator);
+               "message iterator's messages: %!+i", iterator);
        comp_cls = iterator->upstream_component->class;
 
        /* Pick the appropriate "next" method */
@@ -741,7 +741,7 @@ bt_self_component_port_input_notification_iterator_next(
                struct bt_component_class_source *src_comp_cls =
                        (void *) comp_cls;
 
-               method = (method_t) src_comp_cls->methods.notif_iter_next;
+               method = (method_t) src_comp_cls->methods.msg_iter_next;
                break;
        }
        case BT_COMPONENT_CLASS_TYPE_FILTER:
@@ -749,7 +749,7 @@ bt_self_component_port_input_notification_iterator_next(
                struct bt_component_class_filter *flt_comp_cls =
                        (void *) comp_cls;
 
-               method = (method_t) flt_comp_cls->methods.notif_iter_next;
+               method = (method_t) flt_comp_cls->methods.msg_iter_next;
                break;
        }
        default:
@@ -757,68 +757,68 @@ bt_self_component_port_input_notification_iterator_next(
        }
 
        /*
-        * Call the user's "next" method to get the next notifications
+        * Call the user's "next" method to get the next messages
         * and status.
         */
        BT_ASSERT(method);
        BT_LOGD_STR("Calling user's \"next\" method.");
        status = method(iterator,
-               (void *) iterator->base.notifs->pdata,
-               NOTIF_BATCH_SIZE, user_count);
+               (void *) iterator->base.msgs->pdata,
+               MSG_BATCH_SIZE, user_count);
        BT_LOGD("User method returned: status=%s",
-               bt_notification_iterator_status_string(status));
+               bt_message_iterator_status_string(status));
        if (status < 0) {
                BT_LOGW_STR("User method failed.");
                goto end;
        }
 
-       if (iterator->state == BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED ||
-                       iterator->state == BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED) {
+       if (iterator->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED ||
+                       iterator->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED_AND_ENDED) {
                /*
                 * The user's "next" method, somehow, cancelled its own
-                * notification iterator. This can happen, for example,
+                * message iterator. This can happen, for example,
                 * when the user's method removes the port on which
                 * there's the connection from which the iterator was
                 * created. In this case, said connection is ended, and
-                * all its notification iterators are finalized.
+                * all its message iterators are finalized.
                 *
-                * Only bt_object_put_ref() the returned notification if
-                * the status is BT_NOTIFICATION_ITERATOR_STATUS_OK
+                * Only bt_object_put_ref() the returned message if
+                * the status is BT_MESSAGE_ITERATOR_STATUS_OK
                 * because otherwise this field could be garbage.
                 */
-               if (status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+               if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
                        uint64_t i;
-                       bt_notification_array_const notifs =
-                               (void *) iterator->base.notifs->pdata;
+                       bt_message_array_const msgs =
+                               (void *) iterator->base.msgs->pdata;
 
                        for (i = 0; i < *user_count; i++) {
-                               bt_object_put_ref(notifs[i]);
+                               bt_object_put_ref(msgs[i]);
                        }
                }
 
-               status = BT_NOTIFICATION_ITERATOR_STATUS_CANCELED;
+               status = BT_MESSAGE_ITERATOR_STATUS_CANCELED;
                goto end;
        }
 
        switch (status) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
-               BT_ASSERT_PRE(validate_notifications(iterator, *user_count),
-                       "Notifications are invalid at this point: "
-                       "%![notif-iter-]+i, count=%" PRIu64,
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
+               BT_ASSERT_PRE(validate_messages(iterator, *user_count),
+                       "Messages are invalid at this point: "
+                       "%![msg-iter-]+i, count=%" PRIu64,
                        iterator, *user_count);
-               *notifs = (void *) iterator->base.notifs->pdata;
+               *msgs = (void *) iterator->base.msgs->pdata;
                break;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
-               BT_ASSERT_PRE(self_comp_port_input_notif_iter_can_end(iterator),
-                       "Notification iterator cannot end at this point: "
+       case BT_MESSAGE_ITERATOR_STATUS_END:
+               BT_ASSERT_PRE(self_comp_port_input_msg_iter_can_end(iterator),
+                       "Message iterator cannot end at this point: "
                        "%!+i", iterator);
                BT_ASSERT(iterator->state ==
-                       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ACTIVE);
-               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_STATE_ENDED;
+                       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
+               iterator->state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED;
                BT_LOGD("Set new status: status=%s",
-                       bt_notification_iterator_status_string(status));
+                       bt_message_iterator_status_string(status));
                goto end;
        default:
                /* Unknown non-error status */
@@ -829,19 +829,19 @@ end:
        return status;
 }
 
-enum bt_notification_iterator_status
-bt_port_output_notification_iterator_next(
-               struct bt_port_output_notification_iterator *iterator,
-               bt_notification_array_const *notifs_to_user,
+enum bt_message_iterator_status
+bt_port_output_message_iterator_next(
+               struct bt_port_output_message_iterator *iterator,
+               bt_message_array_const *msgs_to_user,
                uint64_t *count_to_user)
 {
-       enum bt_notification_iterator_status status;
+       enum bt_message_iterator_status status;
        enum bt_graph_status graph_status;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(notifs_to_user, "Notification array (output)");
-       BT_ASSERT_PRE_NON_NULL(count_to_user, "Notification count (output)");
-       BT_LIB_LOGD("Getting next output port notification iterator's notifications: "
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(msgs_to_user, "Message array (output)");
+       BT_ASSERT_PRE_NON_NULL(count_to_user, "Message count (output)");
+       BT_LIB_LOGD("Getting next output port message iterator's messages: "
                "%!+i", iterator);
 
        graph_status = bt_graph_consume_sink_no_check(iterator->graph,
@@ -854,71 +854,71 @@ bt_port_output_notification_iterator_next(
                status = (int) graph_status;
                break;
        case BT_GRAPH_STATUS_OK:
-               status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+               status = BT_MESSAGE_ITERATOR_STATUS_OK;
 
                /*
-                * On success, the colander sink moves the notifications
+                * On success, the colander sink moves the messages
                 * to this iterator's array and sets this iterator's
-                * notification count: move them to the user.
+                * message count: move them to the user.
                 */
-               *notifs_to_user = (void *) iterator->base.notifs->pdata;
+               *msgs_to_user = (void *) iterator->base.msgs->pdata;
                *count_to_user = iterator->count;
                break;
        default:
                /* Other errors */
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
        }
 
        return status;
 }
 
-struct bt_component *bt_self_component_port_input_notification_iterator_borrow_component(
-               struct bt_self_component_port_input_notification_iterator *iterator)
+struct bt_component *bt_self_component_port_input_message_iterator_borrow_component(
+               struct bt_self_component_port_input_message_iterator *iterator)
 {
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        return iterator->upstream_component;
 }
 
-struct bt_self_component *bt_self_notification_iterator_borrow_component(
-               struct bt_self_notification_iterator *self_iterator)
+struct bt_self_component *bt_self_message_iterator_borrow_component(
+               struct bt_self_message_iterator *self_iterator)
 {
-       struct bt_self_component_port_input_notification_iterator *iterator =
+       struct bt_self_component_port_input_message_iterator *iterator =
                (void *) self_iterator;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        return (void *) iterator->upstream_component;
 }
 
-struct bt_self_port_output *bt_self_notification_iterator_borrow_port(
-               struct bt_self_notification_iterator *self_iterator)
+struct bt_self_port_output *bt_self_message_iterator_borrow_port(
+               struct bt_self_message_iterator *self_iterator)
 {
-       struct bt_self_component_port_input_notification_iterator *iterator =
+       struct bt_self_component_port_input_message_iterator *iterator =
                (void *) self_iterator;
 
-       BT_ASSERT_PRE_NON_NULL(iterator, "Notification iterator");
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        return (void *) iterator->upstream_port;
 }
 
 static
-void bt_port_output_notification_iterator_destroy(struct bt_object *obj)
+void bt_port_output_message_iterator_destroy(struct bt_object *obj)
 {
-       struct bt_port_output_notification_iterator *iterator = (void *) obj;
+       struct bt_port_output_message_iterator *iterator = (void *) obj;
 
-       BT_LIB_LOGD("Destroying output port notification iterator object: %!+i",
+       BT_LIB_LOGD("Destroying output port message iterator object: %!+i",
                iterator);
        BT_LOGD_STR("Putting graph.");
        BT_OBJECT_PUT_REF_AND_RESET(iterator->graph);
        BT_LOGD_STR("Putting colander sink component.");
        BT_OBJECT_PUT_REF_AND_RESET(iterator->colander);
-       destroy_base_notification_iterator(obj);
+       destroy_base_message_iterator(obj);
 }
 
-struct bt_port_output_notification_iterator *
-bt_port_output_notification_iterator_create(
+struct bt_port_output_message_iterator *
+bt_port_output_message_iterator_create(
                struct bt_graph *graph,
                const struct bt_port_output *output_port)
 {
-       struct bt_port_output_notification_iterator *iterator = NULL;
+       struct bt_port_output_message_iterator *iterator = NULL;
        struct bt_component_class_sink *colander_comp_cls = NULL;
        struct bt_component *output_port_comp = NULL;
        struct bt_component_sink *colander_comp;
@@ -938,20 +938,20 @@ bt_port_output_notification_iterator_create(
                "Output port is not part of graph: %![graph-]+g, %![port-]+p",
                graph, output_port);
 
-       /* Create notification iterator */
-       BT_LIB_LOGD("Creating notification iterator on output port: "
+       /* Create message iterator */
+       BT_LIB_LOGD("Creating message iterator on output port: "
                "%![port-]+p, %![comp-]+c", output_port, output_port_comp);
-       iterator = g_new0(struct bt_port_output_notification_iterator, 1);
+       iterator = g_new0(struct bt_port_output_message_iterator, 1);
        if (!iterator) {
-               BT_LOGE_STR("Failed to allocate one output port notification iterator.");
+               BT_LOGE_STR("Failed to allocate one output port message iterator.");
                goto error;
        }
 
-       ret = init_notification_iterator((void *) iterator,
-               BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT,
-               bt_port_output_notification_iterator_destroy);
+       ret = init_message_iterator((void *) iterator,
+               BT_MESSAGE_ITERATOR_TYPE_PORT_OUTPUT,
+               bt_port_output_message_iterator_destroy);
        if (ret) {
-               /* init_notification_iterator() logs errors */
+               /* init_message_iterator() logs errors */
                BT_OBJECT_PUT_REF_AND_RESET(iterator);
                goto end;
        }
@@ -965,7 +965,7 @@ bt_port_output_notification_iterator_create(
 
        iterator->graph = graph;
        bt_object_get_no_null_check(iterator->graph);
-       colander_data.notifs = (void *) iterator->base.notifs->pdata;
+       colander_data.msgs = (void *) iterator->base.msgs->pdata;
        colander_data.count_addr = &iterator->count;
 
        /* Hope that nobody uses this very unique name */
@@ -1001,10 +1001,10 @@ bt_port_output_notification_iterator_create(
 
        /*
         * At this point everything went fine. Make the graph
-        * nonconsumable forever so that only this notification iterator
+        * nonconsumable forever so that only this message iterator
         * can consume (thanks to bt_graph_consume_sink_no_check()).
-        * This avoids leaking the notification created by the colander
-        * sink and moved to the notification iterator's notification
+        * This avoids leaking the message created by the colander
+        * sink and moved to the message iterator's message
         * member.
         */
        bt_graph_set_can_consume(iterator->graph, false);
@@ -1041,26 +1041,26 @@ end:
        return (void *) iterator;
 }
 
-void bt_port_output_notification_iterator_get_ref(
-               const struct bt_port_output_notification_iterator *iterator)
+void bt_port_output_message_iterator_get_ref(
+               const struct bt_port_output_message_iterator *iterator)
 {
        bt_object_get_ref(iterator);
 }
 
-void bt_port_output_notification_iterator_put_ref(
-               const struct bt_port_output_notification_iterator *iterator)
+void bt_port_output_message_iterator_put_ref(
+               const struct bt_port_output_message_iterator *iterator)
 {
        bt_object_put_ref(iterator);
 }
 
-void bt_self_component_port_input_notification_iterator_get_ref(
-               const struct bt_self_component_port_input_notification_iterator *iterator)
+void bt_self_component_port_input_message_iterator_get_ref(
+               const struct bt_self_component_port_input_message_iterator *iterator)
 {
        bt_object_get_ref(iterator);
 }
 
-void bt_self_component_port_input_notification_iterator_put_ref(
-               const struct bt_self_component_port_input_notification_iterator *iterator)
+void bt_self_component_port_input_message_iterator_put_ref(
+               const struct bt_self_component_port_input_message_iterator *iterator)
 {
        bt_object_put_ref(iterator);
 }
diff --git a/lib/graph/message/Makefile.am b/lib/graph/message/Makefile.am
new file mode 100644 (file)
index 0000000..d111f5b
--- /dev/null
@@ -0,0 +1,8 @@
+noinst_LTLIBRARIES = libgraph-message.la
+
+libgraph_message_la_SOURCES = \
+       message.c \
+       packet.c \
+       event.c \
+       stream.c \
+       inactivity.c
diff --git a/lib/graph/message/discarded-events.c b/lib/graph/message/discarded-events.c
new file mode 100644 (file)
index 0000000..e594fe1
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/graph/message.h>
+#include <babeltrace/graph/message-discarded-events.h>
+#include <babeltrace/graph/message-discarded-elements-internal.h>
+#include <stdint.h>
+
+struct bt_clock_value *
+bt_message_discarded_events_borrow_begin_clock_value(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_begin_clock_value(
+               BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
+}
+
+struct bt_clock_value *
+bt_message_discarded_events_borrow_end_clock_value(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_end_clock_value(
+               BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
+}
+
+int64_t bt_message_discarded_events_get_count(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_get_count(
+               BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
+}
+
+struct bt_stream *bt_message_discarded_events_borrow_stream(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_stream(
+               BT_MESSAGE_TYPE_DISCARDED_EVENTS, message);
+}
diff --git a/lib/graph/message/discarded-packets.c b/lib/graph/message/discarded-packets.c
new file mode 100644 (file)
index 0000000..953ba04
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/graph/message.h>
+#include <babeltrace/graph/message-discarded-packets.h>
+#include <babeltrace/graph/message-discarded-elements-internal.h>
+#include <stdint.h>
+
+struct bt_clock_value *
+bt_message_discarded_packets_borrow_begin_clock_value(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_begin_clock_value(
+               BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
+}
+
+struct bt_clock_value *
+bt_message_discarded_packets_borrow_end_clock_value(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_end_clock_value(
+               BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
+}
+
+int64_t bt_message_discarded_packets_get_count(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_get_count(
+               BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
+}
+
+struct bt_stream *bt_message_discarded_packets_borrow_stream(
+               struct bt_message *message)
+{
+       return bt_message_discarded_elements_borrow_stream(
+               BT_MESSAGE_TYPE_DISCARDED_PACKETS, message);
+}
diff --git a/lib/graph/message/event.c b/lib/graph/message/event.c
new file mode 100644 (file)
index 0000000..b6517f8
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG-EVENT"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/trace-ir/event.h>
+#include <babeltrace/trace-ir/event-internal.h>
+#include <babeltrace/trace-ir/event-class-internal.h>
+#include <babeltrace/trace-ir/stream-class-internal.h>
+#include <babeltrace/trace-ir/trace.h>
+#include <babeltrace/graph/graph-internal.h>
+#include <babeltrace/graph/message-event-const.h>
+#include <babeltrace/graph/message-event.h>
+#include <babeltrace/graph/message-event-internal.h>
+#include <babeltrace/types.h>
+#include <stdbool.h>
+#include <inttypes.h>
+
+BT_ASSERT_PRE_FUNC
+static inline bool event_class_has_trace(struct bt_event_class *event_class)
+{
+       struct bt_stream_class *stream_class;
+
+       stream_class = bt_event_class_borrow_stream_class(event_class);
+       BT_ASSERT(stream_class);
+       return bt_stream_class_borrow_trace_class(stream_class) != NULL;
+}
+
+BT_HIDDEN
+struct bt_message *bt_message_event_new(
+               struct bt_graph *graph)
+{
+       struct bt_message_event *message = NULL;
+
+       message = g_new0(struct bt_message_event, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one event message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent, BT_MESSAGE_TYPE_EVENT,
+               (bt_object_release_func) bt_message_event_recycle, graph);
+       goto end;
+
+error:
+       BT_OBJECT_PUT_REF_AND_RESET(message);
+
+end:
+       return (void *) message;
+}
+
+struct bt_message *bt_message_event_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_event_class *event_class,
+               struct bt_packet *packet)
+{
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
+       struct bt_message_event *message = NULL;
+       struct bt_event *event;
+
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
+       BT_ASSERT_PRE(event_class_has_trace(event_class),
+               "Event class is not part of a trace: %!+E", event_class);
+       BT_LIB_LOGD("Creating event message object: %![ec-]+E",
+               event_class);
+       event = bt_event_create(event_class, packet);
+       if (unlikely(!event)) {
+               BT_LIB_LOGE("Cannot create event from event class: "
+                       "%![ec-]+E", event_class);
+               goto error;
+       }
+
+       /*
+        * Create message from pool _after_ we have everything
+        * (in this case, a valid event object) so that we never have an
+        * error condition with a non-NULL message object.
+        * Otherwise:
+        *
+        * * We cannot recycle the message on error because
+        *   bt_message_event_recycle() expects a complete
+        *   message (and the event or clock class priority map
+        *   object could be unset).
+        *
+        * * We cannot destroy the message because we would need
+        *   to notify the graph (pool owner) so that it removes the
+        *   message from its message array.
+        */
+       message = (void *) bt_message_create_from_pool(
+               &msg_iter->graph->event_msg_pool, msg_iter->graph);
+       if (unlikely(!message)) {
+               /* bt_message_create_from_pool() logs errors */
+               goto error;
+       }
+
+       BT_ASSERT(!message->event);
+       message->event = event;
+       bt_packet_set_is_frozen(packet, true);
+       bt_event_class_freeze(event_class);
+       BT_LIB_LOGD("Created event message object: "
+               "%![msg-]+n, %![event-]+e", message, event);
+       goto end;
+
+error:
+       BT_ASSERT(!message);
+       bt_event_destroy(event);
+
+end:
+       return (void *) message;
+}
+
+BT_HIDDEN
+void bt_message_event_destroy(struct bt_message *msg)
+{
+       struct bt_message_event *event_msg = (void *) msg;
+
+       BT_LIB_LOGD("Destroying event message: %!+n", msg);
+
+       if (event_msg->event) {
+               BT_LIB_LOGD("Recycling event: %!+e", event_msg->event);
+               bt_event_recycle(event_msg->event);
+               event_msg->event = NULL;
+       }
+
+       g_free(msg);
+}
+
+BT_HIDDEN
+void bt_message_event_recycle(struct bt_message *msg)
+{
+       struct bt_message_event *event_msg = (void *) msg;
+       struct bt_graph *graph;
+
+       BT_ASSERT(event_msg);
+
+       if (unlikely(!msg->graph)) {
+               bt_message_event_destroy(msg);
+               return;
+       }
+
+       BT_LIB_LOGD("Recycling event message: %![msg-]+n, %![event-]+e",
+               msg, event_msg->event);
+       bt_message_reset(msg);
+       BT_ASSERT(event_msg->event);
+       bt_event_recycle(event_msg->event);
+       event_msg->event = NULL;
+       graph = msg->graph;
+       msg->graph = NULL;
+       bt_object_pool_recycle_object(&graph->event_msg_pool, msg);
+}
+
+static inline
+struct bt_event *borrow_event(struct bt_message *message)
+{
+       struct bt_message_event *event_message;
+
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_EVENT);
+       event_message = container_of(message,
+                       struct bt_message_event, parent);
+       return event_message->event;
+}
+
+struct bt_event *bt_message_event_borrow_event(
+               struct bt_message *message)
+{
+       return borrow_event(message);
+}
+
+const struct bt_event *bt_message_event_borrow_event_const(
+               const struct bt_message *message)
+{
+       return borrow_event((void *) message);
+}
diff --git a/lib/graph/message/inactivity.c b/lib/graph/message/inactivity.c
new file mode 100644 (file)
index 0000000..0b7dff9
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG-INACTIVITY"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/clock-class.h>
+#include <babeltrace/trace-ir/clock-value-internal.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/message-inactivity-const.h>
+#include <babeltrace/graph/message-inactivity.h>
+#include <babeltrace/graph/message-inactivity-internal.h>
+
+static
+void bt_message_inactivity_destroy(struct bt_object *obj)
+{
+       struct bt_message_inactivity *message =
+                       (struct bt_message_inactivity *) obj;
+
+       BT_LIB_LOGD("Destroying inactivity message: %!+n", message);
+
+       if (message->default_cv) {
+               bt_clock_value_recycle(message->default_cv);
+       }
+
+       g_free(message);
+}
+
+struct bt_message *bt_message_inactivity_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_clock_class *default_clock_class)
+{
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
+       struct bt_message_inactivity *message;
+       struct bt_message *ret_msg = NULL;
+
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
+       BT_LIB_LOGD("Creating inactivity message object: "
+               "%![iter-]+i, %![default-cc-]+K", msg_iter,
+               default_clock_class);
+       message = g_new0(struct bt_message_inactivity, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one inactivity message.");
+               goto error;
+       }
+       bt_message_init(&message->parent,
+               BT_MESSAGE_TYPE_INACTIVITY,
+               bt_message_inactivity_destroy, NULL);
+       ret_msg = &message->parent;
+       message->default_cv = bt_clock_value_create(default_clock_class);
+       if (!message->default_cv) {
+               goto error;
+       }
+
+       BT_LIB_LOGD("Created inactivity message object: %!+n", ret_msg);
+       goto end;
+
+error:
+       BT_OBJECT_PUT_REF_AND_RESET(ret_msg);
+
+end:
+       return (void *) ret_msg;
+}
+
+void bt_message_inactivity_set_default_clock_value(
+               struct bt_message *msg, uint64_t value_cycles)
+{
+       struct bt_message_inactivity *inactivity = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
+       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+       bt_clock_value_set_value_inline(inactivity->default_cv, value_cycles);
+       BT_LIB_LOGV("Set inactivity message's default clock value: "
+               "%![msg-]+n, value=%" PRIu64, msg, value_cycles);
+}
+
+const struct bt_clock_value *
+bt_message_inactivity_borrow_default_clock_value_const(
+               const struct bt_message *msg)
+{
+       struct bt_message_inactivity *inactivity = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
+       return inactivity->default_cv;
+}
diff --git a/lib/graph/message/message.c b/lib/graph/message/message.c
new file mode 100644 (file)
index 0000000..64e8551
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/graph/message-const.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/graph-internal.h>
+
+BT_ASSERT_PRE_FUNC
+static inline void _init_seq_num(struct bt_message *message)
+{
+       message->seq_num = UINT64_C(-1);
+}
+
+#ifdef BT_DEV_MODE
+# define init_seq_num  _init_seq_num
+#else
+# define init_seq_num(_msg)
+#endif /* BT_DEV_MODE */
+
+BT_HIDDEN
+void bt_message_init(struct bt_message *message,
+               enum bt_message_type type,
+               bt_object_release_func release,
+               struct bt_graph *graph)
+{
+       BT_ASSERT(type >= 0 &&
+               type <= BT_MESSAGE_TYPE_PACKET_END);
+       message->type = type;
+       init_seq_num(message);
+       bt_object_init_shared(&message->base, release);
+       message->graph = graph;
+
+       if (graph) {
+               bt_graph_add_message(graph, message);
+       }
+}
+
+enum bt_message_type bt_message_get_type(
+               const struct bt_message *message)
+{
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       return message->type;
+}
+
+BT_HIDDEN
+void bt_message_unlink_graph(struct bt_message *msg)
+{
+       BT_ASSERT(msg);
+       msg->graph = NULL;
+}
+
+void bt_message_get_ref(const struct bt_message *message)
+{
+       bt_object_get_ref(message);
+}
+
+void bt_message_put_ref(const struct bt_message *message)
+{
+       bt_object_put_ref(message);
+}
diff --git a/lib/graph/message/packet.c b/lib/graph/message/packet.c
new file mode 100644 (file)
index 0000000..22894c9
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG-PACKET"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/packet.h>
+#include <babeltrace/trace-ir/packet-internal.h>
+#include <babeltrace/trace-ir/stream-class.h>
+#include <babeltrace/trace-ir/stream.h>
+#include <babeltrace/trace-ir/stream-internal.h>
+#include <babeltrace/graph/graph-internal.h>
+#include <babeltrace/graph/message-packet-const.h>
+#include <babeltrace/graph/message-packet.h>
+#include <babeltrace/graph/message-packet-internal.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object-internal.h>
+#include <inttypes.h>
+
+BT_HIDDEN
+struct bt_message *bt_message_packet_beginning_new(struct bt_graph *graph)
+{
+       struct bt_message_packet_beginning *message;
+
+       message = g_new0(struct bt_message_packet_beginning, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one packet beginning message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent,
+                       BT_MESSAGE_TYPE_PACKET_BEGINNING,
+                       (bt_object_release_func) bt_message_packet_beginning_recycle,
+                       graph);
+       goto end;
+
+error:
+       BT_OBJECT_PUT_REF_AND_RESET(message);
+
+end:
+       return (void *) message;
+}
+
+struct bt_message *bt_message_packet_beginning_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_packet *packet)
+{
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
+       struct bt_message_packet_beginning *message = NULL;
+       struct bt_stream *stream;
+       struct bt_stream_class *stream_class;
+
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
+       stream = bt_packet_borrow_stream(packet);
+       BT_ASSERT(stream);
+       stream_class = bt_stream_borrow_class(stream);
+       BT_ASSERT(stream_class);
+       BT_LIB_LOGD("Creating packet beginning message object: "
+               "%![packet-]+a, %![stream-]+s, %![sc-]+S",
+               packet, stream, stream_class);
+       message = (void *) bt_message_create_from_pool(
+               &msg_iter->graph->packet_begin_msg_pool, msg_iter->graph);
+       if (!message) {
+               /* bt_message_create_from_pool() logs errors */
+               goto end;
+       }
+
+       BT_ASSERT(!message->packet);
+       message->packet = packet;
+       bt_object_get_no_null_check_no_parent_check(
+               &message->packet->base);
+       bt_packet_set_is_frozen(packet, true);
+       BT_LIB_LOGD("Created packet beginning message object: "
+               "%![msg-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
+               message, packet, stream, stream_class);
+       goto end;
+
+end:
+       return (void *) message;
+}
+
+BT_HIDDEN
+void bt_message_packet_beginning_destroy(struct bt_message *msg)
+{
+       struct bt_message_packet_beginning *packet_begin_msg = (void *) msg;
+
+       BT_LIB_LOGD("Destroying packet beginning message: %!+n", msg);
+       BT_LIB_LOGD("Putting packet: %!+a", packet_begin_msg->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(packet_begin_msg->packet);
+       g_free(msg);
+}
+
+BT_HIDDEN
+void bt_message_packet_beginning_recycle(struct bt_message *msg)
+{
+       struct bt_message_packet_beginning *packet_begin_msg = (void *) msg;
+       struct bt_graph *graph;
+
+       BT_ASSERT(packet_begin_msg);
+
+       if (unlikely(!msg->graph)) {
+               bt_message_packet_beginning_destroy(msg);
+               return;
+       }
+
+       BT_LIB_LOGD("Recycling packet beginning message: %!+n", msg);
+       bt_message_reset(msg);
+       bt_object_put_no_null_check(&packet_begin_msg->packet->base);
+       packet_begin_msg->packet = NULL;
+       graph = msg->graph;
+       msg->graph = NULL;
+       bt_object_pool_recycle_object(&graph->packet_begin_msg_pool, msg);
+}
+
+struct bt_packet *bt_message_packet_beginning_borrow_packet(
+               struct bt_message *message)
+{
+       struct bt_message_packet_beginning *packet_begin;
+
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_PACKET_BEGINNING);
+       packet_begin = (void *) message;
+       return packet_begin->packet;
+}
+
+const struct bt_packet *bt_message_packet_beginning_borrow_packet_const(
+               const struct bt_message *message)
+{
+       return bt_message_packet_beginning_borrow_packet(
+               (void *) message);
+}
+
+BT_HIDDEN
+struct bt_message *bt_message_packet_end_new(struct bt_graph *graph)
+{
+       struct bt_message_packet_end *message;
+
+       message = g_new0(struct bt_message_packet_end, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one packet end message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent,
+                       BT_MESSAGE_TYPE_PACKET_END,
+                       (bt_object_release_func) bt_message_packet_end_recycle,
+                       graph);
+       goto end;
+
+error:
+       BT_OBJECT_PUT_REF_AND_RESET(message);
+
+end:
+       return (void *) message;
+}
+
+struct bt_message *bt_message_packet_end_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_packet *packet)
+{
+       struct bt_self_component_port_input_message_iterator *msg_iter =
+               (void *) self_msg_iter;
+       struct bt_message_packet_end *message = NULL;
+       struct bt_stream *stream;
+       struct bt_stream_class *stream_class;
+
+       BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
+       stream = bt_packet_borrow_stream(packet);
+       BT_ASSERT(stream);
+       stream_class = bt_stream_borrow_class(stream);
+       BT_ASSERT(stream_class);
+       BT_LIB_LOGD("Creating packet end message object: "
+               "%![packet-]+a, %![stream-]+s, %![sc-]+S",
+               packet, stream, stream_class);
+       message = (void *) bt_message_create_from_pool(
+               &msg_iter->graph->packet_end_msg_pool, msg_iter->graph);
+       if (!message) {
+               /* bt_message_create_from_pool() logs errors */
+               goto end;
+       }
+
+       BT_ASSERT(!message->packet);
+       message->packet = packet;
+       bt_object_get_no_null_check_no_parent_check(
+               &message->packet->base);
+       bt_packet_set_is_frozen(packet, true);
+       BT_LIB_LOGD("Created packet end message object: "
+               "%![msg-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
+               message, packet, stream, stream_class);
+       goto end;
+
+end:
+       return (void *) message;
+}
+
+BT_HIDDEN
+void bt_message_packet_end_destroy(struct bt_message *msg)
+{
+       struct bt_message_packet_end *packet_end_msg = (void *) msg;
+
+       BT_LIB_LOGD("Destroying packet end message: %!+n", msg);
+       BT_LIB_LOGD("Putting packet: %!+a", packet_end_msg->packet);
+       BT_OBJECT_PUT_REF_AND_RESET(packet_end_msg->packet);
+       g_free(msg);
+}
+
+BT_HIDDEN
+void bt_message_packet_end_recycle(struct bt_message *msg)
+{
+       struct bt_message_packet_end *packet_end_msg = (void *) msg;
+       struct bt_graph *graph;
+
+       BT_ASSERT(packet_end_msg);
+
+       if (!msg->graph) {
+               bt_message_packet_end_destroy(msg);
+               return;
+       }
+
+       BT_LIB_LOGD("Recycling packet end message: %!+n", msg);
+       bt_message_reset(msg);
+       BT_OBJECT_PUT_REF_AND_RESET(packet_end_msg->packet);
+       graph = msg->graph;
+       msg->graph = NULL;
+       bt_object_pool_recycle_object(&graph->packet_end_msg_pool, msg);
+}
+
+struct bt_packet *bt_message_packet_end_borrow_packet(
+               struct bt_message *message)
+{
+       struct bt_message_packet_end *packet_end;
+
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_PACKET_END);
+       packet_end = (void *) message;
+       return packet_end->packet;
+}
+
+const struct bt_packet *bt_message_packet_end_borrow_packet_const(
+               const struct bt_message *message)
+{
+       return bt_message_packet_end_borrow_packet(
+               (void *) message);
+}
diff --git a/lib/graph/message/stream.c b/lib/graph/message/stream.c
new file mode 100644 (file)
index 0000000..4603969
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "MSG-STREAM"
+#include <babeltrace/lib-logging-internal.h>
+
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/trace-ir/stream-internal.h>
+#include <babeltrace/trace-ir/stream-class.h>
+#include <babeltrace/trace-ir/stream-class-internal.h>
+#include <babeltrace/graph/message-stream.h>
+#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream-internal.h>
+#include <babeltrace/assert-internal.h>
+#include <inttypes.h>
+
+static
+void bt_message_stream_end_destroy(struct bt_object *obj)
+{
+       struct bt_message_stream_end *message =
+                       (struct bt_message_stream_end *) obj;
+
+       BT_LIB_LOGD("Destroying stream end message: %!+n",
+               message);
+       BT_LIB_LOGD("Putting stream: %!+s", message->stream);
+       BT_OBJECT_PUT_REF_AND_RESET(message->stream);
+
+       if (message->default_cv) {
+               bt_clock_value_recycle(message->default_cv);
+               message->default_cv = NULL;
+       }
+
+       g_free(message);
+}
+
+struct bt_message *bt_message_stream_end_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
+{
+       struct bt_message_stream_end *message;
+       struct bt_stream_class *stream_class;
+
+       BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+       stream_class = bt_stream_borrow_class(stream);
+       BT_ASSERT(stream_class);
+       BT_LIB_LOGD("Creating stream end message object: "
+               "%![stream-]+s, %![sc-]+S", stream, stream_class);
+       message = g_new0(struct bt_message_stream_end, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one stream end message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent,
+                       BT_MESSAGE_TYPE_STREAM_END,
+                       bt_message_stream_end_destroy, NULL);
+       message->stream = stream;
+       bt_object_get_no_null_check(message->stream);
+       BT_LIB_LOGD("Created stream end message object: "
+               "%![msg-]+n, %![stream-]+s, %![sc-]+S", message,
+               stream, stream_class);
+
+       return (void *) &message->parent;
+error:
+       return NULL;
+}
+
+struct bt_stream *bt_message_stream_end_borrow_stream(
+               struct bt_message *message)
+{
+       struct bt_message_stream_end *stream_end;
+
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_STREAM_END);
+       stream_end = (void *) message;
+       return stream_end->stream;
+}
+
+const struct bt_stream *bt_message_stream_end_borrow_stream_const(
+               const struct bt_message *message)
+{
+       return bt_message_stream_end_borrow_stream(
+               (void *) message);
+}
+
+void bt_message_stream_end_set_default_clock_value(
+               struct bt_message *msg, uint64_t value_cycles)
+{
+       struct bt_message_stream_end *se_msg = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END);
+       BT_ASSERT_PRE(se_msg->stream->class->default_clock_class,
+               "Message's stream class has no default clock class: "
+               "%![msg-]+n, %![sc-]+S", msg, se_msg->stream->class);
+
+       /* TODO: have the object already created */
+       se_msg->default_cv = bt_clock_value_create(
+               se_msg->stream->class->default_clock_class);
+       BT_ASSERT(se_msg->default_cv);
+       bt_clock_value_set_value_inline(se_msg->default_cv, value_cycles);
+       BT_LIB_LOGV("Set message's default clock value: %![msg-]+n, "
+               "value=%" PRIu64, value_cycles);
+}
+
+struct bt_clock_value *bt_message_stream_end_borrow_default_clock_value(
+               struct bt_message *msg)
+{
+       struct bt_message_stream_end *stream_end = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END);
+       return stream_end->default_cv;
+}
+
+static
+void bt_message_stream_beginning_destroy(struct bt_object *obj)
+{
+       struct bt_message_stream_beginning *message =
+                       (struct bt_message_stream_beginning *) obj;
+
+       BT_LIB_LOGD("Destroying stream beginning message: %!+n",
+               message);
+       BT_LIB_LOGD("Putting stream: %!+s", message->stream);
+       BT_OBJECT_PUT_REF_AND_RESET(message->stream);
+
+       if (message->default_cv) {
+               bt_clock_value_recycle(message->default_cv);
+               message->default_cv = NULL;
+       }
+
+       g_free(message);
+}
+
+struct bt_message *bt_message_stream_beginning_create(
+               struct bt_self_message_iterator *self_msg_iter,
+               struct bt_stream *stream)
+{
+       struct bt_message_stream_beginning *message;
+       struct bt_stream_class *stream_class;
+
+       BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
+       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+       stream_class = bt_stream_borrow_class(stream);
+       BT_ASSERT(stream_class);
+       BT_LIB_LOGD("Creating stream beginning message object: "
+               "%![stream-]+s, %![sc-]+S", stream, stream_class);
+       message = g_new0(struct bt_message_stream_beginning, 1);
+       if (!message) {
+               BT_LOGE_STR("Failed to allocate one stream beginning message.");
+               goto error;
+       }
+
+       bt_message_init(&message->parent,
+                       BT_MESSAGE_TYPE_STREAM_BEGINNING,
+                       bt_message_stream_beginning_destroy, NULL);
+       message->stream = stream;
+       bt_object_get_no_null_check(message->stream);
+       BT_LIB_LOGD("Created stream beginning message object: "
+               "%![msg-]+n, %![stream-]+s, %![sc-]+S", message,
+               stream, stream_class);
+       return (void *) &message->parent;
+error:
+       return NULL;
+}
+
+struct bt_stream *bt_message_stream_beginning_borrow_stream(
+               struct bt_message *message)
+{
+       struct bt_message_stream_beginning *stream_begin;
+
+       BT_ASSERT_PRE_NON_NULL(message, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(message,
+               BT_MESSAGE_TYPE_STREAM_BEGINNING);
+       stream_begin = (void *) message;
+       return stream_begin->stream;
+}
+
+const struct bt_stream *bt_message_stream_beginning_borrow_stream_const(
+               const struct bt_message *message)
+{
+       return bt_message_stream_beginning_borrow_stream(
+               (void *) message);
+}
+
+void bt_message_stream_beginning_set_default_clock_value(
+               struct bt_message *msg,
+               uint64_t value_cycles)
+{
+       struct bt_message_stream_beginning *sb_msg = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_BEGINNING);
+       BT_ASSERT_PRE(sb_msg->stream->class->default_clock_class,
+               "Message's stream class has no default clock class: "
+               "%![msg-]+n, %![sc-]+S", msg, sb_msg->stream->class);
+
+       /* TODO: have the object already created */
+       sb_msg->default_cv = bt_clock_value_create(
+               sb_msg->stream->class->default_clock_class);
+       BT_ASSERT(sb_msg->default_cv);
+       bt_clock_value_set_value_inline(sb_msg->default_cv, value_cycles);
+       BT_LIB_LOGV("Set message's default clock value: %![msg-]+n, "
+               "value=%" PRIu64, value_cycles);
+}
+
+struct bt_clock_value *bt_message_stream_beginning_borrow_default_clock_value(
+               struct bt_message *msg)
+{
+       struct bt_message_stream_beginning *stream_begin = (void *) msg;
+
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_BEGINNING);
+       return stream_begin->default_cv;
+}
diff --git a/lib/graph/notification/Makefile.am b/lib/graph/notification/Makefile.am
deleted file mode 100644 (file)
index dc253eb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-noinst_LTLIBRARIES = libgraph-notification.la
-
-libgraph_notification_la_SOURCES = \
-       notification.c \
-       packet.c \
-       event.c \
-       stream.c \
-       inactivity.c
diff --git a/lib/graph/notification/discarded-events.c b/lib/graph/notification/discarded-events.c
deleted file mode 100644 (file)
index e1dcbfa..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/graph/notification.h>
-#include <babeltrace/graph/notification-discarded-events.h>
-#include <babeltrace/graph/notification-discarded-elements-internal.h>
-#include <stdint.h>
-
-struct bt_clock_value *
-bt_notification_discarded_events_borrow_begin_clock_value(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_begin_clock_value(
-               BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification);
-}
-
-struct bt_clock_value *
-bt_notification_discarded_events_borrow_end_clock_value(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_end_clock_value(
-               BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification);
-}
-
-int64_t bt_notification_discarded_events_get_count(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_get_count(
-               BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification);
-}
-
-struct bt_stream *bt_notification_discarded_events_borrow_stream(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_stream(
-               BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification);
-}
diff --git a/lib/graph/notification/discarded-packets.c b/lib/graph/notification/discarded-packets.c
deleted file mode 100644 (file)
index 232164a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/graph/notification.h>
-#include <babeltrace/graph/notification-discarded-packets.h>
-#include <babeltrace/graph/notification-discarded-elements-internal.h>
-#include <stdint.h>
-
-struct bt_clock_value *
-bt_notification_discarded_packets_borrow_begin_clock_value(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_begin_clock_value(
-               BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification);
-}
-
-struct bt_clock_value *
-bt_notification_discarded_packets_borrow_end_clock_value(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_end_clock_value(
-               BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification);
-}
-
-int64_t bt_notification_discarded_packets_get_count(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_get_count(
-               BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification);
-}
-
-struct bt_stream *bt_notification_discarded_packets_borrow_stream(
-               struct bt_notification *notification)
-{
-       return bt_notification_discarded_elements_borrow_stream(
-               BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification);
-}
diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c
deleted file mode 100644 (file)
index 3321af2..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "NOTIF-EVENT"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/trace-ir/event.h>
-#include <babeltrace/trace-ir/event-internal.h>
-#include <babeltrace/trace-ir/event-class-internal.h>
-#include <babeltrace/trace-ir/stream-class-internal.h>
-#include <babeltrace/trace-ir/trace.h>
-#include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/notification-event-const.h>
-#include <babeltrace/graph/notification-event.h>
-#include <babeltrace/graph/notification-event-internal.h>
-#include <babeltrace/types.h>
-#include <stdbool.h>
-#include <inttypes.h>
-
-BT_ASSERT_PRE_FUNC
-static inline bool event_class_has_trace(struct bt_event_class *event_class)
-{
-       struct bt_stream_class *stream_class;
-
-       stream_class = bt_event_class_borrow_stream_class(event_class);
-       BT_ASSERT(stream_class);
-       return bt_stream_class_borrow_trace_class(stream_class) != NULL;
-}
-
-BT_HIDDEN
-struct bt_notification *bt_notification_event_new(
-               struct bt_graph *graph)
-{
-       struct bt_notification_event *notification = NULL;
-
-       notification = g_new0(struct bt_notification_event, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one event notification.");
-               goto error;
-       }
-
-       bt_notification_init(&notification->parent, BT_NOTIFICATION_TYPE_EVENT,
-               (bt_object_release_func) bt_notification_event_recycle, graph);
-       goto end;
-
-error:
-       BT_OBJECT_PUT_REF_AND_RESET(notification);
-
-end:
-       return (void *) notification;
-}
-
-struct bt_notification *bt_notification_event_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_event_class *event_class,
-               struct bt_packet *packet)
-{
-       struct bt_self_component_port_input_notification_iterator *notif_iter =
-               (void *) self_notif_iter;
-       struct bt_notification_event *notification = NULL;
-       struct bt_event *event;
-
-       BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
-       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
-       BT_ASSERT_PRE(event_class_has_trace(event_class),
-               "Event class is not part of a trace: %!+E", event_class);
-       BT_LIB_LOGD("Creating event notification object: %![ec-]+E",
-               event_class);
-       event = bt_event_create(event_class, packet);
-       if (unlikely(!event)) {
-               BT_LIB_LOGE("Cannot create event from event class: "
-                       "%![ec-]+E", event_class);
-               goto error;
-       }
-
-       /*
-        * Create notification from pool _after_ we have everything
-        * (in this case, a valid event object) so that we never have an
-        * error condition with a non-NULL notification object.
-        * Otherwise:
-        *
-        * * We cannot recycle the notification on error because
-        *   bt_notification_event_recycle() expects a complete
-        *   notification (and the event or clock class priority map
-        *   object could be unset).
-        *
-        * * We cannot destroy the notification because we would need
-        *   to notify the graph (pool owner) so that it removes the
-        *   notification from its notification array.
-        */
-       notification = (void *) bt_notification_create_from_pool(
-               &notif_iter->graph->event_notif_pool, notif_iter->graph);
-       if (unlikely(!notification)) {
-               /* bt_notification_create_from_pool() logs errors */
-               goto error;
-       }
-
-       BT_ASSERT(!notification->event);
-       notification->event = event;
-       bt_packet_set_is_frozen(packet, true);
-       bt_event_class_freeze(event_class);
-       BT_LIB_LOGD("Created event notification object: "
-               "%![notif-]+n, %![event-]+e", notification, event);
-       goto end;
-
-error:
-       BT_ASSERT(!notification);
-       bt_event_destroy(event);
-
-end:
-       return (void *) notification;
-}
-
-BT_HIDDEN
-void bt_notification_event_destroy(struct bt_notification *notif)
-{
-       struct bt_notification_event *event_notif = (void *) notif;
-
-       BT_LIB_LOGD("Destroying event notification: %!+n", notif);
-
-       if (event_notif->event) {
-               BT_LIB_LOGD("Recycling event: %!+e", event_notif->event);
-               bt_event_recycle(event_notif->event);
-               event_notif->event = NULL;
-       }
-
-       g_free(notif);
-}
-
-BT_HIDDEN
-void bt_notification_event_recycle(struct bt_notification *notif)
-{
-       struct bt_notification_event *event_notif = (void *) notif;
-       struct bt_graph *graph;
-
-       BT_ASSERT(event_notif);
-
-       if (unlikely(!notif->graph)) {
-               bt_notification_event_destroy(notif);
-               return;
-       }
-
-       BT_LIB_LOGD("Recycling event notification: %![notif-]+n, %![event-]+e",
-               notif, event_notif->event);
-       bt_notification_reset(notif);
-       BT_ASSERT(event_notif->event);
-       bt_event_recycle(event_notif->event);
-       event_notif->event = NULL;
-       graph = notif->graph;
-       notif->graph = NULL;
-       bt_object_pool_recycle_object(&graph->event_notif_pool, notif);
-}
-
-static inline
-struct bt_event *borrow_event(struct bt_notification *notification)
-{
-       struct bt_notification_event *event_notification;
-
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notification, BT_NOTIFICATION_TYPE_EVENT);
-       event_notification = container_of(notification,
-                       struct bt_notification_event, parent);
-       return event_notification->event;
-}
-
-struct bt_event *bt_notification_event_borrow_event(
-               struct bt_notification *notification)
-{
-       return borrow_event(notification);
-}
-
-const struct bt_event *bt_notification_event_borrow_event_const(
-               const struct bt_notification *notification)
-{
-       return borrow_event((void *) notification);
-}
diff --git a/lib/graph/notification/inactivity.c b/lib/graph/notification/inactivity.c
deleted file mode 100644 (file)
index 47d759d..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "NOTIF-INACTIVITY"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/clock-class.h>
-#include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/graph/notification-inactivity-const.h>
-#include <babeltrace/graph/notification-inactivity.h>
-#include <babeltrace/graph/notification-inactivity-internal.h>
-
-static
-void bt_notification_inactivity_destroy(struct bt_object *obj)
-{
-       struct bt_notification_inactivity *notification =
-                       (struct bt_notification_inactivity *) obj;
-
-       BT_LIB_LOGD("Destroying inactivity notification: %!+n", notification);
-
-       if (notification->default_cv) {
-               bt_clock_value_recycle(notification->default_cv);
-       }
-
-       g_free(notification);
-}
-
-struct bt_notification *bt_notification_inactivity_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_clock_class *default_clock_class)
-{
-       struct bt_self_component_port_input_notification_iterator *notif_iter =
-               (void *) self_notif_iter;
-       struct bt_notification_inactivity *notification;
-       struct bt_notification *ret_notif = NULL;
-
-       BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
-       BT_LIB_LOGD("Creating inactivity notification object: "
-               "%![iter-]+i, %![default-cc-]+K", notif_iter,
-               default_clock_class);
-       notification = g_new0(struct bt_notification_inactivity, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one inactivity notification.");
-               goto error;
-       }
-       bt_notification_init(&notification->parent,
-               BT_NOTIFICATION_TYPE_INACTIVITY,
-               bt_notification_inactivity_destroy, NULL);
-       ret_notif = &notification->parent;
-       notification->default_cv = bt_clock_value_create(default_clock_class);
-       if (!notification->default_cv) {
-               goto error;
-       }
-
-       BT_LIB_LOGD("Created inactivity notification object: %!+n", ret_notif);
-       goto end;
-
-error:
-       BT_OBJECT_PUT_REF_AND_RESET(ret_notif);
-
-end:
-       return (void *) ret_notif;
-}
-
-void bt_notification_inactivity_set_default_clock_value(
-               struct bt_notification *notif, uint64_t value_cycles)
-{
-       struct bt_notification_inactivity *inactivity = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_INACTIVITY);
-       BT_ASSERT_PRE_HOT(notif, "Notification", ": %!+n", notif);
-       bt_clock_value_set_value_inline(inactivity->default_cv, value_cycles);
-       BT_LIB_LOGV("Set inactivity notification's default clock value: "
-               "%![notif-]+n, value=%" PRIu64, notif, value_cycles);
-}
-
-const struct bt_clock_value *
-bt_notification_inactivity_borrow_default_clock_value_const(
-               const struct bt_notification *notif)
-{
-       struct bt_notification_inactivity *inactivity = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_INACTIVITY);
-       return inactivity->default_cv;
-}
diff --git a/lib/graph/notification/notification.c b/lib/graph/notification/notification.c
deleted file mode 100644 (file)
index 7a2d859..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "NOTIF"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/graph/notification-const.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/graph/graph-internal.h>
-
-BT_ASSERT_PRE_FUNC
-static inline void _init_seq_num(struct bt_notification *notification)
-{
-       notification->seq_num = UINT64_C(-1);
-}
-
-#ifdef BT_DEV_MODE
-# define init_seq_num  _init_seq_num
-#else
-# define init_seq_num(_notif)
-#endif /* BT_DEV_MODE */
-
-BT_HIDDEN
-void bt_notification_init(struct bt_notification *notification,
-               enum bt_notification_type type,
-               bt_object_release_func release,
-               struct bt_graph *graph)
-{
-       BT_ASSERT(type >= 0 &&
-               type <= BT_NOTIFICATION_TYPE_PACKET_END);
-       notification->type = type;
-       init_seq_num(notification);
-       bt_object_init_shared(&notification->base, release);
-       notification->graph = graph;
-
-       if (graph) {
-               bt_graph_add_notification(graph, notification);
-       }
-}
-
-enum bt_notification_type bt_notification_get_type(
-               const struct bt_notification *notification)
-{
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       return notification->type;
-}
-
-BT_HIDDEN
-void bt_notification_unlink_graph(struct bt_notification *notif)
-{
-       BT_ASSERT(notif);
-       notif->graph = NULL;
-}
-
-void bt_notification_get_ref(const struct bt_notification *notification)
-{
-       bt_object_get_ref(notification);
-}
-
-void bt_notification_put_ref(const struct bt_notification *notification)
-{
-       bt_object_put_ref(notification);
-}
diff --git a/lib/graph/notification/packet.c b/lib/graph/notification/packet.c
deleted file mode 100644 (file)
index f548f8c..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "NOTIF-PACKET"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/packet.h>
-#include <babeltrace/trace-ir/packet-internal.h>
-#include <babeltrace/trace-ir/stream-class.h>
-#include <babeltrace/trace-ir/stream.h>
-#include <babeltrace/trace-ir/stream-internal.h>
-#include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/notification-packet-const.h>
-#include <babeltrace/graph/notification-packet.h>
-#include <babeltrace/graph/notification-packet-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/object-internal.h>
-#include <inttypes.h>
-
-BT_HIDDEN
-struct bt_notification *bt_notification_packet_beginning_new(struct bt_graph *graph)
-{
-       struct bt_notification_packet_beginning *notification;
-
-       notification = g_new0(struct bt_notification_packet_beginning, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one packet beginning notification.");
-               goto error;
-       }
-
-       bt_notification_init(&notification->parent,
-                       BT_NOTIFICATION_TYPE_PACKET_BEGINNING,
-                       (bt_object_release_func) bt_notification_packet_beginning_recycle,
-                       graph);
-       goto end;
-
-error:
-       BT_OBJECT_PUT_REF_AND_RESET(notification);
-
-end:
-       return (void *) notification;
-}
-
-struct bt_notification *bt_notification_packet_beginning_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_packet *packet)
-{
-       struct bt_self_component_port_input_notification_iterator *notif_iter =
-               (void *) self_notif_iter;
-       struct bt_notification_packet_beginning *notification = NULL;
-       struct bt_stream *stream;
-       struct bt_stream_class *stream_class;
-
-       BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
-       stream = bt_packet_borrow_stream(packet);
-       BT_ASSERT(stream);
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating packet beginning notification object: "
-               "%![packet-]+a, %![stream-]+s, %![sc-]+S",
-               packet, stream, stream_class);
-       notification = (void *) bt_notification_create_from_pool(
-               &notif_iter->graph->packet_begin_notif_pool, notif_iter->graph);
-       if (!notification) {
-               /* bt_notification_create_from_pool() logs errors */
-               goto end;
-       }
-
-       BT_ASSERT(!notification->packet);
-       notification->packet = packet;
-       bt_object_get_no_null_check_no_parent_check(
-               &notification->packet->base);
-       bt_packet_set_is_frozen(packet, true);
-       BT_LIB_LOGD("Created packet beginning notification object: "
-               "%![notif-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
-               notification, packet, stream, stream_class);
-       goto end;
-
-end:
-       return (void *) notification;
-}
-
-BT_HIDDEN
-void bt_notification_packet_beginning_destroy(struct bt_notification *notif)
-{
-       struct bt_notification_packet_beginning *packet_begin_notif = (void *) notif;
-
-       BT_LIB_LOGD("Destroying packet beginning notification: %!+n", notif);
-       BT_LIB_LOGD("Putting packet: %!+a", packet_begin_notif->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_begin_notif->packet);
-       g_free(notif);
-}
-
-BT_HIDDEN
-void bt_notification_packet_beginning_recycle(struct bt_notification *notif)
-{
-       struct bt_notification_packet_beginning *packet_begin_notif = (void *) notif;
-       struct bt_graph *graph;
-
-       BT_ASSERT(packet_begin_notif);
-
-       if (unlikely(!notif->graph)) {
-               bt_notification_packet_beginning_destroy(notif);
-               return;
-       }
-
-       BT_LIB_LOGD("Recycling packet beginning notification: %!+n", notif);
-       bt_notification_reset(notif);
-       bt_object_put_no_null_check(&packet_begin_notif->packet->base);
-       packet_begin_notif->packet = NULL;
-       graph = notif->graph;
-       notif->graph = NULL;
-       bt_object_pool_recycle_object(&graph->packet_begin_notif_pool, notif);
-}
-
-struct bt_packet *bt_notification_packet_beginning_borrow_packet(
-               struct bt_notification *notification)
-{
-       struct bt_notification_packet_beginning *packet_begin;
-
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
-               BT_NOTIFICATION_TYPE_PACKET_BEGINNING);
-       packet_begin = (void *) notification;
-       return packet_begin->packet;
-}
-
-const struct bt_packet *bt_notification_packet_beginning_borrow_packet_const(
-               const struct bt_notification *notification)
-{
-       return bt_notification_packet_beginning_borrow_packet(
-               (void *) notification);
-}
-
-BT_HIDDEN
-struct bt_notification *bt_notification_packet_end_new(struct bt_graph *graph)
-{
-       struct bt_notification_packet_end *notification;
-
-       notification = g_new0(struct bt_notification_packet_end, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one packet end notification.");
-               goto error;
-       }
-
-       bt_notification_init(&notification->parent,
-                       BT_NOTIFICATION_TYPE_PACKET_END,
-                       (bt_object_release_func) bt_notification_packet_end_recycle,
-                       graph);
-       goto end;
-
-error:
-       BT_OBJECT_PUT_REF_AND_RESET(notification);
-
-end:
-       return (void *) notification;
-}
-
-struct bt_notification *bt_notification_packet_end_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_packet *packet)
-{
-       struct bt_self_component_port_input_notification_iterator *notif_iter =
-               (void *) self_notif_iter;
-       struct bt_notification_packet_end *notification = NULL;
-       struct bt_stream *stream;
-       struct bt_stream_class *stream_class;
-
-       BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(packet, "Packet");
-       stream = bt_packet_borrow_stream(packet);
-       BT_ASSERT(stream);
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating packet end notification object: "
-               "%![packet-]+a, %![stream-]+s, %![sc-]+S",
-               packet, stream, stream_class);
-       notification = (void *) bt_notification_create_from_pool(
-               &notif_iter->graph->packet_end_notif_pool, notif_iter->graph);
-       if (!notification) {
-               /* bt_notification_create_from_pool() logs errors */
-               goto end;
-       }
-
-       BT_ASSERT(!notification->packet);
-       notification->packet = packet;
-       bt_object_get_no_null_check_no_parent_check(
-               &notification->packet->base);
-       bt_packet_set_is_frozen(packet, true);
-       BT_LIB_LOGD("Created packet end notification object: "
-               "%![notif-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S",
-               notification, packet, stream, stream_class);
-       goto end;
-
-end:
-       return (void *) notification;
-}
-
-BT_HIDDEN
-void bt_notification_packet_end_destroy(struct bt_notification *notif)
-{
-       struct bt_notification_packet_end *packet_end_notif = (void *) notif;
-
-       BT_LIB_LOGD("Destroying packet end notification: %!+n", notif);
-       BT_LIB_LOGD("Putting packet: %!+a", packet_end_notif->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet);
-       g_free(notif);
-}
-
-BT_HIDDEN
-void bt_notification_packet_end_recycle(struct bt_notification *notif)
-{
-       struct bt_notification_packet_end *packet_end_notif = (void *) notif;
-       struct bt_graph *graph;
-
-       BT_ASSERT(packet_end_notif);
-
-       if (!notif->graph) {
-               bt_notification_packet_end_destroy(notif);
-               return;
-       }
-
-       BT_LIB_LOGD("Recycling packet end notification: %!+n", notif);
-       bt_notification_reset(notif);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet);
-       graph = notif->graph;
-       notif->graph = NULL;
-       bt_object_pool_recycle_object(&graph->packet_end_notif_pool, notif);
-}
-
-struct bt_packet *bt_notification_packet_end_borrow_packet(
-               struct bt_notification *notification)
-{
-       struct bt_notification_packet_end *packet_end;
-
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
-               BT_NOTIFICATION_TYPE_PACKET_END);
-       packet_end = (void *) notification;
-       return packet_end->packet;
-}
-
-const struct bt_packet *bt_notification_packet_end_borrow_packet_const(
-               const struct bt_notification *notification)
-{
-       return bt_notification_packet_end_borrow_packet(
-               (void *) notification);
-}
diff --git a/lib/graph/notification/stream.c b/lib/graph/notification/stream.c
deleted file mode 100644 (file)
index 61ff278..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "NOTIF-STREAM"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/stream-internal.h>
-#include <babeltrace/trace-ir/stream-class.h>
-#include <babeltrace/trace-ir/stream-class-internal.h>
-#include <babeltrace/graph/notification-stream.h>
-#include <babeltrace/graph/notification-stream-const.h>
-#include <babeltrace/graph/notification-stream-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <inttypes.h>
-
-static
-void bt_notification_stream_end_destroy(struct bt_object *obj)
-{
-       struct bt_notification_stream_end *notification =
-                       (struct bt_notification_stream_end *) obj;
-
-       BT_LIB_LOGD("Destroying stream end notification: %!+n",
-               notification);
-       BT_LIB_LOGD("Putting stream: %!+s", notification->stream);
-       BT_OBJECT_PUT_REF_AND_RESET(notification->stream);
-
-       if (notification->default_cv) {
-               bt_clock_value_recycle(notification->default_cv);
-               notification->default_cv = NULL;
-       }
-
-       g_free(notification);
-}
-
-struct bt_notification *bt_notification_stream_end_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_stream *stream)
-{
-       struct bt_notification_stream_end *notification;
-       struct bt_stream_class *stream_class;
-
-       BT_ASSERT_PRE_NON_NULL(self_notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating stream end notification object: "
-               "%![stream-]+s, %![sc-]+S", stream, stream_class);
-       notification = g_new0(struct bt_notification_stream_end, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one stream end notification.");
-               goto error;
-       }
-
-       bt_notification_init(&notification->parent,
-                       BT_NOTIFICATION_TYPE_STREAM_END,
-                       bt_notification_stream_end_destroy, NULL);
-       notification->stream = stream;
-       bt_object_get_no_null_check(notification->stream);
-       BT_LIB_LOGD("Created stream end notification object: "
-               "%![notif-]+n, %![stream-]+s, %![sc-]+S", notification,
-               stream, stream_class);
-
-       return (void *) &notification->parent;
-error:
-       return NULL;
-}
-
-struct bt_stream *bt_notification_stream_end_borrow_stream(
-               struct bt_notification *notification)
-{
-       struct bt_notification_stream_end *stream_end;
-
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
-               BT_NOTIFICATION_TYPE_STREAM_END);
-       stream_end = (void *) notification;
-       return stream_end->stream;
-}
-
-const struct bt_stream *bt_notification_stream_end_borrow_stream_const(
-               const struct bt_notification *notification)
-{
-       return bt_notification_stream_end_borrow_stream(
-               (void *) notification);
-}
-
-void bt_notification_stream_end_set_default_clock_value(
-               struct bt_notification *notif, uint64_t value_cycles)
-{
-       struct bt_notification_stream_end *se_notif = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_HOT(notif, "Notification", ": %!+n", notif);
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_STREAM_END);
-       BT_ASSERT_PRE(se_notif->stream->class->default_clock_class,
-               "Notification's stream class has no default clock class: "
-               "%![notif-]+n, %![sc-]+S", notif, se_notif->stream->class);
-
-       /* TODO: have the object already created */
-       se_notif->default_cv = bt_clock_value_create(
-               se_notif->stream->class->default_clock_class);
-       BT_ASSERT(se_notif->default_cv);
-       bt_clock_value_set_value_inline(se_notif->default_cv, value_cycles);
-       BT_LIB_LOGV("Set notification's default clock value: %![notif-]+n, "
-               "value=%" PRIu64, value_cycles);
-}
-
-struct bt_clock_value *bt_notification_stream_end_borrow_default_clock_value(
-               struct bt_notification *notif)
-{
-       struct bt_notification_stream_end *stream_end = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_STREAM_END);
-       return stream_end->default_cv;
-}
-
-static
-void bt_notification_stream_beginning_destroy(struct bt_object *obj)
-{
-       struct bt_notification_stream_beginning *notification =
-                       (struct bt_notification_stream_beginning *) obj;
-
-       BT_LIB_LOGD("Destroying stream beginning notification: %!+n",
-               notification);
-       BT_LIB_LOGD("Putting stream: %!+s", notification->stream);
-       BT_OBJECT_PUT_REF_AND_RESET(notification->stream);
-
-       if (notification->default_cv) {
-               bt_clock_value_recycle(notification->default_cv);
-               notification->default_cv = NULL;
-       }
-
-       g_free(notification);
-}
-
-struct bt_notification *bt_notification_stream_beginning_create(
-               struct bt_self_notification_iterator *self_notif_iter,
-               struct bt_stream *stream)
-{
-       struct bt_notification_stream_beginning *notification;
-       struct bt_stream_class *stream_class;
-
-       BT_ASSERT_PRE_NON_NULL(self_notif_iter, "Notification iterator");
-       BT_ASSERT_PRE_NON_NULL(stream, "Stream");
-       stream_class = bt_stream_borrow_class(stream);
-       BT_ASSERT(stream_class);
-       BT_LIB_LOGD("Creating stream beginning notification object: "
-               "%![stream-]+s, %![sc-]+S", stream, stream_class);
-       notification = g_new0(struct bt_notification_stream_beginning, 1);
-       if (!notification) {
-               BT_LOGE_STR("Failed to allocate one stream beginning notification.");
-               goto error;
-       }
-
-       bt_notification_init(&notification->parent,
-                       BT_NOTIFICATION_TYPE_STREAM_BEGINNING,
-                       bt_notification_stream_beginning_destroy, NULL);
-       notification->stream = stream;
-       bt_object_get_no_null_check(notification->stream);
-       BT_LIB_LOGD("Created stream beginning notification object: "
-               "%![notif-]+n, %![stream-]+s, %![sc-]+S", notification,
-               stream, stream_class);
-       return (void *) &notification->parent;
-error:
-       return NULL;
-}
-
-struct bt_stream *bt_notification_stream_beginning_borrow_stream(
-               struct bt_notification *notification)
-{
-       struct bt_notification_stream_beginning *stream_begin;
-
-       BT_ASSERT_PRE_NON_NULL(notification, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notification,
-               BT_NOTIFICATION_TYPE_STREAM_BEGINNING);
-       stream_begin = (void *) notification;
-       return stream_begin->stream;
-}
-
-const struct bt_stream *bt_notification_stream_beginning_borrow_stream_const(
-               const struct bt_notification *notification)
-{
-       return bt_notification_stream_beginning_borrow_stream(
-               (void *) notification);
-}
-
-void bt_notification_stream_beginning_set_default_clock_value(
-               struct bt_notification *notif,
-               uint64_t value_cycles)
-{
-       struct bt_notification_stream_beginning *sb_notif = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_HOT(notif, "Notification", ": %!+n", notif);
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_STREAM_BEGINNING);
-       BT_ASSERT_PRE(sb_notif->stream->class->default_clock_class,
-               "Notification's stream class has no default clock class: "
-               "%![notif-]+n, %![sc-]+S", notif, sb_notif->stream->class);
-
-       /* TODO: have the object already created */
-       sb_notif->default_cv = bt_clock_value_create(
-               sb_notif->stream->class->default_clock_class);
-       BT_ASSERT(sb_notif->default_cv);
-       bt_clock_value_set_value_inline(sb_notif->default_cv, value_cycles);
-       BT_LIB_LOGV("Set notification's default clock value: %![notif-]+n, "
-               "value=%" PRIu64, value_cycles);
-}
-
-struct bt_clock_value *bt_notification_stream_beginning_borrow_default_clock_value(
-               struct bt_notification *notif)
-{
-       struct bt_notification_stream_beginning *stream_begin = (void *) notif;
-
-       BT_ASSERT_PRE_NON_NULL(notif, "Notification");
-       BT_ASSERT_PRE_NOTIF_IS_TYPE(notif, BT_NOTIFICATION_TYPE_STREAM_BEGINNING);
-       return stream_begin->default_cv;
-}
index d3d709bb887a5c752e6de41a7d6fafcaee3f5ef2..d418310fbf89fe161808aac1ca7edfe99b103080 100644 (file)
 #include <babeltrace/graph/component-source-internal.h>
 #include <babeltrace/graph/connection-internal.h>
 #include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/notification-event-internal.h>
-#include <babeltrace/graph/notification-inactivity-internal.h>
-#include <babeltrace/graph/notification-internal.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
-#include <babeltrace/graph/notification-packet-internal.h>
-#include <babeltrace/graph/notification-stream-internal.h>
+#include <babeltrace/graph/message-event-internal.h>
+#include <babeltrace/graph/message-inactivity-internal.h>
+#include <babeltrace/graph/message-internal.h>
+#include <babeltrace/graph/message-iterator-internal.h>
+#include <babeltrace/graph/message-packet-internal.h>
+#include <babeltrace/graph/message-stream-internal.h>
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/plugin/plugin-so-internal.h>
@@ -900,78 +900,78 @@ static inline void format_value(char **buf_ch, bool extended,
        }
 }
 
-static inline void format_notification(char **buf_ch, bool extended,
-               const char *prefix, const struct bt_notification *notif)
+static inline void format_message(char **buf_ch, bool extended,
+               const char *prefix, const struct bt_message *msg)
 {
        char tmp_prefix[64];
 
        BUF_APPEND(", %stype=%s",
-               PRFIELD(bt_notification_type_string(notif->type)));
+               PRFIELD(bt_message_type_string(msg->type)));
 
        if (!extended) {
                return;
        }
 
        BUF_APPEND(", %sis-frozen=%d, %sgraph-addr=%p",
-               PRFIELD(notif->frozen), PRFIELD(notif->graph));
+               PRFIELD(msg->frozen), PRFIELD(msg->graph));
 
-       switch (notif->type) {
-       case BT_NOTIFICATION_TYPE_EVENT:
+       switch (msg->type) {
+       case BT_MESSAGE_TYPE_EVENT:
        {
-               const struct bt_notification_event *notif_event =
-                       (const void *) notif;
+               const struct bt_message_event *msg_event =
+                       (const void *) msg;
 
-               if (notif_event->event) {
+               if (msg_event->event) {
                        SET_TMP_PREFIX("event-");
-                       format_event(buf_ch, true, tmp_prefix, notif_event->event);
+                       format_event(buf_ch, true, tmp_prefix, msg_event->event);
                }
 
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
        {
-               const struct bt_notification_stream_beginning *notif_stream =
-                       (const void *) notif;
+               const struct bt_message_stream_beginning *msg_stream =
+                       (const void *) msg;
 
-               if (notif_stream->stream) {
+               if (msg_stream->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, notif_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
                }
 
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_END:
        {
-               const struct bt_notification_stream_end *notif_stream =
-                       (const void *) notif;
+               const struct bt_message_stream_end *msg_stream =
+                       (const void *) msg;
 
-               if (notif_stream->stream) {
+               if (msg_stream->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, notif_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
                }
 
                break;
        }
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
        {
-               const struct bt_notification_packet_beginning *notif_packet =
-                       (const void *) notif;
+               const struct bt_message_packet_beginning *msg_packet =
+                       (const void *) msg;
 
-               if (notif_packet->packet) {
+               if (msg_packet->packet) {
                        SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, notif_packet->packet);
+                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
                }
 
                break;
        }
-       case BT_NOTIFICATION_TYPE_PACKET_END:
+       case BT_MESSAGE_TYPE_PACKET_END:
        {
-               const struct bt_notification_packet_end *notif_packet =
-                       (const void *) notif;
+               const struct bt_message_packet_end *msg_packet =
+                       (const void *) msg;
 
-               if (notif_packet->packet) {
+               if (msg_packet->packet) {
                        SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, notif_packet->packet);
+                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
                }
 
                break;
@@ -1113,26 +1113,26 @@ static inline void format_graph(char **buf_ch, bool extended,
 
        SET_TMP_PREFIX("en-pool-");
        format_object_pool(buf_ch, extended, prefix,
-               &graph->event_notif_pool);
+               &graph->event_msg_pool);
        SET_TMP_PREFIX("pbn-pool-");
        format_object_pool(buf_ch, extended, prefix,
-               &graph->packet_begin_notif_pool);
+               &graph->packet_begin_msg_pool);
        SET_TMP_PREFIX("pen-pool-");
        format_object_pool(buf_ch, extended, prefix,
-               &graph->packet_end_notif_pool);
+               &graph->packet_end_msg_pool);
 }
 
-static inline void format_notification_iterator(char **buf_ch,
+static inline void format_message_iterator(char **buf_ch,
                bool extended, const char *prefix,
-               const struct bt_notification_iterator *iterator)
+               const struct bt_message_iterator *iterator)
 {
        const char *type;
        char tmp_prefix[64];
 
-       if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT) {
-               type = "BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT";
-       } else if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT) {
-               type = "BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT";
+       if (iterator->type == BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT) {
+               type = "BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT";
+       } else if (iterator->type == BT_MESSAGE_ITERATOR_TYPE_PORT_OUTPUT) {
+               type = "BT_MESSAGE_ITERATOR_TYPE_PORT_OUTPUT";
        } else {
                type = "(unknown)";
        }
@@ -1140,9 +1140,9 @@ static inline void format_notification_iterator(char **buf_ch,
        BUF_APPEND(", %stype=%s", PRFIELD(type));
 
        switch (iterator->type) {
-       case BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT:
+       case BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT:
        {
-               const struct bt_self_component_port_input_notification_iterator *
+               const struct bt_self_component_port_input_message_iterator *
                        port_in_iter = (const void *) iterator;
 
                if (port_in_iter->upstream_component) {
@@ -1164,9 +1164,9 @@ static inline void format_notification_iterator(char **buf_ch,
                }
                break;
        }
-       case BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT:
+       case BT_MESSAGE_ITERATOR_TYPE_PORT_OUTPUT:
        {
-               const struct bt_port_output_notification_iterator *port_out_iter =
+               const struct bt_port_output_message_iterator *port_out_iter =
                        (const void *) iterator;
 
                if (port_out_iter->graph) {
@@ -1338,10 +1338,10 @@ static inline void handle_conversion_specifier_bt(void *priv_data,
                format_value(buf_ch, extended, prefix, obj);
                break;
        case 'n':
-               format_notification(buf_ch, extended, prefix, obj);
+               format_message(buf_ch, extended, prefix, obj);
                break;
        case 'i':
-               format_notification_iterator(buf_ch, extended, prefix, obj);
+               format_message_iterator(buf_ch, extended, prefix, obj);
                break;
        case 'C':
                format_component_class(buf_ch, extended, prefix, obj);
index cf0b66f1086bb877d9e2cd4c76da77cdd1d86522..f785554d6b847e2c1f69197d7a67ffb969ae5b84 100644 (file)
@@ -291,8 +291,8 @@ enum bt_plugin_status bt_plugin_so_init(
                                bt_component_class_source_accept_output_port_connection_method accept_output_port_connection;
                                bt_component_class_source_output_port_connected_method output_port_connected;
                                bt_component_class_source_output_port_disconnected_method output_port_disconnected;
-                               bt_component_class_source_notification_iterator_init_method notif_iter_init;
-                               bt_component_class_source_notification_iterator_finalize_method notif_iter_finalize;
+                               bt_component_class_source_message_iterator_init_method msg_iter_init;
+                               bt_component_class_source_message_iterator_finalize_method msg_iter_finalize;
                        } source;
 
                        struct {
@@ -305,8 +305,8 @@ enum bt_plugin_status bt_plugin_so_init(
                                bt_component_class_filter_output_port_connected_method output_port_connected;
                                bt_component_class_filter_input_port_disconnected_method input_port_disconnected;
                                bt_component_class_filter_output_port_disconnected_method output_port_disconnected;
-                               bt_component_class_filter_notification_iterator_init_method notif_iter_init;
-                               bt_component_class_filter_notification_iterator_finalize_method notif_iter_finalize;
+                               bt_component_class_filter_message_iterator_init_method msg_iter_init;
+                               bt_component_class_filter_message_iterator_finalize_method msg_iter_finalize;
                        } filter;
 
                        struct {
@@ -613,29 +613,29 @@ enum bt_plugin_status bt_plugin_so_init(
                                        abort();
                                }
                                break;
-                       case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD:
+                       case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD:
                                switch (cc_type) {
                                case BT_COMPONENT_CLASS_TYPE_SOURCE:
-                                       cc_full_descr->methods.source.notif_iter_init =
-                                               cur_cc_descr_attr->value.source_notif_iter_init_method;
+                                       cc_full_descr->methods.source.msg_iter_init =
+                                               cur_cc_descr_attr->value.source_msg_iter_init_method;
                                        break;
                                case BT_COMPONENT_CLASS_TYPE_FILTER:
-                                       cc_full_descr->methods.filter.notif_iter_init =
-                                               cur_cc_descr_attr->value.filter_notif_iter_init_method;
+                                       cc_full_descr->methods.filter.msg_iter_init =
+                                               cur_cc_descr_attr->value.filter_msg_iter_init_method;
                                        break;
                                default:
                                        abort();
                                }
                                break;
-                       case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD:
+                       case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_FINALIZE_METHOD:
                                switch (cc_type) {
                                case BT_COMPONENT_CLASS_TYPE_SOURCE:
-                                       cc_full_descr->methods.source.notif_iter_finalize =
-                                               cur_cc_descr_attr->value.source_notif_iter_finalize_method;
+                                       cc_full_descr->methods.source.msg_iter_finalize =
+                                               cur_cc_descr_attr->value.source_msg_iter_finalize_method;
                                        break;
                                case BT_COMPONENT_CLASS_TYPE_FILTER:
-                                       cc_full_descr->methods.filter.notif_iter_finalize =
-                                               cur_cc_descr_attr->value.filter_notif_iter_finalize_method;
+                                       cc_full_descr->methods.filter.msg_iter_finalize =
+                                               cur_cc_descr_attr->value.filter_msg_iter_finalize_method;
                                        break;
                                default:
                                        abort();
@@ -711,14 +711,14 @@ enum bt_plugin_status bt_plugin_so_init(
                case BT_COMPONENT_CLASS_TYPE_SOURCE:
                        src_comp_class = bt_component_class_source_create(
                                cc_full_descr->descriptor->name,
-                               cc_full_descr->descriptor->methods.source.notif_iter_next);
+                               cc_full_descr->descriptor->methods.source.msg_iter_next);
                        comp_class = bt_component_class_source_as_component_class(
                                src_comp_class);
                        break;
                case BT_COMPONENT_CLASS_TYPE_FILTER:
                        flt_comp_class = bt_component_class_filter_create(
                                cc_full_descr->descriptor->name,
-                               cc_full_descr->descriptor->methods.source.notif_iter_next);
+                               cc_full_descr->descriptor->methods.source.msg_iter_next);
                        comp_class = bt_component_class_filter_as_component_class(
                                flt_comp_class);
                        break;
@@ -851,24 +851,24 @@ enum bt_plugin_status bt_plugin_so_init(
                                }
                        }
 
-                       if (cc_full_descr->methods.source.notif_iter_init) {
-                               ret = bt_component_class_source_set_notification_iterator_init_method(
+                       if (cc_full_descr->methods.source.msg_iter_init) {
+                               ret = bt_component_class_source_set_message_iterator_init_method(
                                        src_comp_class,
-                                       cc_full_descr->methods.source.notif_iter_init);
+                                       cc_full_descr->methods.source.msg_iter_init);
                                if (ret) {
-                                       BT_LOGE_STR("Cannot set source component class's notification iterator initialization method.");
+                                       BT_LOGE_STR("Cannot set source component class's message iterator initialization method.");
                                        status = BT_PLUGIN_STATUS_ERROR;
                                        BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
                                        goto end;
                                }
                        }
 
-                       if (cc_full_descr->methods.source.notif_iter_finalize) {
-                               ret = bt_component_class_source_set_notification_iterator_finalize_method(
+                       if (cc_full_descr->methods.source.msg_iter_finalize) {
+                               ret = bt_component_class_source_set_message_iterator_finalize_method(
                                        src_comp_class,
-                                       cc_full_descr->methods.source.notif_iter_finalize);
+                                       cc_full_descr->methods.source.msg_iter_finalize);
                                if (ret) {
-                                       BT_LOGE_STR("Cannot set source component class's notification iterator finalization method.");
+                                       BT_LOGE_STR("Cannot set source component class's message iterator finalization method.");
                                        status = BT_PLUGIN_STATUS_ERROR;
                                        BT_OBJECT_PUT_REF_AND_RESET(src_comp_class);
                                        goto end;
@@ -985,24 +985,24 @@ enum bt_plugin_status bt_plugin_so_init(
                                }
                        }
 
-                       if (cc_full_descr->methods.filter.notif_iter_init) {
-                               ret = bt_component_class_filter_set_notification_iterator_init_method(
+                       if (cc_full_descr->methods.filter.msg_iter_init) {
+                               ret = bt_component_class_filter_set_message_iterator_init_method(
                                        flt_comp_class,
-                                       cc_full_descr->methods.filter.notif_iter_init);
+                                       cc_full_descr->methods.filter.msg_iter_init);
                                if (ret) {
-                                       BT_LOGE_STR("Cannot set filter component class's notification iterator initialization method.");
+                                       BT_LOGE_STR("Cannot set filter component class's message iterator initialization method.");
                                        status = BT_PLUGIN_STATUS_ERROR;
                                        BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
                                        goto end;
                                }
                        }
 
-                       if (cc_full_descr->methods.filter.notif_iter_finalize) {
-                               ret = bt_component_class_filter_set_notification_iterator_finalize_method(
+                       if (cc_full_descr->methods.filter.msg_iter_finalize) {
+                               ret = bt_component_class_filter_set_message_iterator_finalize_method(
                                        flt_comp_class,
-                                       cc_full_descr->methods.filter.notif_iter_finalize);
+                                       cc_full_descr->methods.filter.msg_iter_finalize);
                                if (ret) {
-                                       BT_LOGE_STR("Cannot set filter component class's notification iterator finalization method.");
+                                       BT_LOGE_STR("Cannot set filter component class's message iterator finalization method.");
                                        status = BT_PLUGIN_STATUS_ERROR;
                                        BT_OBJECT_PUT_REF_AND_RESET(flt_comp_class);
                                        goto end;
index 5ac774940cb0f6cd79895645fd4d286f4c16c305..5b70fb4f163a96b6d5b099abc85e7ab8b904adba 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = metadata bfcr notif-iter utils
+SUBDIRS = metadata bfcr msg-iter utils
 
 noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-common.la
 libbabeltrace_plugin_ctf_common_la_SOURCES = print.h
@@ -6,5 +6,5 @@ libbabeltrace_plugin_ctf_common_la_LIBADD =             \
        $(builddir)/metadata/libctf-parser.la           \
        $(builddir)/metadata/libctf-ast.la              \
        $(builddir)/bfcr/libctf-bfcr.la                 \
-       $(builddir)/notif-iter/libctf-notif-iter.la     \
+       $(builddir)/msg-iter/libctf-msg-iter.la \
        $(builddir)/utils/libctf-utils.la
index 2ffbce5fbf2df445f6c4d588c0e44ab7569dd53d..466db57901d07db6297d851492a23f62716f21d7 100644 (file)
@@ -112,7 +112,7 @@ struct bt_bfcr_cbs {
         *     to class reader's user).
         *
         * Any member of this structure may be set to \c NULL, should
-        * a specific notification be not needed.
+        * a specific message be not needed.
         */
        struct {
                /**
index 8196e5c163e38591b74bf81a3202abe6626ff5f1..08c1e03b32d1ab103149cbeeda877916c947fb45 100644 (file)
@@ -4713,7 +4713,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node)
                /*
                 * Old versions of LTTng forgot to set its clock class
                 * as absolute, even if it is. This is important because
-                * it's a condition to be able to sort notifications
+                * it's a condition to be able to sort messages
                 * from different sources.
                 */
                bt_clock_class_set_is_absolute(clock, BT_TRUE);
diff --git a/plugins/ctf/common/msg-iter/Makefile.am b/plugins/ctf/common/msg-iter/Makefile.am
new file mode 100644 (file)
index 0000000..7c3c208
--- /dev/null
@@ -0,0 +1,7 @@
+noinst_LTLIBRARIES = libctf-msg-iter.la
+
+libctf_msg_iter_la_SOURCES = \
+       msg-iter.c \
+       msg-iter.h \
+       logging.c \
+       logging.h
diff --git a/plugins/ctf/common/msg-iter/logging.c b/plugins/ctf/common/msg-iter/logging.c
new file mode 100644 (file)
index 0000000..31005ba
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_OUTPUT_LEVEL ctf_msg_iter_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_INIT_LOG_LEVEL(ctf_msg_iter_log_level,
+       "BABELTRACE_PLUGIN_CTF_MSG_ITER_LOG_LEVEL");
diff --git a/plugins/ctf/common/msg-iter/logging.h b/plugins/ctf/common/msg-iter/logging.h
new file mode 100644 (file)
index 0000000..bd7614c
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef CTF_MSG_ITER_LOGGING_H
+#define CTF_MSG_ITER_LOGGING_H
+
+/*
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_OUTPUT_LEVEL ctf_msg_iter_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_LEVEL_EXTERN_SYMBOL(ctf_msg_iter_log_level);
+
+#endif /* CTF_MSG_ITER_LOGGING_H */
diff --git a/plugins/ctf/common/msg-iter/msg-iter.c b/plugins/ctf/common/msg-iter/msg-iter.c
new file mode 100644 (file)
index 0000000..4843f27
--- /dev/null
@@ -0,0 +1,2806 @@
+/*
+ * Babeltrace - CTF message iterator
+ *
+ * Copyright (c) 2015-2018 EfficiOS Inc. and Linux Foundation
+ * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_TAG "PLUGIN-CTF-MSG-ITER"
+#include "logging.h"
+
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <babeltrace/assert-internal.h>
+#include <string.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/common-internal.h>
+#include <glib.h>
+#include <stdlib.h>
+
+#include "msg-iter.h"
+#include "../bfcr/bfcr.h"
+
+struct bt_msg_iter;
+
+/* A visit stack entry */
+struct stack_entry {
+       /*
+        * Current base field, one of:
+        *
+        *   * string
+        *   * structure
+        *   * array
+        *   * sequence
+        *   * variant
+        *
+        * Field is borrowed.
+        */
+       bt_field *base;
+
+       /* Index of next field to set */
+       size_t index;
+};
+
+/* Visit stack */
+struct stack {
+       /* Entries (struct stack_entry) */
+       GArray *entries;
+
+       /* Number of active entries */
+       size_t size;
+};
+
+/* State */
+enum state {
+       STATE_INIT,
+       STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN,
+       STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
+       STATE_AFTER_TRACE_PACKET_HEADER,
+       STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN,
+       STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE,
+       STATE_AFTER_STREAM_PACKET_CONTEXT,
+       STATE_EMIT_MSG_NEW_STREAM,
+       STATE_EMIT_MSG_NEW_PACKET,
+       STATE_DSCOPE_EVENT_HEADER_BEGIN,
+       STATE_DSCOPE_EVENT_HEADER_CONTINUE,
+       STATE_AFTER_EVENT_HEADER,
+       STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN,
+       STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE,
+       STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN,
+       STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE,
+       STATE_DSCOPE_EVENT_PAYLOAD_BEGIN,
+       STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE,
+       STATE_EMIT_MSG_EVENT,
+       STATE_EMIT_MSG_END_OF_PACKET,
+       STATE_DONE,
+       STATE_SKIP_PACKET_PADDING,
+};
+
+/* CTF message iterator */
+struct bt_msg_iter {
+       /* Visit stack */
+       struct stack *stack;
+
+       /* Current message iterator to create messages (weak) */
+       bt_self_message_iterator *msg_iter;
+
+       /*
+        * Current dynamic scope field pointer.
+        *
+        * This is set by read_dscope_begin_state() and contains the
+        * value of one of the pointers in `dscopes` below.
+        */
+       bt_field *cur_dscope_field;
+
+       /*
+        * True if we're done filling a string field from a text
+        * array/sequence payload.
+        */
+       bool done_filling_string;
+
+       /* Trace and classes */
+       struct {
+               struct ctf_trace_class *tc;
+               struct ctf_stream_class *sc;
+               struct ctf_event_class *ec;
+       } meta;
+
+       /* Current packet header field wrapper (NULL if not created yet) */
+       bt_packet_header_field *packet_header_field;
+
+       /* Current packet header field wrapper (NULL if not created yet) */
+       bt_packet_context_field *packet_context_field;
+
+       /* Current event header field (NULL if not created yet) */
+       bt_event_header_field *event_header_field;
+
+       /* Current packet (NULL if not created yet) */
+       bt_packet *packet;
+
+       /* Current stream (NULL if not set yet) */
+       bt_stream *stream;
+
+       /* Current event (NULL if not created yet) */
+       bt_event *event;
+
+       /* Current event message (NULL if not created yet) */
+       bt_message *event_msg;
+
+       /* Database of current dynamic scopes */
+       struct {
+               bt_field *trace_packet_header;
+               bt_field *stream_packet_context;
+               bt_field *event_header;
+               bt_field *event_common_context;
+               bt_field *event_spec_context;
+               bt_field *event_payload;
+       } dscopes;
+
+       /* Current state */
+       enum state state;
+
+       /* Current medium buffer data */
+       struct {
+               /* Last address provided by medium */
+               const uint8_t *addr;
+
+               /* Buffer size provided by medium (bytes) */
+               size_t sz;
+
+               /* Offset within whole packet of addr (bits) */
+               size_t packet_offset;
+
+               /* Current position from addr (bits) */
+               size_t at;
+
+               /* Position of the last event header from addr (bits) */
+               size_t last_eh_at;
+       } buf;
+
+       /* Binary type reader */
+       struct bt_bfcr *bfcr;
+
+       /* Current medium data */
+       struct {
+               struct bt_msg_iter_medium_ops medops;
+               size_t max_request_sz;
+               void *data;
+       } medium;
+
+       /* Stream beginning was emitted */
+       bool stream_begin_emitted;
+
+       /* Current packet size (bits) (-1 if unknown) */
+       int64_t cur_exp_packet_total_size;
+
+       /* Current content size (bits) (-1 if unknown) */
+       int64_t cur_exp_packet_content_size;
+
+       /* Current stream class ID */
+       int64_t cur_stream_class_id;
+
+       /* Current event class ID */
+       int64_t cur_event_class_id;
+
+       /* Current data stream ID */
+       int64_t cur_data_stream_id;
+
+       /*
+        * Offset, in the underlying media, of the current packet's
+        * start (-1 if unknown).
+        */
+       off_t cur_packet_offset;
+
+       /* Default clock's current value */
+       uint64_t default_clock_val;
+
+       /* End of packet snapshots */
+       struct {
+               uint64_t discarded_events;
+               uint64_t packets;
+               uint64_t beginning_clock;
+               uint64_t end_clock;
+       } snapshots;
+
+       /* Stored values (for sequence lengths, variant tags) */
+       GArray *stored_values;
+};
+
+static inline
+const char *state_string(enum state state)
+{
+       switch (state) {
+       case STATE_INIT:
+               return "STATE_INIT";
+       case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
+               return "STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN";
+       case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
+               return "STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE";
+       case STATE_AFTER_TRACE_PACKET_HEADER:
+               return "STATE_AFTER_TRACE_PACKET_HEADER";
+       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
+               return "STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN";
+       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
+               return "STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE";
+       case STATE_AFTER_STREAM_PACKET_CONTEXT:
+               return "STATE_AFTER_STREAM_PACKET_CONTEXT";
+       case STATE_EMIT_MSG_NEW_PACKET:
+               return "STATE_EMIT_MSG_NEW_PACKET";
+       case STATE_EMIT_MSG_NEW_STREAM:
+               return "STATE_EMIT_MSG_NEW_STREAM";
+       case STATE_DSCOPE_EVENT_HEADER_BEGIN:
+               return "STATE_DSCOPE_EVENT_HEADER_BEGIN";
+       case STATE_DSCOPE_EVENT_HEADER_CONTINUE:
+               return "STATE_DSCOPE_EVENT_HEADER_CONTINUE";
+       case STATE_AFTER_EVENT_HEADER:
+               return "STATE_AFTER_EVENT_HEADER";
+       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN:
+               return "STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN";
+       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE:
+               return "STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE";
+       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN:
+               return "STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN";
+       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE:
+               return "STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE";
+       case STATE_DSCOPE_EVENT_PAYLOAD_BEGIN:
+               return "STATE_DSCOPE_EVENT_PAYLOAD_BEGIN";
+       case STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE:
+               return "STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE";
+       case STATE_EMIT_MSG_EVENT:
+               return "STATE_EMIT_MSG_EVENT";
+       case STATE_EMIT_MSG_END_OF_PACKET:
+               return "STATE_EMIT_MSG_END_OF_PACKET";
+       case STATE_DONE:
+               return "STATE_DONE";
+       case STATE_SKIP_PACKET_PADDING:
+               return "STATE_SKIP_PACKET_PADDING";
+       default:
+               return "(unknown)";
+       }
+}
+
+static
+int bt_msg_iter_switch_packet(struct bt_msg_iter *notit);
+
+static
+struct stack *stack_new(struct bt_msg_iter *notit)
+{
+       struct stack *stack = NULL;
+
+       stack = g_new0(struct stack, 1);
+       if (!stack) {
+               BT_LOGE_STR("Failed to allocate one stack.");
+               goto error;
+       }
+
+       stack->entries = g_array_new(FALSE, TRUE, sizeof(struct stack_entry));
+       if (!stack->entries) {
+               BT_LOGE_STR("Failed to allocate a GArray.");
+               goto error;
+       }
+
+       BT_LOGD("Created stack: notit-addr=%p, stack-addr=%p", notit, stack);
+       goto end;
+
+error:
+       g_free(stack);
+       stack = NULL;
+
+end:
+       return stack;
+}
+
+static
+void stack_destroy(struct stack *stack)
+{
+       BT_ASSERT(stack);
+       BT_LOGD("Destroying stack: addr=%p", stack);
+
+       if (stack->entries) {
+               g_array_free(stack->entries, TRUE);
+       }
+
+       g_free(stack);
+}
+
+static
+void stack_push(struct stack *stack, bt_field *base)
+{
+       struct stack_entry *entry;
+
+       BT_ASSERT(stack);
+       BT_ASSERT(base);
+       BT_LOGV("Pushing base field on stack: stack-addr=%p, "
+               "stack-size-before=%zu, stack-size-after=%zu",
+               stack, stack->size, stack->size + 1);
+
+       if (stack->entries->len == stack->size) {
+               g_array_set_size(stack->entries, stack->size + 1);
+       }
+
+       entry = &g_array_index(stack->entries, struct stack_entry, stack->size);
+       entry->base = base;
+       entry->index = 0;
+       stack->size++;
+}
+
+static inline
+unsigned int stack_size(struct stack *stack)
+{
+       BT_ASSERT(stack);
+       return stack->size;
+}
+
+static
+void stack_pop(struct stack *stack)
+{
+       BT_ASSERT(stack);
+       BT_ASSERT(stack_size(stack));
+       BT_LOGV("Popping from stack: "
+               "stack-addr=%p, stack-size-before=%zu, stack-size-after=%zu",
+               stack, stack->size, stack->size - 1);
+       stack->size--;
+}
+
+static inline
+struct stack_entry *stack_top(struct stack *stack)
+{
+       BT_ASSERT(stack);
+       BT_ASSERT(stack_size(stack));
+       return &g_array_index(stack->entries, struct stack_entry,
+               stack->size - 1);
+}
+
+static inline
+bool stack_empty(struct stack *stack)
+{
+       return stack_size(stack) == 0;
+}
+
+static
+void stack_clear(struct stack *stack)
+{
+       BT_ASSERT(stack);
+       stack->size = 0;
+}
+
+static inline
+enum bt_msg_iter_status msg_iter_status_from_m_status(
+               enum bt_msg_iter_medium_status m_status)
+{
+       /* They are the same */
+       return (int) m_status;
+}
+
+static inline
+size_t buf_size_bits(struct bt_msg_iter *notit)
+{
+       return notit->buf.sz * 8;
+}
+
+static inline
+size_t buf_available_bits(struct bt_msg_iter *notit)
+{
+       return buf_size_bits(notit) - notit->buf.at;
+}
+
+static inline
+size_t packet_at(struct bt_msg_iter *notit)
+{
+       return notit->buf.packet_offset + notit->buf.at;
+}
+
+static inline
+void buf_consume_bits(struct bt_msg_iter *notit, size_t incr)
+{
+       BT_LOGV("Advancing cursor: notit-addr=%p, cur-before=%zu, cur-after=%zu",
+               notit, notit->buf.at, notit->buf.at + incr);
+       notit->buf.at += incr;
+}
+
+static
+enum bt_msg_iter_status request_medium_bytes(
+               struct bt_msg_iter *notit)
+{
+       uint8_t *buffer_addr = NULL;
+       size_t buffer_sz = 0;
+       enum bt_msg_iter_medium_status m_status;
+
+       BT_LOGV("Calling user function (request bytes): notit-addr=%p, "
+               "request-size=%zu", notit, notit->medium.max_request_sz);
+       m_status = notit->medium.medops.request_bytes(
+               notit->medium.max_request_sz, &buffer_addr,
+               &buffer_sz, notit->medium.data);
+       BT_LOGV("User function returned: status=%s, buf-addr=%p, buf-size=%zu",
+               bt_msg_iter_medium_status_string(m_status),
+               buffer_addr, buffer_sz);
+       if (m_status == BT_MSG_ITER_MEDIUM_STATUS_OK) {
+               BT_ASSERT(buffer_sz != 0);
+
+               /* New packet offset is old one + old size (in bits) */
+               notit->buf.packet_offset += buf_size_bits(notit);
+
+               /* Restart at the beginning of the new medium buffer */
+               notit->buf.at = 0;
+               notit->buf.last_eh_at = SIZE_MAX;
+
+               /* New medium buffer size */
+               notit->buf.sz = buffer_sz;
+
+               /* New medium buffer address */
+               notit->buf.addr = buffer_addr;
+
+               BT_LOGV("User function returned new bytes: "
+                       "packet-offset=%zu, cur=%zu, size=%zu, addr=%p",
+                       notit->buf.packet_offset, notit->buf.at,
+                       notit->buf.sz, notit->buf.addr);
+               BT_LOGV_MEM(buffer_addr, buffer_sz, "Returned bytes at %p:",
+                       buffer_addr);
+       } else if (m_status == BT_MSG_ITER_MEDIUM_STATUS_EOF) {
+               /*
+                * User returned end of stream: validate that we're not
+                * in the middle of a packet header, packet context, or
+                * event.
+                */
+               if (notit->cur_exp_packet_total_size >= 0) {
+                       if (packet_at(notit) ==
+                                       notit->cur_exp_packet_total_size) {
+                               goto end;
+                       }
+               } else {
+                       if (packet_at(notit) == 0) {
+                               goto end;
+                       }
+
+                       if (notit->buf.last_eh_at != SIZE_MAX &&
+                                       notit->buf.at == notit->buf.last_eh_at) {
+                               goto end;
+                       }
+               }
+
+               /* All other states are invalid */
+               BT_LOGW("User function returned %s, but message iterator is in an unexpected state: "
+                       "state=%s, cur-packet-size=%" PRId64 ", cur=%zu, "
+                       "packet-cur=%zu, last-eh-at=%zu",
+                       bt_msg_iter_medium_status_string(m_status),
+                       state_string(notit->state),
+                       notit->cur_exp_packet_total_size,
+                       notit->buf.at, packet_at(notit),
+                       notit->buf.last_eh_at);
+               m_status = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+       } else if (m_status < 0) {
+               BT_LOGW("User function failed: status=%s",
+                       bt_msg_iter_medium_status_string(m_status));
+       }
+
+end:
+       return msg_iter_status_from_m_status(m_status);
+}
+
+static inline
+enum bt_msg_iter_status buf_ensure_available_bits(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       if (unlikely(buf_available_bits(notit) == 0)) {
+               /*
+                * This _cannot_ return BT_MSG_ITER_STATUS_OK
+                * _and_ no bits.
+                */
+               status = request_medium_bytes(notit);
+       }
+
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_dscope_begin_state(
+               struct bt_msg_iter *notit,
+               struct ctf_field_class *dscope_fc,
+               enum state done_state, enum state continue_state,
+               bt_field *dscope_field)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       enum bt_bfcr_status bfcr_status;
+       size_t consumed_bits;
+
+       notit->cur_dscope_field = dscope_field;
+       BT_LOGV("Starting BFCR: notit-addr=%p, bfcr-addr=%p, fc-addr=%p",
+               notit, notit->bfcr, dscope_fc);
+       consumed_bits = bt_bfcr_start(notit->bfcr, dscope_fc,
+               notit->buf.addr, notit->buf.at, packet_at(notit),
+               notit->buf.sz, &bfcr_status);
+       BT_LOGV("BFCR consumed bits: size=%zu", consumed_bits);
+
+       switch (bfcr_status) {
+       case BT_BFCR_STATUS_OK:
+               /* Field class was read completely */
+               BT_LOGV_STR("Field was completely decoded.");
+               notit->state = done_state;
+               break;
+       case BT_BFCR_STATUS_EOF:
+               BT_LOGV_STR("BFCR needs more data to decode field completely.");
+               notit->state = continue_state;
+               break;
+       default:
+               BT_LOGW("BFCR failed to start: notit-addr=%p, bfcr-addr=%p, "
+                       "status=%s", notit, notit->bfcr,
+                       bt_bfcr_status_string(bfcr_status));
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       /* Consume bits now since we know we're not in an error state */
+       buf_consume_bits(notit, consumed_bits);
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_dscope_continue_state(
+               struct bt_msg_iter *notit, enum state done_state)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       enum bt_bfcr_status bfcr_status;
+       size_t consumed_bits;
+
+       BT_LOGV("Continuing BFCR: notit-addr=%p, bfcr-addr=%p",
+               notit, notit->bfcr);
+
+       status = buf_ensure_available_bits(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               if (status < 0) {
+                       BT_LOGW("Cannot ensure that buffer has at least one byte: "
+                               "msg-addr=%p, status=%s",
+                               notit, bt_msg_iter_status_string(status));
+               } else {
+                       BT_LOGV("Cannot ensure that buffer has at least one byte: "
+                               "msg-addr=%p, status=%s",
+                               notit, bt_msg_iter_status_string(status));
+               }
+
+               goto end;
+       }
+
+       consumed_bits = bt_bfcr_continue(notit->bfcr, notit->buf.addr,
+               notit->buf.sz, &bfcr_status);
+       BT_LOGV("BFCR consumed bits: size=%zu", consumed_bits);
+
+       switch (bfcr_status) {
+       case BT_BFCR_STATUS_OK:
+               /* Type was read completely. */
+               BT_LOGV_STR("Field was completely decoded.");
+               notit->state = done_state;
+               break;
+       case BT_BFCR_STATUS_EOF:
+               /* Stay in this continue state. */
+               BT_LOGV_STR("BFCR needs more data to decode field completely.");
+               break;
+       default:
+               BT_LOGW("BFCR failed to continue: notit-addr=%p, bfcr-addr=%p, "
+                       "status=%s", notit, notit->bfcr,
+                       bt_bfcr_status_string(bfcr_status));
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       /* Consume bits now since we know we're not in an error state. */
+       buf_consume_bits(notit, consumed_bits);
+end:
+       return status;
+}
+
+static
+void release_event_dscopes(struct bt_msg_iter *notit)
+{
+       notit->dscopes.event_header = NULL;
+
+       if (notit->event_header_field) {
+               bt_event_header_field_release(notit->event_header_field);
+               notit->event_header_field = NULL;
+       }
+
+       notit->dscopes.event_common_context = NULL;
+       notit->dscopes.event_spec_context = NULL;
+       notit->dscopes.event_payload = NULL;
+}
+
+static
+void release_all_dscopes(struct bt_msg_iter *notit)
+{
+       notit->dscopes.trace_packet_header = NULL;
+
+       if (notit->packet_header_field) {
+               bt_packet_header_field_release(notit->packet_header_field);
+               notit->packet_header_field = NULL;
+       }
+
+       notit->dscopes.stream_packet_context = NULL;
+
+       if (notit->packet_context_field) {
+               bt_packet_context_field_release(notit->packet_context_field);
+               notit->packet_context_field = NULL;
+       }
+
+       release_event_dscopes(notit);
+}
+
+static
+enum bt_msg_iter_status read_packet_header_begin_state(
+               struct bt_msg_iter *notit)
+{
+       struct ctf_field_class *packet_header_fc = NULL;
+       enum bt_msg_iter_status ret = BT_MSG_ITER_STATUS_OK;
+
+       if (bt_msg_iter_switch_packet(notit)) {
+               BT_LOGW("Cannot switch packet: notit-addr=%p", notit);
+               ret = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       /* Packet header class is common to the whole trace class. */
+       packet_header_fc = notit->meta.tc->packet_header_fc;
+       if (!packet_header_fc) {
+               notit->state = STATE_AFTER_TRACE_PACKET_HEADER;
+               goto end;
+       }
+
+       BT_ASSERT(!notit->packet_header_field);
+
+       if (packet_header_fc->in_ir) {
+               /*
+                * Create free packet header field from trace class.
+                * This field is going to be moved to the packet once we
+                * create it. We cannot create the packet now because:
+                *
+                * 1. A packet is created from a stream.
+                * 2. A stream is created from a stream class.
+                * 3. We need the packet header field's content to know
+                *    the ID of the stream class to select.
+                */
+               notit->packet_header_field =
+                       bt_packet_header_field_create(
+                               notit->meta.tc->ir_tc);
+               if (!notit->packet_header_field) {
+                       BT_LOGE_STR("Cannot create packet header field wrapper from trace class.");
+                       ret = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               notit->dscopes.trace_packet_header =
+                       bt_packet_header_field_borrow_field(
+                               notit->packet_header_field);
+               BT_ASSERT(notit->dscopes.trace_packet_header);
+       }
+
+       notit->cur_stream_class_id = -1;
+       notit->cur_event_class_id = -1;
+       notit->cur_data_stream_id = -1;
+       BT_LOGV("Decoding packet header field:"
+               "notit-addr=%p, trace-class-addr=%p, fc-addr=%p",
+               notit, notit->meta.tc, packet_header_fc);
+       ret = read_dscope_begin_state(notit, packet_header_fc,
+               STATE_AFTER_TRACE_PACKET_HEADER,
+               STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
+               notit->dscopes.trace_packet_header);
+       if (ret < 0) {
+               BT_LOGW("Cannot decode packet header field: "
+                       "notit-addr=%p, trace-class-addr=%p, "
+                       "fc-addr=%p",
+                       notit, notit->meta.tc, packet_header_fc);
+       }
+
+end:
+       return ret;
+}
+
+static
+enum bt_msg_iter_status read_packet_header_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit,
+               STATE_AFTER_TRACE_PACKET_HEADER);
+}
+
+static inline
+enum bt_msg_iter_status set_current_stream_class(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_stream_class *new_stream_class = NULL;
+
+       if (notit->cur_stream_class_id == -1) {
+               /*
+                * No current stream class ID field, therefore only one
+                * stream class.
+                */
+               if (notit->meta.tc->stream_classes->len != 1) {
+                       BT_LOGW("Need exactly one stream class since there's "
+                               "no stream class ID field: "
+                               "notit-addr=%p", notit);
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               new_stream_class = notit->meta.tc->stream_classes->pdata[0];
+               notit->cur_stream_class_id = new_stream_class->id;
+       }
+
+       new_stream_class = ctf_trace_class_borrow_stream_class_by_id(
+               notit->meta.tc, notit->cur_stream_class_id);
+       if (!new_stream_class) {
+               BT_LOGW("No stream class with ID of stream class ID to use in trace class: "
+                       "notit-addr=%p, stream-class-id=%" PRIu64 ", "
+                       "trace-class-addr=%p",
+                       notit, notit->cur_stream_class_id, notit->meta.tc);
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       if (notit->meta.sc) {
+               if (new_stream_class != notit->meta.sc) {
+                       BT_LOGW("Two packets refer to two different stream classes within the same packet sequence: "
+                               "notit-addr=%p, prev-stream-class-addr=%p, "
+                               "prev-stream-class-id=%" PRId64 ", "
+                               "next-stream-class-addr=%p, "
+                               "next-stream-class-id=%" PRId64 ", "
+                               "trace-addr=%p",
+                               notit, notit->meta.sc,
+                               notit->meta.sc->id,
+                               new_stream_class,
+                               new_stream_class->id,
+                               notit->meta.tc);
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+       } else {
+               notit->meta.sc = new_stream_class;
+       }
+
+       BT_LOGV("Set current stream class: "
+               "notit-addr=%p, stream-class-addr=%p, "
+               "stream-class-id=%" PRId64,
+               notit, notit->meta.sc, notit->meta.sc->id);
+
+end:
+       return status;
+}
+
+static inline
+enum bt_msg_iter_status set_current_stream(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       bt_stream *stream = NULL;
+
+       BT_LOGV("Calling user function (get stream): notit-addr=%p, "
+               "stream-class-addr=%p, stream-class-id=%" PRId64,
+               notit, notit->meta.sc,
+               notit->meta.sc->id);
+       stream = notit->medium.medops.borrow_stream(
+               notit->meta.sc->ir_sc, notit->cur_data_stream_id,
+               notit->medium.data);
+       bt_stream_get_ref(stream);
+       BT_LOGV("User function returned: stream-addr=%p", stream);
+       if (!stream) {
+               BT_LOGW_STR("User function failed to return a stream object "
+                       "for the given stream class.");
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       if (notit->stream && stream != notit->stream) {
+               BT_LOGW("User function returned a different stream than the "
+                       "previous one for the same sequence of packets.");
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       BT_STREAM_MOVE_REF(notit->stream, stream);
+
+end:
+       bt_stream_put_ref(stream);
+       return status;
+}
+
+static inline
+enum bt_msg_iter_status set_current_packet(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       bt_packet *packet = NULL;
+
+       BT_LOGV("Creating packet for packet message: "
+               "notit-addr=%p", notit);
+       BT_LOGV("Creating packet from stream: "
+               "notit-addr=%p, stream-addr=%p, "
+               "stream-class-addr=%p, "
+               "stream-class-id=%" PRId64,
+               notit, notit->stream, notit->meta.sc,
+               notit->meta.sc->id);
+
+       /* Create packet */
+       BT_ASSERT(notit->stream);
+       packet = bt_packet_create(notit->stream);
+       if (!packet) {
+               BT_LOGE("Cannot create packet from stream: "
+                       "notit-addr=%p, stream-addr=%p, "
+                       "stream-class-addr=%p, "
+                       "stream-class-id=%" PRId64,
+                       notit, notit->stream, notit->meta.sc,
+                       notit->meta.sc->id);
+               goto error;
+       }
+
+       goto end;
+
+error:
+       BT_PACKET_PUT_REF_AND_RESET(packet);
+       status = BT_MSG_ITER_STATUS_ERROR;
+
+end:
+       BT_PACKET_MOVE_REF(notit->packet, packet);
+       return status;
+}
+
+static
+enum bt_msg_iter_status after_packet_header_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status;
+
+       status = set_current_stream_class(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       notit->state = STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN;
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_packet_context_begin_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_field_class *packet_context_fc;
+
+       BT_ASSERT(notit->meta.sc);
+       packet_context_fc = notit->meta.sc->packet_context_fc;
+       if (!packet_context_fc) {
+               BT_LOGV("No packet packet context field class in stream class: continuing: "
+                       "notit-addr=%p, stream-class-addr=%p, "
+                       "stream-class-id=%" PRId64,
+                       notit, notit->meta.sc,
+                       notit->meta.sc->id);
+               notit->state = STATE_AFTER_STREAM_PACKET_CONTEXT;
+               goto end;
+       }
+
+       BT_ASSERT(!notit->packet_context_field);
+
+       if (packet_context_fc->in_ir) {
+               /*
+                * Create free packet context field from stream class.
+                * This field is going to be moved to the packet once we
+                * create it. We cannot create the packet now because a
+                * packet is created from a stream, and this API must be
+                * able to return the packet header and context fields
+                * without creating a stream
+                * (bt_msg_iter_borrow_packet_header_context_fields()).
+                */
+               notit->packet_context_field =
+                       bt_packet_context_field_create(
+                               notit->meta.sc->ir_sc);
+               if (!notit->packet_context_field) {
+                       BT_LOGE_STR("Cannot create packet context field wrapper from stream class.");
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               notit->dscopes.stream_packet_context =
+                       bt_packet_context_field_borrow_field(
+                               notit->packet_context_field);
+               BT_ASSERT(notit->dscopes.stream_packet_context);
+       }
+
+       BT_LOGV("Decoding packet context field: "
+               "notit-addr=%p, stream-class-addr=%p, "
+               "stream-class-id=%" PRId64 ", fc-addr=%p",
+               notit, notit->meta.sc,
+               notit->meta.sc->id, packet_context_fc);
+       status = read_dscope_begin_state(notit, packet_context_fc,
+               STATE_AFTER_STREAM_PACKET_CONTEXT,
+               STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE,
+               notit->dscopes.stream_packet_context);
+       if (status < 0) {
+               BT_LOGW("Cannot decode packet context field: "
+                       "notit-addr=%p, stream-class-addr=%p, "
+                       "stream-class-id=%" PRId64 ", fc-addr=%p",
+                       notit, notit->meta.sc,
+                       notit->meta.sc->id,
+                       packet_context_fc);
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_packet_context_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit,
+                       STATE_AFTER_STREAM_PACKET_CONTEXT);
+}
+
+static
+enum bt_msg_iter_status set_current_packet_content_sizes(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       if (notit->cur_exp_packet_total_size == -1) {
+               if (notit->cur_exp_packet_content_size != -1) {
+                       BT_LOGW("Content size is set, but packet size is not: "
+                               "notit-addr=%p, packet-context-field-addr=%p, "
+                               "packet-size=%" PRId64 ", content-size=%" PRId64,
+                               notit, notit->dscopes.stream_packet_context,
+                               notit->cur_exp_packet_total_size,
+                               notit->cur_exp_packet_content_size);
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+       } else {
+               if (notit->cur_exp_packet_content_size == -1) {
+                       notit->cur_exp_packet_content_size =
+                               notit->cur_exp_packet_total_size;
+               }
+       }
+
+       if (notit->cur_exp_packet_content_size >
+                       notit->cur_exp_packet_total_size) {
+               BT_LOGW("Invalid packet or content size: "
+                       "content size is greater than packet size: "
+                       "notit-addr=%p, packet-context-field-addr=%p, "
+                       "packet-size=%" PRId64 ", content-size=%" PRId64,
+                       notit, notit->dscopes.stream_packet_context,
+                       notit->cur_exp_packet_total_size,
+                       notit->cur_exp_packet_content_size);
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       BT_LOGV("Set current packet and content sizes: "
+               "notit-addr=%p, packet-size=%" PRIu64 ", content-size=%" PRIu64,
+               notit, notit->cur_exp_packet_total_size,
+               notit->cur_exp_packet_content_size);
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status after_packet_context_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status;
+
+       status = set_current_packet_content_sizes(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       if (notit->stream_begin_emitted) {
+               notit->state = STATE_EMIT_MSG_NEW_PACKET;
+       } else {
+               notit->state = STATE_EMIT_MSG_NEW_STREAM;
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_header_begin_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_field_class *event_header_fc = NULL;
+
+       /* Reset the position of the last event header */
+       notit->buf.last_eh_at = notit->buf.at;
+       notit->cur_event_class_id = -1;
+
+       /* Check if we have some content left */
+       if (notit->cur_exp_packet_content_size >= 0) {
+               if (unlikely(packet_at(notit) ==
+                               notit->cur_exp_packet_content_size)) {
+                       /* No more events! */
+                       BT_LOGV("Reached end of packet: notit-addr=%p, "
+                               "cur=%zu", notit, packet_at(notit));
+                       notit->state = STATE_EMIT_MSG_END_OF_PACKET;
+                       goto end;
+               } else if (unlikely(packet_at(notit) >
+                               notit->cur_exp_packet_content_size)) {
+                       /* That's not supposed to happen */
+                       BT_LOGV("Before decoding event header field: cursor is passed the packet's content: "
+                               "notit-addr=%p, content-size=%" PRId64 ", "
+                               "cur=%zu", notit,
+                               notit->cur_exp_packet_content_size,
+                               packet_at(notit));
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+       } else {
+               /*
+                * "Infinite" content: we're done when the medium has
+                * nothing else for us.
+                */
+               status = buf_ensure_available_bits(notit);
+               if (status != BT_MSG_ITER_STATUS_OK) {
+                       /*
+                        * If this function returns
+                        * `BT_MSG_ITER_STATUS_EOF`:
+                        *
+                        * 1. bt_msg_iter_get_next_message()
+                        *    emits a "packet end" message. This
+                        *    resets the current packet. The state
+                        *    remains unchanged otherwise.
+                        * 2. This function is called again. It returns
+                        *    `BT_MSG_ITER_STATUS_EOF` again.
+                        * 3. bt_msg_iter_get_next_message()
+                        *    emits a "stream end" message because
+                        *    there's no current packet. It sets the
+                        *    current state to `STATE_DONE`.
+                        */
+                       goto end;
+               }
+       }
+
+       release_event_dscopes(notit);
+       BT_ASSERT(notit->meta.sc);
+       event_header_fc = notit->meta.sc->event_header_fc;
+       if (!event_header_fc) {
+               notit->state = STATE_AFTER_EVENT_HEADER;
+               goto end;
+       }
+
+       if (event_header_fc->in_ir) {
+               BT_ASSERT(!notit->event_header_field);
+               notit->event_header_field =
+                       bt_event_header_field_create(
+                               notit->meta.sc->ir_sc);
+               if (!notit->event_header_field) {
+                       BT_LOGE_STR("Cannot create event header field wrapper from trace class.");
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               notit->dscopes.event_header =
+                       bt_event_header_field_borrow_field(
+                               notit->event_header_field);
+               BT_ASSERT(notit->dscopes.event_header);
+       }
+
+       BT_LOGV("Decoding event header field: "
+               "notit-addr=%p, stream-class-addr=%p, "
+               "stream-class-id=%" PRId64 ", "
+               "fc-addr=%p",
+               notit, notit->meta.sc,
+               notit->meta.sc->id,
+               event_header_fc);
+       status = read_dscope_begin_state(notit, event_header_fc,
+               STATE_AFTER_EVENT_HEADER,
+               STATE_DSCOPE_EVENT_HEADER_CONTINUE,
+               notit->dscopes.event_header);
+       if (status < 0) {
+               BT_LOGW("Cannot decode event header field: "
+                       "notit-addr=%p, stream-class-addr=%p, "
+                       "stream-class-id=%" PRId64 ", fc-addr=%p",
+                       notit, notit->meta.sc,
+                       notit->meta.sc->id,
+                       event_header_fc);
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_header_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit,
+               STATE_AFTER_EVENT_HEADER);
+}
+
+static inline
+enum bt_msg_iter_status set_current_event_class(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       struct ctf_event_class *new_event_class = NULL;
+
+       if (notit->cur_event_class_id == -1) {
+               /*
+                * No current event class ID field, therefore only one
+                * event class.
+                */
+               if (notit->meta.sc->event_classes->len != 1) {
+                       BT_LOGW("Need exactly one event class since there's "
+                               "no event class ID field: "
+                               "notit-addr=%p", notit);
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               new_event_class = notit->meta.sc->event_classes->pdata[0];
+               notit->cur_event_class_id = new_event_class->id;
+       }
+
+       new_event_class = ctf_stream_class_borrow_event_class_by_id(
+               notit->meta.sc, notit->cur_event_class_id);
+       if (!new_event_class) {
+               BT_LOGW("No event class with ID of event class ID to use in stream class: "
+                       "notit-addr=%p, stream-class-id=%" PRIu64 ", "
+                       "event-class-id=%" PRIu64 ", "
+                       "trace-class-addr=%p",
+                       notit, notit->meta.sc->id, notit->cur_event_class_id,
+                       notit->meta.tc);
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       notit->meta.ec = new_event_class;
+       BT_LOGV("Set current event class: "
+               "notit-addr=%p, event-class-addr=%p, "
+               "event-class-id=%" PRId64 ", "
+               "event-class-name=\"%s\"",
+               notit, notit->meta.ec, notit->meta.ec->id,
+               notit->meta.ec->name->str);
+
+end:
+       return status;
+}
+
+static inline
+enum bt_msg_iter_status set_current_event_message(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       bt_message *msg = NULL;
+
+       BT_ASSERT(notit->meta.ec);
+       BT_ASSERT(notit->packet);
+       BT_LOGV("Creating event message from event class and packet: "
+               "notit-addr=%p, ec-addr=%p, ec-name=\"%s\", packet-addr=%p",
+               notit, notit->meta.ec,
+               notit->meta.ec->name->str,
+               notit->packet);
+       BT_ASSERT(notit->msg_iter);
+       msg = bt_message_event_create(notit->msg_iter,
+               notit->meta.ec->ir_ec, notit->packet);
+       if (!msg) {
+               BT_LOGE("Cannot create event message: "
+                       "notit-addr=%p, ec-addr=%p, ec-name=\"%s\", "
+                       "packet-addr=%p",
+                       notit, notit->meta.ec,
+                       notit->meta.ec->name->str,
+                       notit->packet);
+               goto error;
+       }
+
+       goto end;
+
+error:
+       BT_MESSAGE_PUT_REF_AND_RESET(msg);
+       status = BT_MSG_ITER_STATUS_ERROR;
+
+end:
+       BT_MESSAGE_MOVE_REF(notit->event_msg, msg);
+       return status;
+}
+
+static
+enum bt_msg_iter_status after_event_header_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status;
+
+       status = set_current_event_class(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       status = set_current_event_message(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       notit->event = bt_message_event_borrow_event(
+               notit->event_msg);
+       BT_ASSERT(notit->event);
+
+       if (notit->event_header_field) {
+               int ret;
+
+               BT_ASSERT(notit->event);
+               ret = bt_event_move_header_field(notit->event,
+                       notit->event_header_field);
+               if (ret) {
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               notit->event_header_field = NULL;
+
+               /*
+                * At this point notit->dscopes.event_header has
+                * the same value as the event header field within
+                * notit->event.
+                */
+               BT_ASSERT(bt_event_borrow_header_field(
+                       notit->event) == notit->dscopes.event_header);
+       }
+
+       notit->state = STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN;
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_common_context_begin_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_field_class *event_common_context_fc;
+
+       event_common_context_fc = notit->meta.sc->event_common_context_fc;
+       if (!event_common_context_fc) {
+               notit->state = STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN;
+               goto end;
+       }
+
+       if (event_common_context_fc->in_ir) {
+               BT_ASSERT(!notit->dscopes.event_common_context);
+               notit->dscopes.event_common_context =
+                       bt_event_borrow_common_context_field(
+                               notit->event);
+               BT_ASSERT(notit->dscopes.event_common_context);
+       }
+
+       BT_LOGV("Decoding event common context field: "
+               "notit-addr=%p, stream-class-addr=%p, "
+               "stream-class-id=%" PRId64 ", "
+               "fc-addr=%p",
+               notit, notit->meta.sc,
+               notit->meta.sc->id,
+               event_common_context_fc);
+       status = read_dscope_begin_state(notit, event_common_context_fc,
+               STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN,
+               STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE,
+               notit->dscopes.event_common_context);
+       if (status < 0) {
+               BT_LOGW("Cannot decode event common context field: "
+                       "notit-addr=%p, stream-class-addr=%p, "
+                       "stream-class-id=%" PRId64 ", fc-addr=%p",
+                       notit, notit->meta.sc,
+                       notit->meta.sc->id,
+                       event_common_context_fc);
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_common_context_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit,
+               STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN);
+}
+
+static
+enum bt_msg_iter_status read_event_spec_context_begin_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_field_class *event_spec_context_fc;
+
+       event_spec_context_fc = notit->meta.ec->spec_context_fc;
+       if (!event_spec_context_fc) {
+               notit->state = STATE_DSCOPE_EVENT_PAYLOAD_BEGIN;
+               goto end;
+       }
+
+       if (event_spec_context_fc->in_ir) {
+               BT_ASSERT(!notit->dscopes.event_spec_context);
+               notit->dscopes.event_spec_context =
+                       bt_event_borrow_specific_context_field(
+                               notit->event);
+               BT_ASSERT(notit->dscopes.event_spec_context);
+       }
+
+       BT_LOGV("Decoding event specific context field: "
+               "notit-addr=%p, event-class-addr=%p, "
+               "event-class-name=\"%s\", event-class-id=%" PRId64 ", "
+               "fc-addr=%p",
+               notit, notit->meta.ec,
+               notit->meta.ec->name->str,
+               notit->meta.ec->id,
+               event_spec_context_fc);
+       status = read_dscope_begin_state(notit, event_spec_context_fc,
+               STATE_DSCOPE_EVENT_PAYLOAD_BEGIN,
+               STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE,
+               notit->dscopes.event_spec_context);
+       if (status < 0) {
+               BT_LOGW("Cannot decode event specific context field: "
+                       "notit-addr=%p, event-class-addr=%p, "
+                       "event-class-name=\"%s\", "
+                       "event-class-id=%" PRId64 ", fc-addr=%p",
+                       notit, notit->meta.ec,
+                       notit->meta.ec->name->str,
+                       notit->meta.ec->id,
+                       event_spec_context_fc);
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_spec_context_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit,
+               STATE_DSCOPE_EVENT_PAYLOAD_BEGIN);
+}
+
+static
+enum bt_msg_iter_status read_event_payload_begin_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       struct ctf_field_class *event_payload_fc;
+
+       event_payload_fc = notit->meta.ec->payload_fc;
+       if (!event_payload_fc) {
+               notit->state = STATE_EMIT_MSG_EVENT;
+               goto end;
+       }
+
+       if (event_payload_fc->in_ir) {
+               BT_ASSERT(!notit->dscopes.event_payload);
+               notit->dscopes.event_payload =
+                       bt_event_borrow_payload_field(
+                               notit->event);
+               BT_ASSERT(notit->dscopes.event_payload);
+       }
+
+       BT_LOGV("Decoding event payload field: "
+               "notit-addr=%p, event-class-addr=%p, "
+               "event-class-name=\"%s\", event-class-id=%" PRId64 ", "
+               "fc-addr=%p",
+               notit, notit->meta.ec,
+               notit->meta.ec->name->str,
+               notit->meta.ec->id,
+               event_payload_fc);
+       status = read_dscope_begin_state(notit, event_payload_fc,
+               STATE_EMIT_MSG_EVENT,
+               STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE,
+               notit->dscopes.event_payload);
+       if (status < 0) {
+               BT_LOGW("Cannot decode event payload field: "
+                       "notit-addr=%p, event-class-addr=%p, "
+                       "event-class-name=\"%s\", "
+                       "event-class-id=%" PRId64 ", fc-addr=%p",
+                       notit, notit->meta.ec,
+                       notit->meta.ec->name->str,
+                       notit->meta.ec->id,
+                       event_payload_fc);
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_event_payload_continue_state(
+               struct bt_msg_iter *notit)
+{
+       return read_dscope_continue_state(notit, STATE_EMIT_MSG_EVENT);
+}
+
+static
+enum bt_msg_iter_status skip_packet_padding_state(
+               struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       size_t bits_to_skip;
+
+       BT_ASSERT(notit->cur_exp_packet_total_size > 0);
+       bits_to_skip = notit->cur_exp_packet_total_size - packet_at(notit);
+       if (bits_to_skip == 0) {
+               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+               goto end;
+       } else {
+               size_t bits_to_consume;
+
+               BT_LOGV("Trying to skip %zu bits of padding: notit-addr=%p, size=%zu",
+                       bits_to_skip, notit, bits_to_skip);
+               status = buf_ensure_available_bits(notit);
+               if (status != BT_MSG_ITER_STATUS_OK) {
+                       goto end;
+               }
+
+               bits_to_consume = MIN(buf_available_bits(notit), bits_to_skip);
+               BT_LOGV("Skipping %zu bits of padding: notit-addr=%p, size=%zu",
+                       bits_to_consume, notit, bits_to_consume);
+               buf_consume_bits(notit, bits_to_consume);
+               bits_to_skip = notit->cur_exp_packet_total_size -
+                       packet_at(notit);
+               if (bits_to_skip == 0) {
+                       notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+                       goto end;
+               }
+       }
+
+end:
+       return status;
+}
+
+static inline
+enum bt_msg_iter_status handle_state(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+       const enum state state = notit->state;
+
+       BT_LOGV("Handling state: notit-addr=%p, state=%s",
+               notit, state_string(state));
+
+       // TODO: optimalize!
+       switch (state) {
+       case STATE_INIT:
+               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+               break;
+       case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
+               status = read_packet_header_begin_state(notit);
+               break;
+       case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
+               status = read_packet_header_continue_state(notit);
+               break;
+       case STATE_AFTER_TRACE_PACKET_HEADER:
+               status = after_packet_header_state(notit);
+               break;
+       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
+               status = read_packet_context_begin_state(notit);
+               break;
+       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
+               status = read_packet_context_continue_state(notit);
+               break;
+       case STATE_AFTER_STREAM_PACKET_CONTEXT:
+               status = after_packet_context_state(notit);
+               break;
+       case STATE_EMIT_MSG_NEW_STREAM:
+               notit->state = STATE_EMIT_MSG_NEW_PACKET;
+               break;
+       case STATE_EMIT_MSG_NEW_PACKET:
+               notit->state = STATE_DSCOPE_EVENT_HEADER_BEGIN;
+               break;
+       case STATE_DSCOPE_EVENT_HEADER_BEGIN:
+               status = read_event_header_begin_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_HEADER_CONTINUE:
+               status = read_event_header_continue_state(notit);
+               break;
+       case STATE_AFTER_EVENT_HEADER:
+               status = after_event_header_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN:
+               status = read_event_common_context_begin_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE:
+               status = read_event_common_context_continue_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN:
+               status = read_event_spec_context_begin_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE:
+               status = read_event_spec_context_continue_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_PAYLOAD_BEGIN:
+               status = read_event_payload_begin_state(notit);
+               break;
+       case STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE:
+               status = read_event_payload_continue_state(notit);
+               break;
+       case STATE_EMIT_MSG_EVENT:
+               notit->state = STATE_DSCOPE_EVENT_HEADER_BEGIN;
+               break;
+       case STATE_SKIP_PACKET_PADDING:
+               status = skip_packet_padding_state(notit);
+               break;
+       case STATE_EMIT_MSG_END_OF_PACKET:
+               notit->state = STATE_SKIP_PACKET_PADDING;
+               break;
+       default:
+               BT_LOGD("Unknown CTF plugin message iterator state: "
+                       "notit-addr=%p, state=%d", notit, notit->state);
+               abort();
+       }
+
+       BT_LOGV("Handled state: notit-addr=%p, status=%s, "
+               "prev-state=%s, cur-state=%s",
+               notit, bt_msg_iter_status_string(status),
+               state_string(state), state_string(notit->state));
+       return status;
+}
+
+/**
+ * Resets the internal state of a CTF message iterator.
+ */
+BT_HIDDEN
+void bt_msg_iter_reset(struct bt_msg_iter *notit)
+{
+       BT_ASSERT(notit);
+       BT_LOGD("Resetting message iterator: addr=%p", notit);
+       stack_clear(notit->stack);
+       notit->meta.sc = NULL;
+       notit->meta.ec = NULL;
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
+       BT_MESSAGE_PUT_REF_AND_RESET(notit->event_msg);
+       release_all_dscopes(notit);
+       notit->cur_dscope_field = NULL;
+
+       if (notit->packet_header_field) {
+               bt_packet_header_field_release(notit->packet_header_field);
+               notit->packet_header_field = NULL;
+       }
+
+       if (notit->packet_context_field) {
+               bt_packet_context_field_release(notit->packet_context_field);
+               notit->packet_context_field = NULL;
+       }
+
+       if (notit->event_header_field) {
+               bt_event_header_field_release(notit->event_header_field);
+               notit->event_header_field = NULL;
+       }
+
+       notit->buf.addr = NULL;
+       notit->buf.sz = 0;
+       notit->buf.at = 0;
+       notit->buf.last_eh_at = SIZE_MAX;
+       notit->buf.packet_offset = 0;
+       notit->state = STATE_INIT;
+       notit->cur_exp_packet_content_size = -1;
+       notit->cur_exp_packet_total_size = -1;
+       notit->cur_packet_offset = -1;
+       notit->cur_stream_class_id = -1;
+       notit->cur_event_class_id = -1;
+       notit->cur_data_stream_id = -1;
+       notit->stream_begin_emitted = false;
+}
+
+static
+int bt_msg_iter_switch_packet(struct bt_msg_iter *notit)
+{
+       int ret = 0;
+
+       /*
+        * We don't put the stream class here because we need to make
+        * sure that all the packets processed by the same message
+        * iterator refer to the same stream class (the first one).
+        */
+       BT_ASSERT(notit);
+
+       if (notit->cur_exp_packet_total_size != -1) {
+               notit->cur_packet_offset += notit->cur_exp_packet_total_size;
+       }
+
+       BT_LOGV("Switching packet: notit-addr=%p, cur=%zu, "
+               "packet-offset=%" PRId64, notit, notit->buf.at,
+               notit->cur_packet_offset);
+       stack_clear(notit->stack);
+       notit->meta.ec = NULL;
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_MESSAGE_PUT_REF_AND_RESET(notit->event_msg);
+       release_all_dscopes(notit);
+       notit->cur_dscope_field = NULL;
+
+       /*
+        * Adjust current buffer so that addr points to the beginning of the new
+        * packet.
+        */
+       if (notit->buf.addr) {
+               size_t consumed_bytes = (size_t) (notit->buf.at / CHAR_BIT);
+
+               /* Packets are assumed to start on a byte frontier. */
+               if (notit->buf.at % CHAR_BIT) {
+                       BT_LOGW("Cannot switch packet: current position is not a multiple of 8: "
+                               "notit-addr=%p, cur=%zu", notit, notit->buf.at);
+                       ret = -1;
+                       goto end;
+               }
+
+               notit->buf.addr += consumed_bytes;
+               notit->buf.sz -= consumed_bytes;
+               notit->buf.at = 0;
+               notit->buf.packet_offset = 0;
+               BT_LOGV("Adjusted buffer: addr=%p, size=%zu",
+                       notit->buf.addr, notit->buf.sz);
+       }
+
+       notit->cur_exp_packet_content_size = -1;
+       notit->cur_exp_packet_total_size = -1;
+       notit->cur_stream_class_id = -1;
+       notit->cur_event_class_id = -1;
+       notit->cur_data_stream_id = -1;
+       notit->snapshots.discarded_events = UINT64_C(-1);
+       notit->snapshots.packets = UINT64_C(-1);
+       notit->snapshots.beginning_clock = UINT64_C(-1);
+       notit->snapshots.end_clock = UINT64_C(-1);
+
+end:
+       return ret;
+}
+
+static
+bt_field *borrow_next_field(struct bt_msg_iter *notit)
+{
+       bt_field *next_field = NULL;
+       bt_field *base_field;
+       const bt_field_class *base_fc;
+       size_t index;
+
+       BT_ASSERT(!stack_empty(notit->stack));
+       index = stack_top(notit->stack)->index;
+       base_field = stack_top(notit->stack)->base;
+       BT_ASSERT(base_field);
+       base_fc = bt_field_borrow_class_const(base_field);
+       BT_ASSERT(base_fc);
+
+       switch (bt_field_class_get_type(base_fc)) {
+       case BT_FIELD_CLASS_TYPE_STRUCTURE:
+       {
+               BT_ASSERT(index <
+                       bt_field_class_structure_get_member_count(
+                               bt_field_borrow_class_const(
+                                               base_field)));
+               next_field =
+                       bt_field_structure_borrow_member_field_by_index(
+                               base_field, index);
+               break;
+       }
+       case BT_FIELD_CLASS_TYPE_STATIC_ARRAY:
+       case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY:
+               BT_ASSERT(index < bt_field_array_get_length(base_field));
+               next_field = bt_field_array_borrow_element_field_by_index(
+                       base_field, index);
+               break;
+       case BT_FIELD_CLASS_TYPE_VARIANT:
+               BT_ASSERT(index == 0);
+               next_field = bt_field_variant_borrow_selected_option_field(
+                       base_field);
+               break;
+       default:
+               abort();
+       }
+
+       BT_ASSERT(next_field);
+       return next_field;
+}
+
+static
+void update_default_clock(struct bt_msg_iter *notit, uint64_t new_val,
+               uint64_t new_val_size)
+{
+       uint64_t new_val_mask;
+       uint64_t cur_value_masked;
+
+       BT_ASSERT(new_val_size > 0);
+
+       /*
+        * Special case for a 64-bit new value, which is the limit
+        * of a clock value as of this version: overwrite the
+        * current value directly.
+        */
+       if (new_val_size == 64) {
+               notit->default_clock_val = new_val;
+               goto end;
+       }
+
+       new_val_mask = (1ULL << new_val_size) - 1;
+       cur_value_masked = notit->default_clock_val & new_val_mask;
+
+       if (new_val < cur_value_masked) {
+               /*
+                * It looks like a wrap happened on the number of bits
+                * of the requested new value. Assume that the clock
+                * value wrapped only one time.
+                */
+               notit->default_clock_val += new_val_mask + 1;
+       }
+
+       /* Clear the low bits of the current clock value. */
+       notit->default_clock_val &= ~new_val_mask;
+
+       /* Set the low bits of the current clock value. */
+       notit->default_clock_val |= new_val;
+
+end:
+       BT_LOGV("Updated default clock's value from integer field's value: "
+               "value=%" PRIu64, notit->default_clock_val);
+}
+
+static
+enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
+               struct ctf_field_class *fc, void *data)
+{
+       struct bt_msg_iter *notit = data;
+       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
+       bt_field *field = NULL;
+       struct ctf_field_class_int *int_fc = (void *) fc;
+
+       BT_LOGV("Unsigned integer function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
+
+       if (likely(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE)) {
+               goto update_def_clock;
+       }
+
+       switch (int_fc->meaning) {
+       case CTF_FIELD_CLASS_MEANING_EVENT_CLASS_ID:
+               notit->cur_event_class_id = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_DATA_STREAM_ID:
+               notit->cur_data_stream_id = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME:
+               notit->snapshots.beginning_clock = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_PACKET_END_TIME:
+               notit->snapshots.end_clock = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_STREAM_CLASS_ID:
+               notit->cur_stream_class_id = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_MAGIC:
+               if (value != 0xc1fc1fc1) {
+                       BT_LOGW("Invalid CTF magic number: notit-addr=%p, "
+                               "magic=%" PRIx64, notit, value);
+                       status = BT_BFCR_STATUS_ERROR;
+                       goto end;
+               }
+
+               break;
+       case CTF_FIELD_CLASS_MEANING_PACKET_COUNTER_SNAPSHOT:
+               notit->snapshots.packets = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_DISC_EV_REC_COUNTER_SNAPSHOT:
+               notit->snapshots.discarded_events = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_EXP_PACKET_TOTAL_SIZE:
+               notit->cur_exp_packet_total_size = value;
+               break;
+       case CTF_FIELD_CLASS_MEANING_EXP_PACKET_CONTENT_SIZE:
+               notit->cur_exp_packet_content_size = value;
+               break;
+       default:
+               abort();
+       }
+
+update_def_clock:
+       if (unlikely(int_fc->mapped_clock_class)) {
+               update_default_clock(notit, value, int_fc->base.size);
+       }
+
+       if (unlikely(int_fc->storing_index >= 0)) {
+               g_array_index(notit->stored_values, uint64_t,
+                       (uint64_t) int_fc->storing_index) = value;
+       }
+
+       if (unlikely(!fc->in_ir)) {
+               goto end;
+       }
+
+       field = borrow_next_field(notit);
+       BT_ASSERT(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
+                 bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
+       bt_field_unsigned_integer_set_value(field, value);
+       stack_top(notit->stack)->index++;
+
+end:
+       return status;
+}
+
+static
+enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
+               struct ctf_field_class *fc, void *data)
+{
+       int ret;
+       struct bt_msg_iter *notit = data;
+       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
+       bt_field *string_field = NULL;
+       struct ctf_field_class_int *int_fc = (void *) fc;
+       char str[2] = {'\0', '\0'};
+
+       BT_LOGV("Unsigned integer character function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
+       BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
+       BT_ASSERT(!int_fc->mapped_clock_class);
+       BT_ASSERT(int_fc->storing_index < 0);
+
+       if (unlikely(!fc->in_ir)) {
+               goto end;
+       }
+
+       if (notit->done_filling_string) {
+               goto end;
+       }
+
+       if (value == 0) {
+               notit->done_filling_string = true;
+               goto end;
+       }
+
+       string_field = stack_top(notit->stack)->base;
+       BT_ASSERT(bt_field_get_class_type(string_field) ==
+                 BT_FIELD_CLASS_TYPE_STRING);
+
+       /* Append character */
+       str[0] = (char) value;
+       ret = bt_field_string_append_with_length(string_field, str, 1);
+       if (ret) {
+               BT_LOGE("Cannot append character to string field's value: "
+                       "notit-addr=%p, field-addr=%p, ret=%d",
+                       notit, string_field, ret);
+               status = BT_BFCR_STATUS_ERROR;
+               goto end;
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
+               struct ctf_field_class *fc, void *data)
+{
+       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
+       bt_field *field = NULL;
+       struct bt_msg_iter *notit = data;
+       struct ctf_field_class_int *int_fc = (void *) fc;
+
+       BT_LOGV("Signed integer function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d, value=%" PRId64,
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
+       BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
+
+       if (unlikely(int_fc->storing_index >= 0)) {
+               g_array_index(notit->stored_values, uint64_t,
+                       (uint64_t) int_fc->storing_index) = (uint64_t) value;
+       }
+
+       if (unlikely(!fc->in_ir)) {
+               goto end;
+       }
+
+       field = borrow_next_field(notit);
+       BT_ASSERT(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER ||
+                 bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
+       bt_field_signed_integer_set_value(field, value);
+       stack_top(notit->stack)->index++;
+
+end:
+       return status;
+}
+
+static
+enum bt_bfcr_status bfcr_floating_point_cb(double value,
+               struct ctf_field_class *fc, void *data)
+{
+       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
+       bt_field *field = NULL;
+       struct bt_msg_iter *notit = data;
+
+       BT_LOGV("Floating point number function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d, value=%f",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
+       BT_ASSERT(fc->in_ir);
+       field = borrow_next_field(notit);
+       BT_ASSERT(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_REAL);
+       bt_field_real_set_value(field, value);
+       stack_top(notit->stack)->index++;
+       return status;
+}
+
+static
+enum bt_bfcr_status bfcr_string_begin_cb(
+               struct ctf_field_class *fc, void *data)
+{
+       bt_field *field = NULL;
+       struct bt_msg_iter *notit = data;
+       int ret;
+
+       BT_LOGV("String (beginning) function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
+
+       BT_ASSERT(fc->in_ir);
+       field = borrow_next_field(notit);
+       BT_ASSERT(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_STRING);
+       ret = bt_field_string_clear(field);
+       BT_ASSERT(ret == 0);
+
+       /*
+        * Push on stack. Not a compound class per se, but we know that
+        * only bfcr_string_cb() may be called between this call and a
+        * subsequent call to bfcr_string_end_cb().
+        */
+       stack_push(notit->stack, field);
+       return BT_BFCR_STATUS_OK;
+}
+
+static
+enum bt_bfcr_status bfcr_string_cb(const char *value,
+               size_t len, struct ctf_field_class *fc, void *data)
+{
+       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
+       bt_field *field = NULL;
+       struct bt_msg_iter *notit = data;
+       int ret;
+
+       BT_LOGV("String (substring) function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d, string-length=%zu",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir,
+               len);
+       BT_ASSERT(fc->in_ir);
+       field = stack_top(notit->stack)->base;
+       BT_ASSERT(field);
+
+       /* Append current substring */
+       ret = bt_field_string_append_with_length(field, value, len);
+       if (ret) {
+               BT_LOGE("Cannot append substring to string field's value: "
+                       "notit-addr=%p, field-addr=%p, string-length=%zu, "
+                       "ret=%d", notit, field, len, ret);
+               status = BT_BFCR_STATUS_ERROR;
+               goto end;
+       }
+
+end:
+       return status;
+}
+
+static
+enum bt_bfcr_status bfcr_string_end_cb(
+               struct ctf_field_class *fc, void *data)
+{
+       struct bt_msg_iter *notit = data;
+
+       BT_LOGV("String (end) function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
+       BT_ASSERT(fc->in_ir);
+
+       /* Pop string field */
+       stack_pop(notit->stack);
+
+       /* Go to next field */
+       stack_top(notit->stack)->index++;
+       return BT_BFCR_STATUS_OK;
+}
+
+enum bt_bfcr_status bfcr_compound_begin_cb(
+               struct ctf_field_class *fc, void *data)
+{
+       struct bt_msg_iter *notit = data;
+       bt_field *field;
+
+       BT_LOGV("Compound (beginning) function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
+
+       if (!fc->in_ir) {
+               goto end;
+       }
+
+       /* Borrow field */
+       if (stack_empty(notit->stack)) {
+               /* Root: already set by read_dscope_begin_state() */
+               field = notit->cur_dscope_field;
+       } else {
+               field = borrow_next_field(notit);
+               BT_ASSERT(field);
+       }
+
+       /* Push field */
+       BT_ASSERT(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       stack_push(notit->stack, field);
+
+       /*
+        * Change BFCR "unsigned int" callback if it's a text
+        * array/sequence.
+        */
+       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
+                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
+               struct ctf_field_class_array_base *array_fc = (void *) fc;
+
+               if (array_fc->is_text) {
+                       int ret;
+
+                       BT_ASSERT(bt_field_get_class_type(field) ==
+                                 BT_FIELD_CLASS_TYPE_STRING);
+                       notit->done_filling_string = false;
+                       ret = bt_field_string_clear(field);
+                       BT_ASSERT(ret == 0);
+                       bt_bfcr_set_unsigned_int_cb(notit->bfcr,
+                               bfcr_unsigned_int_char_cb);
+               }
+       }
+
+end:
+       return BT_BFCR_STATUS_OK;
+}
+
+enum bt_bfcr_status bfcr_compound_end_cb(
+               struct ctf_field_class *fc, void *data)
+{
+       struct bt_msg_iter *notit = data;
+
+       BT_LOGV("Compound (end) function called from BFCR: "
+               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
+               "fc-type=%d, fc-in-ir=%d",
+               notit, notit->bfcr, fc, fc->type, fc->in_ir);
+
+       if (!fc->in_ir) {
+               goto end;
+       }
+
+       BT_ASSERT(!stack_empty(notit->stack));
+       BT_ASSERT(bt_field_borrow_class_const(stack_top(notit->stack)->base) ==
+               fc->ir_fc);
+
+       /*
+        * Reset BFCR "unsigned int" callback if it's a text
+        * array/sequence.
+        */
+       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
+                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
+               struct ctf_field_class_array_base *array_fc = (void *) fc;
+
+               if (array_fc->is_text) {
+                       BT_ASSERT(bt_field_get_class_type(
+                               stack_top(notit->stack)->base) ==
+                               BT_FIELD_CLASS_TYPE_STRING);
+                       bt_bfcr_set_unsigned_int_cb(notit->bfcr,
+                               bfcr_unsigned_int_cb);
+               }
+       }
+
+       /* Pop stack */
+       stack_pop(notit->stack);
+
+       /* If the stack is not empty, increment the base's index */
+       if (!stack_empty(notit->stack)) {
+               stack_top(notit->stack)->index++;
+       }
+
+end:
+       return BT_BFCR_STATUS_OK;
+}
+
+static
+int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
+{
+       bt_field *seq_field;
+       struct bt_msg_iter *notit = data;
+       struct ctf_field_class_sequence *seq_fc = (void *) fc;
+       int64_t length = -1;
+       int ret;
+
+       length = (uint64_t) g_array_index(notit->stored_values, uint64_t,
+               seq_fc->stored_length_index);
+       seq_field = stack_top(notit->stack)->base;
+       BT_ASSERT(seq_field);
+       ret = bt_field_dynamic_array_set_length(seq_field, (uint64_t) length);
+       if (ret) {
+               BT_LOGE("Cannot set dynamic array field's length field: "
+                       "notit-addr=%p, field-addr=%p, "
+                       "length=%" PRIu64, notit, seq_field, length);
+       }
+
+       return length;
+}
+
+static
+struct ctf_field_class *bfcr_borrow_variant_selected_field_class_cb(
+               struct ctf_field_class *fc, void *data)
+{
+       int ret;
+       uint64_t i;
+       int64_t option_index = -1;
+       struct bt_msg_iter *notit = data;
+       struct ctf_field_class_variant *var_fc = (void *) fc;
+       struct ctf_named_field_class *selected_option = NULL;
+       struct ctf_field_class *ret_fc = NULL;
+       union {
+               uint64_t u;
+               int64_t i;
+       } tag;
+
+       /* Get variant's tag */
+       tag.u = g_array_index(notit->stored_values, uint64_t,
+               var_fc->stored_tag_index);
+
+       /*
+        * Check each range to find the selected option's index.
+        */
+       if (var_fc->tag_fc->base.is_signed) {
+               for (i = 0; i < var_fc->ranges->len; i++) {
+                       struct ctf_field_class_variant_range *range =
+                               ctf_field_class_variant_borrow_range_by_index(
+                                       var_fc, i);
+
+                       if (tag.i >= range->range.lower.i &&
+                                       tag.i <= range->range.upper.i) {
+                               option_index = (int64_t) range->option_index;
+                               break;
+                       }
+               }
+       } else {
+               for (i = 0; i < var_fc->ranges->len; i++) {
+                       struct ctf_field_class_variant_range *range =
+                               ctf_field_class_variant_borrow_range_by_index(
+                                       var_fc, i);
+
+                       if (tag.u >= range->range.lower.u &&
+                                       tag.u <= range->range.upper.u) {
+                               option_index = (int64_t) range->option_index;
+                               break;
+                       }
+               }
+       }
+
+       if (option_index < 0) {
+               BT_LOGW("Cannot find variant field class's option: "
+                       "notit-addr=%p, var-fc-addr=%p, u-tag=%" PRIu64 ", "
+                       "i-tag=%" PRId64, notit, var_fc, tag.u, tag.i);
+               goto end;
+       }
+
+       selected_option = ctf_field_class_variant_borrow_option_by_index(
+               var_fc, (uint64_t) option_index);
+
+       if (selected_option->fc->in_ir) {
+               bt_field *var_field = stack_top(notit->stack)->base;
+
+               ret = bt_field_variant_select_option_field(
+                       var_field, option_index);
+               if (ret) {
+                       BT_LOGW("Cannot select variant field's option field: "
+                               "notit-addr=%p, var-field-addr=%p, "
+                               "opt-index=%" PRId64, notit, var_field,
+                               option_index);
+                       goto end;
+               }
+       }
+
+       ret_fc = selected_option->fc;
+
+end:
+       return ret_fc;
+}
+
+static
+void set_event_default_clock_value(struct bt_msg_iter *notit)
+{
+       bt_event *event =
+               bt_message_event_borrow_event(
+                       notit->event_msg);
+       bt_stream_class *sc = notit->meta.sc->ir_sc;
+
+       BT_ASSERT(event);
+
+       if (bt_stream_class_borrow_default_clock_class(sc)) {
+               bt_event_set_default_clock_value(event,
+                       notit->default_clock_val);
+       }
+}
+
+static
+void notify_new_stream(struct bt_msg_iter *notit,
+               bt_message **message)
+{
+       enum bt_msg_iter_status status;
+       bt_message *ret = NULL;
+
+       status = set_current_stream(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               BT_MESSAGE_PUT_REF_AND_RESET(ret);
+               goto end;
+       }
+
+       BT_ASSERT(notit->stream);
+       BT_ASSERT(notit->msg_iter);
+       ret = bt_message_stream_beginning_create(notit->msg_iter,
+               notit->stream);
+       if (!ret) {
+               BT_LOGE("Cannot create stream beginning message: "
+                       "notit-addr=%p, stream-addr=%p",
+                       notit, notit->stream);
+               return;
+       }
+
+end:
+       *message = ret;
+}
+
+static
+void notify_end_of_stream(struct bt_msg_iter *notit,
+               bt_message **message)
+{
+       bt_message *ret;
+
+       if (!notit->stream) {
+               BT_LOGE("Cannot create stream for stream message: "
+                       "notit-addr=%p", notit);
+               return;
+       }
+
+       BT_ASSERT(notit->msg_iter);
+       ret = bt_message_stream_end_create(notit->msg_iter,
+               notit->stream);
+       if (!ret) {
+               BT_LOGE("Cannot create stream beginning message: "
+                       "notit-addr=%p, stream-addr=%p",
+                       notit, notit->stream);
+               return;
+       }
+       *message = ret;
+}
+
+static
+void notify_new_packet(struct bt_msg_iter *notit,
+               bt_message **message)
+{
+       int ret;
+       enum bt_msg_iter_status status;
+       bt_message *msg = NULL;
+       const bt_stream_class *sc;
+
+       status = set_current_packet(notit);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       BT_ASSERT(notit->packet);
+       sc = notit->meta.sc->ir_sc;
+       BT_ASSERT(sc);
+
+       if (bt_stream_class_packets_have_discarded_event_counter_snapshot(sc)) {
+               BT_ASSERT(notit->snapshots.discarded_events != UINT64_C(-1));
+               bt_packet_set_discarded_event_counter_snapshot(
+                       notit->packet, notit->snapshots.discarded_events);
+       }
+
+       if (bt_stream_class_packets_have_packet_counter_snapshot(sc)) {
+               BT_ASSERT(notit->snapshots.packets != UINT64_C(-1));
+               bt_packet_set_packet_counter_snapshot(
+                       notit->packet, notit->snapshots.packets);
+       }
+
+       if (bt_stream_class_packets_have_default_beginning_clock_value(sc)) {
+               BT_ASSERT(notit->snapshots.beginning_clock != UINT64_C(-1));
+               bt_packet_set_default_beginning_clock_value(
+                       notit->packet, notit->snapshots.beginning_clock);
+       }
+
+       if (bt_stream_class_packets_have_default_end_clock_value(sc)) {
+               BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
+               bt_packet_set_default_end_clock_value(
+                       notit->packet, notit->snapshots.end_clock);
+       }
+
+       if (notit->packet_header_field) {
+               ret = bt_packet_move_header_field(
+                       notit->packet, notit->packet_header_field);
+               if (ret) {
+                       goto end;
+               }
+
+               notit->packet_header_field = NULL;
+
+               /*
+                * At this point notit->dscopes.trace_packet_header has
+                * the same value as the packet header field within
+                * notit->packet.
+                */
+               BT_ASSERT(bt_packet_borrow_header_field(
+                       notit->packet) ==
+                       notit->dscopes.trace_packet_header);
+       }
+
+       if (notit->packet_context_field) {
+               ret = bt_packet_move_context_field(
+                       notit->packet, notit->packet_context_field);
+               if (ret) {
+                       goto end;
+               }
+
+               notit->packet_context_field = NULL;
+
+               /*
+                * At this point notit->dscopes.trace_packet_header has
+                * the same value as the packet header field within
+                * notit->packet.
+                */
+               BT_ASSERT(bt_packet_borrow_context_field(
+                       notit->packet) ==
+                       notit->dscopes.stream_packet_context);
+       }
+
+       BT_ASSERT(notit->msg_iter);
+       msg = bt_message_packet_beginning_create(notit->msg_iter,
+               notit->packet);
+       if (!msg) {
+               BT_LOGE("Cannot create packet beginning message: "
+                       "notit-addr=%p, packet-addr=%p",
+                       notit, notit->packet);
+               goto end;
+       }
+
+       *message = msg;
+
+end:
+       return;
+}
+
+static
+void notify_end_of_packet(struct bt_msg_iter *notit,
+               bt_message **message)
+{
+       bt_message *msg;
+
+       if (!notit->packet) {
+               return;
+       }
+
+       /* Update default clock from packet's end time */
+       if (notit->snapshots.end_clock != UINT64_C(-1)) {
+               notit->default_clock_val = notit->snapshots.end_clock;
+       }
+
+       BT_ASSERT(notit->msg_iter);
+       msg = bt_message_packet_end_create(notit->msg_iter,
+               notit->packet);
+       if (!msg) {
+               BT_LOGE("Cannot create packet end message: "
+                       "notit-addr=%p, packet-addr=%p",
+                       notit, notit->packet);
+               return;
+
+       }
+
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       *message = msg;
+}
+
+BT_HIDDEN
+struct bt_msg_iter *bt_msg_iter_create(struct ctf_trace_class *tc,
+               size_t max_request_sz,
+               struct bt_msg_iter_medium_ops medops, void *data)
+{
+       struct bt_msg_iter *notit = NULL;
+       struct bt_bfcr_cbs cbs = {
+               .classes = {
+                       .signed_int = bfcr_signed_int_cb,
+                       .unsigned_int = bfcr_unsigned_int_cb,
+                       .floating_point = bfcr_floating_point_cb,
+                       .string_begin = bfcr_string_begin_cb,
+                       .string = bfcr_string_cb,
+                       .string_end = bfcr_string_end_cb,
+                       .compound_begin = bfcr_compound_begin_cb,
+                       .compound_end = bfcr_compound_end_cb,
+               },
+               .query = {
+                       .get_sequence_length = bfcr_get_sequence_length_cb,
+                       .borrow_variant_selected_field_class = bfcr_borrow_variant_selected_field_class_cb,
+               },
+       };
+
+       BT_ASSERT(tc);
+       BT_ASSERT(medops.request_bytes);
+       BT_ASSERT(medops.borrow_stream);
+       BT_LOGD("Creating CTF plugin message iterator: "
+               "trace-addr=%p, max-request-size=%zu, "
+               "data=%p", tc, max_request_sz, data);
+       notit = g_new0(struct bt_msg_iter, 1);
+       if (!notit) {
+               BT_LOGE_STR("Failed to allocate one CTF plugin message iterator.");
+               goto end;
+       }
+       notit->meta.tc = tc;
+       notit->medium.medops = medops;
+       notit->medium.max_request_sz = max_request_sz;
+       notit->medium.data = data;
+       notit->stack = stack_new(notit);
+       notit->stored_values = g_array_new(FALSE, TRUE, sizeof(uint64_t));
+       g_array_set_size(notit->stored_values, tc->stored_value_count);
+
+       if (!notit->stack) {
+               BT_LOGE_STR("Failed to create field stack.");
+               goto error;
+       }
+
+       notit->bfcr = bt_bfcr_create(cbs, notit);
+       if (!notit->bfcr) {
+               BT_LOGE_STR("Failed to create binary class reader (BFCR).");
+               goto error;
+       }
+
+       bt_msg_iter_reset(notit);
+       BT_LOGD("Created CTF plugin message iterator: "
+               "trace-addr=%p, max-request-size=%zu, "
+               "data=%p, notit-addr=%p",
+               tc, max_request_sz, data, notit);
+       notit->cur_packet_offset = 0;
+
+end:
+       return notit;
+
+error:
+       bt_msg_iter_destroy(notit);
+       notit = NULL;
+       goto end;
+}
+
+void bt_msg_iter_destroy(struct bt_msg_iter *notit)
+{
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
+       release_all_dscopes(notit);
+
+       BT_LOGD("Destroying CTF plugin message iterator: addr=%p", notit);
+
+       if (notit->stack) {
+               BT_LOGD_STR("Destroying field stack.");
+               stack_destroy(notit->stack);
+       }
+
+       if (notit->bfcr) {
+               BT_LOGD("Destroying BFCR: bfcr-addr=%p", notit->bfcr);
+               bt_bfcr_destroy(notit->bfcr);
+       }
+
+       if (notit->stored_values) {
+               g_array_free(notit->stored_values, TRUE);
+       }
+
+       g_free(notit);
+}
+
+enum bt_msg_iter_status bt_msg_iter_get_next_message(
+               struct bt_msg_iter *notit,
+               bt_self_message_iterator *msg_iter,
+               bt_message **message)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       BT_ASSERT(notit);
+       BT_ASSERT(message);
+
+       if (notit->state == STATE_DONE) {
+               status = BT_MSG_ITER_STATUS_EOF;
+               goto end;
+       }
+
+       notit->msg_iter = msg_iter;
+
+       BT_LOGV("Getting next message: notit-addr=%p", notit);
+
+       while (true) {
+               status = handle_state(notit);
+               if (status == BT_MSG_ITER_STATUS_AGAIN) {
+                       BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
+                       goto end;
+               }
+
+               if (status != BT_MSG_ITER_STATUS_OK) {
+                       if (status == BT_MSG_ITER_STATUS_EOF) {
+                               enum state next_state = notit->state;
+
+                               BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_EOF.");
+
+                               if (notit->packet) {
+                                       notify_end_of_packet(notit,
+                                               message);
+                               } else {
+                                       notify_end_of_stream(notit,
+                                               message);
+                                       next_state = STATE_DONE;
+                               }
+
+                               if (!*message) {
+                                       status = BT_MSG_ITER_STATUS_ERROR;
+                                       goto end;
+                               }
+
+                               status = BT_MSG_ITER_STATUS_OK;
+                               notit->state = next_state;
+                       } else {
+                               BT_LOGW("Cannot handle state: "
+                                       "notit-addr=%p, state=%s",
+                                       notit, state_string(notit->state));
+                       }
+
+                       goto end;
+               }
+
+               switch (notit->state) {
+               case STATE_EMIT_MSG_NEW_STREAM:
+                       /* notify_new_stream() logs errors */
+                       notify_new_stream(notit, message);
+
+                       if (!*message) {
+                               status = BT_MSG_ITER_STATUS_ERROR;
+                       }
+
+                       notit->stream_begin_emitted = true;
+                       goto end;
+               case STATE_EMIT_MSG_NEW_PACKET:
+                       /* notify_new_packet() logs errors */
+                       notify_new_packet(notit, message);
+
+                       if (!*message) {
+                               status = BT_MSG_ITER_STATUS_ERROR;
+                       }
+
+                       goto end;
+               case STATE_EMIT_MSG_EVENT:
+                       BT_ASSERT(notit->event_msg);
+                       set_event_default_clock_value(notit);
+                       *message = notit->event_msg;
+                       notit->event_msg = NULL;
+                       goto end;
+               case STATE_EMIT_MSG_END_OF_PACKET:
+                       /* notify_end_of_packet() logs errors */
+                       notify_end_of_packet(notit, message);
+
+                       if (!*message) {
+                               status = BT_MSG_ITER_STATUS_ERROR;
+                       }
+
+                       goto end;
+               default:
+                       /* Non-emitting state: continue */
+                       break;
+               }
+       }
+
+end:
+       return status;
+}
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_borrow_packet_header_context_fields(
+               struct bt_msg_iter *notit,
+               bt_field **packet_header_field,
+               bt_field **packet_context_field)
+{
+       int ret;
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       BT_ASSERT(notit);
+
+       if (notit->state == STATE_EMIT_MSG_NEW_PACKET) {
+               /* We're already there */
+               goto set_fields;
+       }
+
+       while (true) {
+               status = handle_state(notit);
+               if (status == BT_MSG_ITER_STATUS_AGAIN) {
+                       BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
+                       goto end;
+               }
+               if (status != BT_MSG_ITER_STATUS_OK) {
+                       if (status == BT_MSG_ITER_STATUS_EOF) {
+                               BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_EOF.");
+                       } else {
+                               BT_LOGW("Cannot handle state: "
+                                       "notit-addr=%p, state=%s",
+                                       notit, state_string(notit->state));
+                       }
+                       goto end;
+               }
+
+               switch (notit->state) {
+               case STATE_EMIT_MSG_NEW_PACKET:
+                       /*
+                        * Packet header and context fields are
+                        * potentially decoded (or they don't exist).
+                        */
+                       goto set_fields;
+               case STATE_INIT:
+               case STATE_EMIT_MSG_NEW_STREAM:
+               case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
+               case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
+               case STATE_AFTER_TRACE_PACKET_HEADER:
+               case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
+               case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
+               case STATE_AFTER_STREAM_PACKET_CONTEXT:
+                       /* Non-emitting state: continue */
+                       break;
+               default:
+                       /*
+                        * We should never get past the
+                        * STATE_EMIT_MSG_NEW_PACKET state.
+                        */
+                       BT_LOGF("Unexpected state: notit-addr=%p, state=%s",
+                               notit, state_string(notit->state));
+                       abort();
+               }
+       }
+
+set_fields:
+       ret = set_current_packet_content_sizes(notit);
+       if (ret) {
+               status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
+       }
+
+       if (packet_header_field) {
+               *packet_header_field = notit->dscopes.trace_packet_header;
+       }
+
+       if (packet_context_field) {
+               *packet_context_field = notit->dscopes.stream_packet_context;
+       }
+
+end:
+       return status;
+}
+
+BT_HIDDEN
+void bt_msg_iter_set_medops_data(struct bt_msg_iter *notit,
+               void *medops_data)
+{
+       BT_ASSERT(notit);
+       notit->medium.data = medops_data;
+}
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_seek(
+               struct bt_msg_iter *notit, off_t offset)
+{
+       enum bt_msg_iter_status ret = BT_MSG_ITER_STATUS_OK;
+       enum bt_msg_iter_medium_status medium_status;
+
+       BT_ASSERT(notit);
+       if (offset < 0) {
+               BT_LOGE("Cannot seek to negative offset: offset=%jd", offset);
+               ret = BT_MSG_ITER_STATUS_INVAL;
+               goto end;
+       }
+
+       if (!notit->medium.medops.seek) {
+               ret = BT_MSG_ITER_STATUS_UNSUPPORTED;
+               BT_LOGD("Aborting seek as the iterator's underlying media does not implement seek support.");
+               goto end;
+       }
+
+       medium_status = notit->medium.medops.seek(
+               BT_MSG_ITER_SEEK_WHENCE_SET, offset, notit->medium.data);
+       if (medium_status != BT_MSG_ITER_MEDIUM_STATUS_OK) {
+               if (medium_status == BT_MSG_ITER_MEDIUM_STATUS_EOF) {
+                       ret = BT_MSG_ITER_STATUS_EOF;
+               } else {
+                       ret = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+       }
+
+       bt_msg_iter_reset(notit);
+       notit->cur_packet_offset = offset;
+
+end:
+       return ret;
+}
+
+BT_HIDDEN
+off_t bt_msg_iter_get_current_packet_offset(struct bt_msg_iter *notit)
+{
+       BT_ASSERT(notit);
+       return notit->cur_packet_offset;
+}
+
+BT_HIDDEN
+off_t bt_msg_iter_get_current_packet_size(
+               struct bt_msg_iter *notit)
+{
+       BT_ASSERT(notit);
+       return notit->cur_exp_packet_total_size;
+}
+
+BT_HIDDEN
+void bt_msg_trace_class_changed(struct bt_msg_iter *notit)
+{
+       if (notit->meta.tc->stored_value_count > notit->stored_values->len) {
+               g_array_set_size(notit->stored_values,
+                       notit->meta.tc->stored_value_count);
+       }
+}
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_get_packet_properties(
+               struct bt_msg_iter *notit,
+               struct bt_msg_iter_packet_properties *props)
+{
+       BT_ASSERT(notit);
+       BT_ASSERT(props);
+
+       props->exp_packet_total_size =
+               (uint64_t) notit->cur_exp_packet_total_size;
+       props->exp_packet_content_size =
+               (uint64_t) notit->cur_exp_packet_content_size;
+       BT_ASSERT(props->stream_class_id >= 0);
+       props->stream_class_id = (uint64_t) notit->cur_stream_class_id;
+       props->data_stream_id = notit->cur_data_stream_id;
+       props->snapshots.discarded_events = notit->snapshots.discarded_events;
+       props->snapshots.packets = notit->snapshots.packets;
+       props->snapshots.beginning_clock = notit->snapshots.beginning_clock;
+       props->snapshots.end_clock = notit->snapshots.end_clock;
+       return BT_MSG_ITER_STATUS_OK;
+}
diff --git a/plugins/ctf/common/msg-iter/msg-iter.h b/plugins/ctf/common/msg-iter/msg-iter.h
new file mode 100644 (file)
index 0000000..89028bb
--- /dev/null
@@ -0,0 +1,407 @@
+#ifndef CTF_MSG_ITER_H
+#define CTF_MSG_ITER_H
+
+/*
+ * Babeltrace - CTF message iterator
+ *                  Â¯Â¯Â¯Â¯Â¯        Â¯Â¯Â¯Â¯
+ * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
+ * Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
+
+#include "../metadata/ctf-meta.h"
+
+/**
+ * @file ctf-msg-iter.h
+ *
+ * CTF message iterator
+ *     Â¯Â¯Â¯Â¯Â¯        Â¯Â¯Â¯Â¯
+ * This is a common internal API used by CTF source plugins. It allows
+ * one to get messages from a user-provided medium.
+ */
+
+/**
+ * Medium operations status codes.
+ */
+enum bt_msg_iter_medium_status {
+       /**
+        * End of file.
+        *
+        * The medium function called by the message iterator
+        * function reached the end of the file.
+        */
+       BT_MSG_ITER_MEDIUM_STATUS_EOF = 1,
+
+       /**
+        * There is no data available right now, try again later.
+        */
+       BT_MSG_ITER_MEDIUM_STATUS_AGAIN = 11,
+
+       /** Unsupported operation. */
+       BT_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3,
+
+       /** Invalid argument. */
+       BT_MSG_ITER_MEDIUM_STATUS_INVAL = -2,
+
+       /** General error. */
+       BT_MSG_ITER_MEDIUM_STATUS_ERROR = -1,
+
+       /** Everything okay. */
+       BT_MSG_ITER_MEDIUM_STATUS_OK = 0,
+};
+
+/**
+ * CTF message iterator API status code.
+ */
+enum bt_msg_iter_status {
+       /**
+        * End of file.
+        *
+        * The medium function called by the message iterator
+        * function reached the end of the file.
+        */
+       BT_MSG_ITER_STATUS_EOF = BT_MSG_ITER_MEDIUM_STATUS_EOF,
+
+       /**
+        * There is no data available right now, try again later.
+        *
+        * Some condition resulted in the
+        * bt_msg_iter_medium_ops::request_bytes() user function not
+        * having access to any data now. You should retry calling the
+        * last called message iterator function once the situation
+        * is resolved.
+        */
+       BT_MSG_ITER_STATUS_AGAIN = BT_MSG_ITER_MEDIUM_STATUS_AGAIN,
+
+       /** Invalid argument. */
+       BT_MSG_ITER_STATUS_INVAL = BT_MSG_ITER_MEDIUM_STATUS_INVAL,
+
+       /** Unsupported operation. */
+       BT_MSG_ITER_STATUS_UNSUPPORTED = BT_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED,
+
+       /** General error. */
+       BT_MSG_ITER_STATUS_ERROR = BT_MSG_ITER_MEDIUM_STATUS_ERROR,
+
+       /** Everything okay. */
+       BT_MSG_ITER_STATUS_OK = 0,
+};
+
+/**
+ * CTF message iterator seek operation directives.
+ */
+enum bt_msg_iter_seek_whence {
+       /**
+        * Set the iterator's position to an absolute offset in the underlying
+        * medium.
+        */
+       BT_MSG_ITER_SEEK_WHENCE_SET,
+};
+
+/**
+ * Medium operations.
+ *
+ * Those user functions are called by the message iterator
+ * functions to request medium actions.
+ */
+struct bt_msg_iter_medium_ops {
+       /**
+        * Returns the next byte buffer to be used by the binary file
+        * reader to deserialize binary data.
+        *
+        * This function \em must be defined.
+        *
+        * The purpose of this function is to return a buffer of bytes
+        * to the message iterator, of a maximum of \p request_sz
+        * bytes. If this function cannot return a buffer of at least
+        * \p request_sz bytes, it may return a smaller buffer. In
+        * either cases, \p buffer_sz must be set to the returned buffer
+        * size (in bytes).
+        *
+        * The returned buffer's ownership remains the medium, in that
+        * it won't be freed by the message iterator functions. The
+        * returned buffer won't be modified by the message
+        * iterator functions either.
+        *
+        * When this function is called for the first time for a given
+        * file, the offset within the file is considered to be 0. The
+        * next times this function is called, the returned buffer's
+        * byte offset within the complete file must be the previous
+        * offset plus the last returned value of \p buffer_sz by this
+        * medium.
+        *
+        * This function must return one of the following statuses:
+        *
+        *   - <b>#BT_MSG_ITER_MEDIUM_STATUS_OK</b>: Everything
+        *     is okay, i.e. \p buffer_sz is set to a positive value
+        *     reflecting the number of available bytes in the buffer
+        *     starting at the address written in \p buffer_addr.
+        *   - <b>#BT_MSG_ITER_MEDIUM_STATUS_AGAIN</b>: No data is
+        *     available right now. In this case, the message
+        *     iterator function called by the user returns
+        *     #BT_MSG_ITER_STATUS_AGAIN, and it is the user's
+        *     responsibility to make sure enough data becomes available
+        *     before calling the \em same message iterator
+        *     function again to continue the decoding process.
+        *   - <b>#BT_MSG_ITER_MEDIUM_STATUS_EOF</b>: The end of
+        *     the file was reached, and no more data will ever be
+        *     available for this file. In this case, the message
+        *     iterator function called by the user returns
+        *     #BT_MSG_ITER_STATUS_EOF. This must \em not be
+        *     returned when returning at least one byte of data to the
+        *     caller, i.e. this must be returned when there's
+        *     absolutely nothing left; should the request size be
+        *     larger than what's left in the file, this function must
+        *     return what's left, setting \p buffer_sz to the number of
+        *     remaining bytes, and return
+        *     #BT_MSG_ITER_MEDIUM_STATUS_EOF on the \em following
+        *     call.
+        *   - <b>#BT_MSG_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
+        *     error occured during this operation. In this case, the
+        *     message iterator function called by the user returns
+        *     #BT_MSG_ITER_STATUS_ERROR.
+        *
+        * If #BT_MSG_ITER_MEDIUM_STATUS_OK is not returned, the
+        * values of \p buffer_sz and \p buffer_addr are \em ignored by
+        * the caller.
+        *
+        * @param request_sz    Requested buffer size (bytes)
+        * @param buffer_addr   Returned buffer address
+        * @param buffer_sz     Returned buffer's size (bytes)
+        * @param data          User data
+        * @returns             Status code (see description above)
+        */
+       enum bt_msg_iter_medium_status (* request_bytes)(
+                       size_t request_sz, uint8_t **buffer_addr,
+                       size_t *buffer_sz, void *data);
+
+       /**
+        * Repositions the underlying stream's position.
+        *
+        * This *optional* method repositions the underlying stream
+        * to a given absolute or relative position, as indicated by
+        * the whence directive.
+        *
+        * @param whence        One of #bt_msg_iter_seek_whence values
+        * @param offset        Offset to use for the given directive
+        * @param data          User data
+        * @returns             One of #bt_msg_iter_medium_status values
+        */
+       enum bt_msg_iter_medium_status (* seek)(
+                       enum bt_msg_iter_seek_whence whence,
+                       off_t offset, void *data);
+
+       /**
+        * Returns a stream instance (weak reference) for the given
+        * stream class.
+        *
+        * This is called after a packet header is read, and the
+        * corresponding stream class is found by the message
+        * iterator.
+        *
+        * @param stream_class  Stream class of the stream to get
+        * @param stream_id     Stream (instance) ID of the stream
+        *                      to get (-1ULL if not available)
+        * @param data          User data
+        * @returns             Stream instance (weak reference) or
+        *                      \c NULL on error
+        */
+       bt_stream * (* borrow_stream)(
+                       bt_stream_class *stream_class,
+                       int64_t stream_id, void *data);
+};
+
+/** CTF message iterator. */
+struct bt_msg_iter;
+
+/**
+ * Creates a CTF message iterator.
+ *
+ * Upon successful completion, the reference count of \p trace is
+ * incremented.
+ *
+ * @param trace                        Trace to read
+ * @param max_request_sz       Maximum buffer size, in bytes, to
+ *                             request to
+ *                             bt_msg_iter_medium_ops::request_bytes()
+ *                             at a time
+ * @param medops               Medium operations
+ * @param medops_data          User data (passed to medium operations)
+ * @returns                    New CTF message iterator on
+ *                             success, or \c NULL on error
+ */
+BT_HIDDEN
+struct bt_msg_iter *bt_msg_iter_create(struct ctf_trace_class *tc,
+       size_t max_request_sz, struct bt_msg_iter_medium_ops medops,
+       void *medops_data);
+
+/**
+ * Destroys a CTF message iterator, freeing all internal resources.
+ *
+ * The registered trace's reference count is decremented.
+ *
+ * @param msg_iter             CTF message iterator
+ */
+BT_HIDDEN
+void bt_msg_iter_destroy(struct bt_msg_iter *msg_iter);
+
+/**
+ * Returns the next message from a CTF message iterator.
+ *
+ * Upon successful completion, #BT_MSG_ITER_STATUS_OK is
+ * returned, and the next message is written to \p msg.
+ * In this case, the caller is responsible for calling
+ * bt_message_put() on the returned message.
+ *
+ * If this function returns #BT_MSG_ITER_STATUS_AGAIN, the caller
+ * should make sure that data becomes available to its medium, and
+ * call this function again, until another status is returned.
+ *
+ * @param msg_iter             CTF message iterator
+ * @param message              Returned message if the function's
+ *                             return value is #BT_MSG_ITER_STATUS_OK
+ * @returns                    One of #bt_msg_iter_status values
+ */
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_get_next_message(
+               struct bt_msg_iter *notit,
+               bt_self_message_iterator *msg_iter,
+               bt_message **message);
+
+/**
+ * Returns the first packet header and context fields. This function
+ * never needs to call the `borrow_stream()` medium operation because
+ * it does not create packet or event objects.
+ *
+ * @param msg_iter             CTF message iterator
+ * @param packet_header_field  Packet header field (\c NULL if there's
+ *                             no packet header field)
+ * @param packet_context_field Packet context field (\c NULL if there's
+ *                             no packet context field)
+ * @returns                    One of #bt_msg_iter_status values
+ */
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_borrow_packet_header_context_fields(
+               struct bt_msg_iter *notit,
+               bt_field **packet_header_field,
+               bt_field **packet_context_field);
+
+struct bt_msg_iter_packet_properties {
+       uint64_t exp_packet_total_size;
+       uint64_t exp_packet_content_size;
+       uint64_t stream_class_id;
+       int64_t data_stream_id;
+
+       struct {
+               uint64_t discarded_events;
+               uint64_t packets;
+               uint64_t beginning_clock;
+               uint64_t end_clock;
+       } snapshots;
+};
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_get_packet_properties(
+               struct bt_msg_iter *notit,
+               struct bt_msg_iter_packet_properties *props);
+
+BT_HIDDEN
+void bt_msg_iter_set_medops_data(struct bt_msg_iter *notit,
+               void *medops_data);
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_seek(
+               struct bt_msg_iter *notit, off_t offset);
+
+/*
+ * Get the current packet's offset in bytes relative to the media's initial
+ * position.
+ */
+BT_HIDDEN
+off_t bt_msg_iter_get_current_packet_offset(
+               struct bt_msg_iter *notit);
+
+/* Get the current packet's size (in bits). */
+BT_HIDDEN
+off_t bt_msg_iter_get_current_packet_size(
+               struct bt_msg_iter *notit);
+
+/*
+ * Resets the iterator so that the next requested medium bytes are
+ * assumed to be the first bytes of a new stream. The first message
+ * which this iterator emits after calling bt_msg_iter_reset() is a
+ * BT_MESSAGE_TYPE_STREAM_BEGINNING one.
+ */
+BT_HIDDEN
+void bt_msg_iter_reset(struct bt_msg_iter *notit);
+
+/*
+ * Notify the iterator that the trace class changed somehow (new
+ * stream/event classes).
+ */
+BT_HIDDEN
+void bt_msg_trace_class_changed(struct bt_msg_iter *notit);
+
+static inline
+const char *bt_msg_iter_medium_status_string(
+               enum bt_msg_iter_medium_status status)
+{
+       switch (status) {
+       case BT_MSG_ITER_MEDIUM_STATUS_EOF:
+               return "BT_MSG_ITER_MEDIUM_STATUS_EOF";
+       case BT_MSG_ITER_MEDIUM_STATUS_AGAIN:
+               return "BT_MSG_ITER_MEDIUM_STATUS_AGAIN";
+       case BT_MSG_ITER_MEDIUM_STATUS_INVAL:
+               return "BT_MSG_ITER_MEDIUM_STATUS_INVAL";
+       case BT_MSG_ITER_MEDIUM_STATUS_ERROR:
+               return "BT_MSG_ITER_MEDIUM_STATUS_ERROR";
+       case BT_MSG_ITER_MEDIUM_STATUS_OK:
+               return "BT_MSG_ITER_MEDIUM_STATUS_OK";
+       default:
+               return "(unknown)";
+       }
+}
+
+static inline
+const char *bt_msg_iter_status_string(
+               enum bt_msg_iter_status status)
+{
+       switch (status) {
+       case BT_MSG_ITER_STATUS_EOF:
+               return "BT_MSG_ITER_STATUS_EOF";
+       case BT_MSG_ITER_STATUS_AGAIN:
+               return "BT_MSG_ITER_STATUS_AGAIN";
+       case BT_MSG_ITER_STATUS_INVAL:
+               return "BT_MSG_ITER_STATUS_INVAL";
+       case BT_MSG_ITER_STATUS_ERROR:
+               return "BT_MSG_ITER_STATUS_ERROR";
+       case BT_MSG_ITER_STATUS_OK:
+               return "BT_MSG_ITER_STATUS_OK";
+       default:
+               return "(unknown)";
+       }
+}
+
+#endif /* CTF_MSG_ITER_H */
diff --git a/plugins/ctf/common/notif-iter/Makefile.am b/plugins/ctf/common/notif-iter/Makefile.am
deleted file mode 100644 (file)
index e29d92a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-noinst_LTLIBRARIES = libctf-notif-iter.la
-
-libctf_notif_iter_la_SOURCES = \
-       notif-iter.c \
-       notif-iter.h \
-       logging.c \
-       logging.h
diff --git a/plugins/ctf/common/notif-iter/logging.c b/plugins/ctf/common/notif-iter/logging.c
deleted file mode 100644 (file)
index 082d444..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL ctf_notif_iter_log_level
-#include <babeltrace/logging-internal.h>
-
-BT_LOG_INIT_LOG_LEVEL(ctf_notif_iter_log_level,
-       "BABELTRACE_PLUGIN_CTF_NOTIF_ITER_LOG_LEVEL");
diff --git a/plugins/ctf/common/notif-iter/logging.h b/plugins/ctf/common/notif-iter/logging.h
deleted file mode 100644 (file)
index 74f3c8f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef CTF_NOTIF_ITER_LOGGING_H
-#define CTF_NOTIF_ITER_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL ctf_notif_iter_log_level
-#include <babeltrace/logging-internal.h>
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(ctf_notif_iter_log_level);
-
-#endif /* CTF_NOTIF_ITER_LOGGING_H */
diff --git a/plugins/ctf/common/notif-iter/notif-iter.c b/plugins/ctf/common/notif-iter/notif-iter.c
deleted file mode 100644 (file)
index 3d377d3..0000000
+++ /dev/null
@@ -1,2806 +0,0 @@
-/*
- * Babeltrace - CTF notification iterator
- *
- * Copyright (c) 2015-2018 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_TAG "PLUGIN-CTF-NOTIF-ITER"
-#include "logging.h"
-
-#include <stdint.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <babeltrace/assert-internal.h>
-#include <string.h>
-#include <babeltrace/babeltrace.h>
-#include <babeltrace/common-internal.h>
-#include <glib.h>
-#include <stdlib.h>
-
-#include "notif-iter.h"
-#include "../bfcr/bfcr.h"
-
-struct bt_notif_iter;
-
-/* A visit stack entry */
-struct stack_entry {
-       /*
-        * Current base field, one of:
-        *
-        *   * string
-        *   * structure
-        *   * array
-        *   * sequence
-        *   * variant
-        *
-        * Field is borrowed.
-        */
-       bt_field *base;
-
-       /* Index of next field to set */
-       size_t index;
-};
-
-/* Visit stack */
-struct stack {
-       /* Entries (struct stack_entry) */
-       GArray *entries;
-
-       /* Number of active entries */
-       size_t size;
-};
-
-/* State */
-enum state {
-       STATE_INIT,
-       STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN,
-       STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
-       STATE_AFTER_TRACE_PACKET_HEADER,
-       STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN,
-       STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE,
-       STATE_AFTER_STREAM_PACKET_CONTEXT,
-       STATE_EMIT_NOTIF_NEW_STREAM,
-       STATE_EMIT_NOTIF_NEW_PACKET,
-       STATE_DSCOPE_EVENT_HEADER_BEGIN,
-       STATE_DSCOPE_EVENT_HEADER_CONTINUE,
-       STATE_AFTER_EVENT_HEADER,
-       STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN,
-       STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE,
-       STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN,
-       STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE,
-       STATE_DSCOPE_EVENT_PAYLOAD_BEGIN,
-       STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE,
-       STATE_EMIT_NOTIF_EVENT,
-       STATE_EMIT_NOTIF_END_OF_PACKET,
-       STATE_DONE,
-       STATE_SKIP_PACKET_PADDING,
-};
-
-/* CTF notification iterator */
-struct bt_notif_iter {
-       /* Visit stack */
-       struct stack *stack;
-
-       /* Current notification iterator to create notifications (weak) */
-       bt_self_notification_iterator *notif_iter;
-
-       /*
-        * Current dynamic scope field pointer.
-        *
-        * This is set by read_dscope_begin_state() and contains the
-        * value of one of the pointers in `dscopes` below.
-        */
-       bt_field *cur_dscope_field;
-
-       /*
-        * True if we're done filling a string field from a text
-        * array/sequence payload.
-        */
-       bool done_filling_string;
-
-       /* Trace and classes */
-       struct {
-               struct ctf_trace_class *tc;
-               struct ctf_stream_class *sc;
-               struct ctf_event_class *ec;
-       } meta;
-
-       /* Current packet header field wrapper (NULL if not created yet) */
-       bt_packet_header_field *packet_header_field;
-
-       /* Current packet header field wrapper (NULL if not created yet) */
-       bt_packet_context_field *packet_context_field;
-
-       /* Current event header field (NULL if not created yet) */
-       bt_event_header_field *event_header_field;
-
-       /* Current packet (NULL if not created yet) */
-       bt_packet *packet;
-
-       /* Current stream (NULL if not set yet) */
-       bt_stream *stream;
-
-       /* Current event (NULL if not created yet) */
-       bt_event *event;
-
-       /* Current event notification (NULL if not created yet) */
-       bt_notification *event_notif;
-
-       /* Database of current dynamic scopes */
-       struct {
-               bt_field *trace_packet_header;
-               bt_field *stream_packet_context;
-               bt_field *event_header;
-               bt_field *event_common_context;
-               bt_field *event_spec_context;
-               bt_field *event_payload;
-       } dscopes;
-
-       /* Current state */
-       enum state state;
-
-       /* Current medium buffer data */
-       struct {
-               /* Last address provided by medium */
-               const uint8_t *addr;
-
-               /* Buffer size provided by medium (bytes) */
-               size_t sz;
-
-               /* Offset within whole packet of addr (bits) */
-               size_t packet_offset;
-
-               /* Current position from addr (bits) */
-               size_t at;
-
-               /* Position of the last event header from addr (bits) */
-               size_t last_eh_at;
-       } buf;
-
-       /* Binary type reader */
-       struct bt_bfcr *bfcr;
-
-       /* Current medium data */
-       struct {
-               struct bt_notif_iter_medium_ops medops;
-               size_t max_request_sz;
-               void *data;
-       } medium;
-
-       /* Stream beginning was emitted */
-       bool stream_begin_emitted;
-
-       /* Current packet size (bits) (-1 if unknown) */
-       int64_t cur_exp_packet_total_size;
-
-       /* Current content size (bits) (-1 if unknown) */
-       int64_t cur_exp_packet_content_size;
-
-       /* Current stream class ID */
-       int64_t cur_stream_class_id;
-
-       /* Current event class ID */
-       int64_t cur_event_class_id;
-
-       /* Current data stream ID */
-       int64_t cur_data_stream_id;
-
-       /*
-        * Offset, in the underlying media, of the current packet's
-        * start (-1 if unknown).
-        */
-       off_t cur_packet_offset;
-
-       /* Default clock's current value */
-       uint64_t default_clock_val;
-
-       /* End of packet snapshots */
-       struct {
-               uint64_t discarded_events;
-               uint64_t packets;
-               uint64_t beginning_clock;
-               uint64_t end_clock;
-       } snapshots;
-
-       /* Stored values (for sequence lengths, variant tags) */
-       GArray *stored_values;
-};
-
-static inline
-const char *state_string(enum state state)
-{
-       switch (state) {
-       case STATE_INIT:
-               return "STATE_INIT";
-       case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
-               return "STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN";
-       case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
-               return "STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE";
-       case STATE_AFTER_TRACE_PACKET_HEADER:
-               return "STATE_AFTER_TRACE_PACKET_HEADER";
-       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
-               return "STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN";
-       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
-               return "STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE";
-       case STATE_AFTER_STREAM_PACKET_CONTEXT:
-               return "STATE_AFTER_STREAM_PACKET_CONTEXT";
-       case STATE_EMIT_NOTIF_NEW_PACKET:
-               return "STATE_EMIT_NOTIF_NEW_PACKET";
-       case STATE_EMIT_NOTIF_NEW_STREAM:
-               return "STATE_EMIT_NOTIF_NEW_STREAM";
-       case STATE_DSCOPE_EVENT_HEADER_BEGIN:
-               return "STATE_DSCOPE_EVENT_HEADER_BEGIN";
-       case STATE_DSCOPE_EVENT_HEADER_CONTINUE:
-               return "STATE_DSCOPE_EVENT_HEADER_CONTINUE";
-       case STATE_AFTER_EVENT_HEADER:
-               return "STATE_AFTER_EVENT_HEADER";
-       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN:
-               return "STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN";
-       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE:
-               return "STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE";
-       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN:
-               return "STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN";
-       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE:
-               return "STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE";
-       case STATE_DSCOPE_EVENT_PAYLOAD_BEGIN:
-               return "STATE_DSCOPE_EVENT_PAYLOAD_BEGIN";
-       case STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE:
-               return "STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE";
-       case STATE_EMIT_NOTIF_EVENT:
-               return "STATE_EMIT_NOTIF_EVENT";
-       case STATE_EMIT_NOTIF_END_OF_PACKET:
-               return "STATE_EMIT_NOTIF_END_OF_PACKET";
-       case STATE_DONE:
-               return "STATE_DONE";
-       case STATE_SKIP_PACKET_PADDING:
-               return "STATE_SKIP_PACKET_PADDING";
-       default:
-               return "(unknown)";
-       }
-}
-
-static
-int bt_notif_iter_switch_packet(struct bt_notif_iter *notit);
-
-static
-struct stack *stack_new(struct bt_notif_iter *notit)
-{
-       struct stack *stack = NULL;
-
-       stack = g_new0(struct stack, 1);
-       if (!stack) {
-               BT_LOGE_STR("Failed to allocate one stack.");
-               goto error;
-       }
-
-       stack->entries = g_array_new(FALSE, TRUE, sizeof(struct stack_entry));
-       if (!stack->entries) {
-               BT_LOGE_STR("Failed to allocate a GArray.");
-               goto error;
-       }
-
-       BT_LOGD("Created stack: notit-addr=%p, stack-addr=%p", notit, stack);
-       goto end;
-
-error:
-       g_free(stack);
-       stack = NULL;
-
-end:
-       return stack;
-}
-
-static
-void stack_destroy(struct stack *stack)
-{
-       BT_ASSERT(stack);
-       BT_LOGD("Destroying stack: addr=%p", stack);
-
-       if (stack->entries) {
-               g_array_free(stack->entries, TRUE);
-       }
-
-       g_free(stack);
-}
-
-static
-void stack_push(struct stack *stack, bt_field *base)
-{
-       struct stack_entry *entry;
-
-       BT_ASSERT(stack);
-       BT_ASSERT(base);
-       BT_LOGV("Pushing base field on stack: stack-addr=%p, "
-               "stack-size-before=%zu, stack-size-after=%zu",
-               stack, stack->size, stack->size + 1);
-
-       if (stack->entries->len == stack->size) {
-               g_array_set_size(stack->entries, stack->size + 1);
-       }
-
-       entry = &g_array_index(stack->entries, struct stack_entry, stack->size);
-       entry->base = base;
-       entry->index = 0;
-       stack->size++;
-}
-
-static inline
-unsigned int stack_size(struct stack *stack)
-{
-       BT_ASSERT(stack);
-       return stack->size;
-}
-
-static
-void stack_pop(struct stack *stack)
-{
-       BT_ASSERT(stack);
-       BT_ASSERT(stack_size(stack));
-       BT_LOGV("Popping from stack: "
-               "stack-addr=%p, stack-size-before=%zu, stack-size-after=%zu",
-               stack, stack->size, stack->size - 1);
-       stack->size--;
-}
-
-static inline
-struct stack_entry *stack_top(struct stack *stack)
-{
-       BT_ASSERT(stack);
-       BT_ASSERT(stack_size(stack));
-       return &g_array_index(stack->entries, struct stack_entry,
-               stack->size - 1);
-}
-
-static inline
-bool stack_empty(struct stack *stack)
-{
-       return stack_size(stack) == 0;
-}
-
-static
-void stack_clear(struct stack *stack)
-{
-       BT_ASSERT(stack);
-       stack->size = 0;
-}
-
-static inline
-enum bt_notif_iter_status notif_iter_status_from_m_status(
-               enum bt_notif_iter_medium_status m_status)
-{
-       /* They are the same */
-       return (int) m_status;
-}
-
-static inline
-size_t buf_size_bits(struct bt_notif_iter *notit)
-{
-       return notit->buf.sz * 8;
-}
-
-static inline
-size_t buf_available_bits(struct bt_notif_iter *notit)
-{
-       return buf_size_bits(notit) - notit->buf.at;
-}
-
-static inline
-size_t packet_at(struct bt_notif_iter *notit)
-{
-       return notit->buf.packet_offset + notit->buf.at;
-}
-
-static inline
-void buf_consume_bits(struct bt_notif_iter *notit, size_t incr)
-{
-       BT_LOGV("Advancing cursor: notit-addr=%p, cur-before=%zu, cur-after=%zu",
-               notit, notit->buf.at, notit->buf.at + incr);
-       notit->buf.at += incr;
-}
-
-static
-enum bt_notif_iter_status request_medium_bytes(
-               struct bt_notif_iter *notit)
-{
-       uint8_t *buffer_addr = NULL;
-       size_t buffer_sz = 0;
-       enum bt_notif_iter_medium_status m_status;
-
-       BT_LOGV("Calling user function (request bytes): notit-addr=%p, "
-               "request-size=%zu", notit, notit->medium.max_request_sz);
-       m_status = notit->medium.medops.request_bytes(
-               notit->medium.max_request_sz, &buffer_addr,
-               &buffer_sz, notit->medium.data);
-       BT_LOGV("User function returned: status=%s, buf-addr=%p, buf-size=%zu",
-               bt_notif_iter_medium_status_string(m_status),
-               buffer_addr, buffer_sz);
-       if (m_status == BT_NOTIF_ITER_MEDIUM_STATUS_OK) {
-               BT_ASSERT(buffer_sz != 0);
-
-               /* New packet offset is old one + old size (in bits) */
-               notit->buf.packet_offset += buf_size_bits(notit);
-
-               /* Restart at the beginning of the new medium buffer */
-               notit->buf.at = 0;
-               notit->buf.last_eh_at = SIZE_MAX;
-
-               /* New medium buffer size */
-               notit->buf.sz = buffer_sz;
-
-               /* New medium buffer address */
-               notit->buf.addr = buffer_addr;
-
-               BT_LOGV("User function returned new bytes: "
-                       "packet-offset=%zu, cur=%zu, size=%zu, addr=%p",
-                       notit->buf.packet_offset, notit->buf.at,
-                       notit->buf.sz, notit->buf.addr);
-               BT_LOGV_MEM(buffer_addr, buffer_sz, "Returned bytes at %p:",
-                       buffer_addr);
-       } else if (m_status == BT_NOTIF_ITER_MEDIUM_STATUS_EOF) {
-               /*
-                * User returned end of stream: validate that we're not
-                * in the middle of a packet header, packet context, or
-                * event.
-                */
-               if (notit->cur_exp_packet_total_size >= 0) {
-                       if (packet_at(notit) ==
-                                       notit->cur_exp_packet_total_size) {
-                               goto end;
-                       }
-               } else {
-                       if (packet_at(notit) == 0) {
-                               goto end;
-                       }
-
-                       if (notit->buf.last_eh_at != SIZE_MAX &&
-                                       notit->buf.at == notit->buf.last_eh_at) {
-                               goto end;
-                       }
-               }
-
-               /* All other states are invalid */
-               BT_LOGW("User function returned %s, but notification iterator is in an unexpected state: "
-                       "state=%s, cur-packet-size=%" PRId64 ", cur=%zu, "
-                       "packet-cur=%zu, last-eh-at=%zu",
-                       bt_notif_iter_medium_status_string(m_status),
-                       state_string(notit->state),
-                       notit->cur_exp_packet_total_size,
-                       notit->buf.at, packet_at(notit),
-                       notit->buf.last_eh_at);
-               m_status = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR;
-       } else if (m_status < 0) {
-               BT_LOGW("User function failed: status=%s",
-                       bt_notif_iter_medium_status_string(m_status));
-       }
-
-end:
-       return notif_iter_status_from_m_status(m_status);
-}
-
-static inline
-enum bt_notif_iter_status buf_ensure_available_bits(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-
-       if (unlikely(buf_available_bits(notit) == 0)) {
-               /*
-                * This _cannot_ return BT_NOTIF_ITER_STATUS_OK
-                * _and_ no bits.
-                */
-               status = request_medium_bytes(notit);
-       }
-
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_dscope_begin_state(
-               struct bt_notif_iter *notit,
-               struct ctf_field_class *dscope_fc,
-               enum state done_state, enum state continue_state,
-               bt_field *dscope_field)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       enum bt_bfcr_status bfcr_status;
-       size_t consumed_bits;
-
-       notit->cur_dscope_field = dscope_field;
-       BT_LOGV("Starting BFCR: notit-addr=%p, bfcr-addr=%p, fc-addr=%p",
-               notit, notit->bfcr, dscope_fc);
-       consumed_bits = bt_bfcr_start(notit->bfcr, dscope_fc,
-               notit->buf.addr, notit->buf.at, packet_at(notit),
-               notit->buf.sz, &bfcr_status);
-       BT_LOGV("BFCR consumed bits: size=%zu", consumed_bits);
-
-       switch (bfcr_status) {
-       case BT_BFCR_STATUS_OK:
-               /* Field class was read completely */
-               BT_LOGV_STR("Field was completely decoded.");
-               notit->state = done_state;
-               break;
-       case BT_BFCR_STATUS_EOF:
-               BT_LOGV_STR("BFCR needs more data to decode field completely.");
-               notit->state = continue_state;
-               break;
-       default:
-               BT_LOGW("BFCR failed to start: notit-addr=%p, bfcr-addr=%p, "
-                       "status=%s", notit, notit->bfcr,
-                       bt_bfcr_status_string(bfcr_status));
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       /* Consume bits now since we know we're not in an error state */
-       buf_consume_bits(notit, consumed_bits);
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_dscope_continue_state(
-               struct bt_notif_iter *notit, enum state done_state)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       enum bt_bfcr_status bfcr_status;
-       size_t consumed_bits;
-
-       BT_LOGV("Continuing BFCR: notit-addr=%p, bfcr-addr=%p",
-               notit, notit->bfcr);
-
-       status = buf_ensure_available_bits(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               if (status < 0) {
-                       BT_LOGW("Cannot ensure that buffer has at least one byte: "
-                               "notif-addr=%p, status=%s",
-                               notit, bt_notif_iter_status_string(status));
-               } else {
-                       BT_LOGV("Cannot ensure that buffer has at least one byte: "
-                               "notif-addr=%p, status=%s",
-                               notit, bt_notif_iter_status_string(status));
-               }
-
-               goto end;
-       }
-
-       consumed_bits = bt_bfcr_continue(notit->bfcr, notit->buf.addr,
-               notit->buf.sz, &bfcr_status);
-       BT_LOGV("BFCR consumed bits: size=%zu", consumed_bits);
-
-       switch (bfcr_status) {
-       case BT_BFCR_STATUS_OK:
-               /* Type was read completely. */
-               BT_LOGV_STR("Field was completely decoded.");
-               notit->state = done_state;
-               break;
-       case BT_BFCR_STATUS_EOF:
-               /* Stay in this continue state. */
-               BT_LOGV_STR("BFCR needs more data to decode field completely.");
-               break;
-       default:
-               BT_LOGW("BFCR failed to continue: notit-addr=%p, bfcr-addr=%p, "
-                       "status=%s", notit, notit->bfcr,
-                       bt_bfcr_status_string(bfcr_status));
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       /* Consume bits now since we know we're not in an error state. */
-       buf_consume_bits(notit, consumed_bits);
-end:
-       return status;
-}
-
-static
-void release_event_dscopes(struct bt_notif_iter *notit)
-{
-       notit->dscopes.event_header = NULL;
-
-       if (notit->event_header_field) {
-               bt_event_header_field_release(notit->event_header_field);
-               notit->event_header_field = NULL;
-       }
-
-       notit->dscopes.event_common_context = NULL;
-       notit->dscopes.event_spec_context = NULL;
-       notit->dscopes.event_payload = NULL;
-}
-
-static
-void release_all_dscopes(struct bt_notif_iter *notit)
-{
-       notit->dscopes.trace_packet_header = NULL;
-
-       if (notit->packet_header_field) {
-               bt_packet_header_field_release(notit->packet_header_field);
-               notit->packet_header_field = NULL;
-       }
-
-       notit->dscopes.stream_packet_context = NULL;
-
-       if (notit->packet_context_field) {
-               bt_packet_context_field_release(notit->packet_context_field);
-               notit->packet_context_field = NULL;
-       }
-
-       release_event_dscopes(notit);
-}
-
-static
-enum bt_notif_iter_status read_packet_header_begin_state(
-               struct bt_notif_iter *notit)
-{
-       struct ctf_field_class *packet_header_fc = NULL;
-       enum bt_notif_iter_status ret = BT_NOTIF_ITER_STATUS_OK;
-
-       if (bt_notif_iter_switch_packet(notit)) {
-               BT_LOGW("Cannot switch packet: notit-addr=%p", notit);
-               ret = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       /* Packet header class is common to the whole trace class. */
-       packet_header_fc = notit->meta.tc->packet_header_fc;
-       if (!packet_header_fc) {
-               notit->state = STATE_AFTER_TRACE_PACKET_HEADER;
-               goto end;
-       }
-
-       BT_ASSERT(!notit->packet_header_field);
-
-       if (packet_header_fc->in_ir) {
-               /*
-                * Create free packet header field from trace class.
-                * This field is going to be moved to the packet once we
-                * create it. We cannot create the packet now because:
-                *
-                * 1. A packet is created from a stream.
-                * 2. A stream is created from a stream class.
-                * 3. We need the packet header field's content to know
-                *    the ID of the stream class to select.
-                */
-               notit->packet_header_field =
-                       bt_packet_header_field_create(
-                               notit->meta.tc->ir_tc);
-               if (!notit->packet_header_field) {
-                       BT_LOGE_STR("Cannot create packet header field wrapper from trace class.");
-                       ret = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               notit->dscopes.trace_packet_header =
-                       bt_packet_header_field_borrow_field(
-                               notit->packet_header_field);
-               BT_ASSERT(notit->dscopes.trace_packet_header);
-       }
-
-       notit->cur_stream_class_id = -1;
-       notit->cur_event_class_id = -1;
-       notit->cur_data_stream_id = -1;
-       BT_LOGV("Decoding packet header field:"
-               "notit-addr=%p, trace-class-addr=%p, fc-addr=%p",
-               notit, notit->meta.tc, packet_header_fc);
-       ret = read_dscope_begin_state(notit, packet_header_fc,
-               STATE_AFTER_TRACE_PACKET_HEADER,
-               STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
-               notit->dscopes.trace_packet_header);
-       if (ret < 0) {
-               BT_LOGW("Cannot decode packet header field: "
-                       "notit-addr=%p, trace-class-addr=%p, "
-                       "fc-addr=%p",
-                       notit, notit->meta.tc, packet_header_fc);
-       }
-
-end:
-       return ret;
-}
-
-static
-enum bt_notif_iter_status read_packet_header_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit,
-               STATE_AFTER_TRACE_PACKET_HEADER);
-}
-
-static inline
-enum bt_notif_iter_status set_current_stream_class(struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_stream_class *new_stream_class = NULL;
-
-       if (notit->cur_stream_class_id == -1) {
-               /*
-                * No current stream class ID field, therefore only one
-                * stream class.
-                */
-               if (notit->meta.tc->stream_classes->len != 1) {
-                       BT_LOGW("Need exactly one stream class since there's "
-                               "no stream class ID field: "
-                               "notit-addr=%p", notit);
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               new_stream_class = notit->meta.tc->stream_classes->pdata[0];
-               notit->cur_stream_class_id = new_stream_class->id;
-       }
-
-       new_stream_class = ctf_trace_class_borrow_stream_class_by_id(
-               notit->meta.tc, notit->cur_stream_class_id);
-       if (!new_stream_class) {
-               BT_LOGW("No stream class with ID of stream class ID to use in trace class: "
-                       "notit-addr=%p, stream-class-id=%" PRIu64 ", "
-                       "trace-class-addr=%p",
-                       notit, notit->cur_stream_class_id, notit->meta.tc);
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       if (notit->meta.sc) {
-               if (new_stream_class != notit->meta.sc) {
-                       BT_LOGW("Two packets refer to two different stream classes within the same packet sequence: "
-                               "notit-addr=%p, prev-stream-class-addr=%p, "
-                               "prev-stream-class-id=%" PRId64 ", "
-                               "next-stream-class-addr=%p, "
-                               "next-stream-class-id=%" PRId64 ", "
-                               "trace-addr=%p",
-                               notit, notit->meta.sc,
-                               notit->meta.sc->id,
-                               new_stream_class,
-                               new_stream_class->id,
-                               notit->meta.tc);
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-       } else {
-               notit->meta.sc = new_stream_class;
-       }
-
-       BT_LOGV("Set current stream class: "
-               "notit-addr=%p, stream-class-addr=%p, "
-               "stream-class-id=%" PRId64,
-               notit, notit->meta.sc, notit->meta.sc->id);
-
-end:
-       return status;
-}
-
-static inline
-enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       bt_stream *stream = NULL;
-
-       BT_LOGV("Calling user function (get stream): notit-addr=%p, "
-               "stream-class-addr=%p, stream-class-id=%" PRId64,
-               notit, notit->meta.sc,
-               notit->meta.sc->id);
-       stream = notit->medium.medops.borrow_stream(
-               notit->meta.sc->ir_sc, notit->cur_data_stream_id,
-               notit->medium.data);
-       bt_stream_get_ref(stream);
-       BT_LOGV("User function returned: stream-addr=%p", stream);
-       if (!stream) {
-               BT_LOGW_STR("User function failed to return a stream object "
-                       "for the given stream class.");
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       if (notit->stream && stream != notit->stream) {
-               BT_LOGW("User function returned a different stream than the "
-                       "previous one for the same sequence of packets.");
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       BT_STREAM_MOVE_REF(notit->stream, stream);
-
-end:
-       bt_stream_put_ref(stream);
-       return status;
-}
-
-static inline
-enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       bt_packet *packet = NULL;
-
-       BT_LOGV("Creating packet for packet notification: "
-               "notit-addr=%p", notit);
-       BT_LOGV("Creating packet from stream: "
-               "notit-addr=%p, stream-addr=%p, "
-               "stream-class-addr=%p, "
-               "stream-class-id=%" PRId64,
-               notit, notit->stream, notit->meta.sc,
-               notit->meta.sc->id);
-
-       /* Create packet */
-       BT_ASSERT(notit->stream);
-       packet = bt_packet_create(notit->stream);
-       if (!packet) {
-               BT_LOGE("Cannot create packet from stream: "
-                       "notit-addr=%p, stream-addr=%p, "
-                       "stream-class-addr=%p, "
-                       "stream-class-id=%" PRId64,
-                       notit, notit->stream, notit->meta.sc,
-                       notit->meta.sc->id);
-               goto error;
-       }
-
-       goto end;
-
-error:
-       BT_PACKET_PUT_REF_AND_RESET(packet);
-       status = BT_NOTIF_ITER_STATUS_ERROR;
-
-end:
-       BT_PACKET_MOVE_REF(notit->packet, packet);
-       return status;
-}
-
-static
-enum bt_notif_iter_status after_packet_header_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status;
-
-       status = set_current_stream_class(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               goto end;
-       }
-
-       notit->state = STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN;
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_packet_context_begin_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_field_class *packet_context_fc;
-
-       BT_ASSERT(notit->meta.sc);
-       packet_context_fc = notit->meta.sc->packet_context_fc;
-       if (!packet_context_fc) {
-               BT_LOGV("No packet packet context field class in stream class: continuing: "
-                       "notit-addr=%p, stream-class-addr=%p, "
-                       "stream-class-id=%" PRId64,
-                       notit, notit->meta.sc,
-                       notit->meta.sc->id);
-               notit->state = STATE_AFTER_STREAM_PACKET_CONTEXT;
-               goto end;
-       }
-
-       BT_ASSERT(!notit->packet_context_field);
-
-       if (packet_context_fc->in_ir) {
-               /*
-                * Create free packet context field from stream class.
-                * This field is going to be moved to the packet once we
-                * create it. We cannot create the packet now because a
-                * packet is created from a stream, and this API must be
-                * able to return the packet header and context fields
-                * without creating a stream
-                * (bt_notif_iter_borrow_packet_header_context_fields()).
-                */
-               notit->packet_context_field =
-                       bt_packet_context_field_create(
-                               notit->meta.sc->ir_sc);
-               if (!notit->packet_context_field) {
-                       BT_LOGE_STR("Cannot create packet context field wrapper from stream class.");
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               notit->dscopes.stream_packet_context =
-                       bt_packet_context_field_borrow_field(
-                               notit->packet_context_field);
-               BT_ASSERT(notit->dscopes.stream_packet_context);
-       }
-
-       BT_LOGV("Decoding packet context field: "
-               "notit-addr=%p, stream-class-addr=%p, "
-               "stream-class-id=%" PRId64 ", fc-addr=%p",
-               notit, notit->meta.sc,
-               notit->meta.sc->id, packet_context_fc);
-       status = read_dscope_begin_state(notit, packet_context_fc,
-               STATE_AFTER_STREAM_PACKET_CONTEXT,
-               STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE,
-               notit->dscopes.stream_packet_context);
-       if (status < 0) {
-               BT_LOGW("Cannot decode packet context field: "
-                       "notit-addr=%p, stream-class-addr=%p, "
-                       "stream-class-id=%" PRId64 ", fc-addr=%p",
-                       notit, notit->meta.sc,
-                       notit->meta.sc->id,
-                       packet_context_fc);
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_packet_context_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit,
-                       STATE_AFTER_STREAM_PACKET_CONTEXT);
-}
-
-static
-enum bt_notif_iter_status set_current_packet_content_sizes(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-
-       if (notit->cur_exp_packet_total_size == -1) {
-               if (notit->cur_exp_packet_content_size != -1) {
-                       BT_LOGW("Content size is set, but packet size is not: "
-                               "notit-addr=%p, packet-context-field-addr=%p, "
-                               "packet-size=%" PRId64 ", content-size=%" PRId64,
-                               notit, notit->dscopes.stream_packet_context,
-                               notit->cur_exp_packet_total_size,
-                               notit->cur_exp_packet_content_size);
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-       } else {
-               if (notit->cur_exp_packet_content_size == -1) {
-                       notit->cur_exp_packet_content_size =
-                               notit->cur_exp_packet_total_size;
-               }
-       }
-
-       if (notit->cur_exp_packet_content_size >
-                       notit->cur_exp_packet_total_size) {
-               BT_LOGW("Invalid packet or content size: "
-                       "content size is greater than packet size: "
-                       "notit-addr=%p, packet-context-field-addr=%p, "
-                       "packet-size=%" PRId64 ", content-size=%" PRId64,
-                       notit, notit->dscopes.stream_packet_context,
-                       notit->cur_exp_packet_total_size,
-                       notit->cur_exp_packet_content_size);
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       BT_LOGV("Set current packet and content sizes: "
-               "notit-addr=%p, packet-size=%" PRIu64 ", content-size=%" PRIu64,
-               notit, notit->cur_exp_packet_total_size,
-               notit->cur_exp_packet_content_size);
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status after_packet_context_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status;
-
-       status = set_current_packet_content_sizes(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               goto end;
-       }
-
-       if (notit->stream_begin_emitted) {
-               notit->state = STATE_EMIT_NOTIF_NEW_PACKET;
-       } else {
-               notit->state = STATE_EMIT_NOTIF_NEW_STREAM;
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_header_begin_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_field_class *event_header_fc = NULL;
-
-       /* Reset the position of the last event header */
-       notit->buf.last_eh_at = notit->buf.at;
-       notit->cur_event_class_id = -1;
-
-       /* Check if we have some content left */
-       if (notit->cur_exp_packet_content_size >= 0) {
-               if (unlikely(packet_at(notit) ==
-                               notit->cur_exp_packet_content_size)) {
-                       /* No more events! */
-                       BT_LOGV("Reached end of packet: notit-addr=%p, "
-                               "cur=%zu", notit, packet_at(notit));
-                       notit->state = STATE_EMIT_NOTIF_END_OF_PACKET;
-                       goto end;
-               } else if (unlikely(packet_at(notit) >
-                               notit->cur_exp_packet_content_size)) {
-                       /* That's not supposed to happen */
-                       BT_LOGV("Before decoding event header field: cursor is passed the packet's content: "
-                               "notit-addr=%p, content-size=%" PRId64 ", "
-                               "cur=%zu", notit,
-                               notit->cur_exp_packet_content_size,
-                               packet_at(notit));
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-       } else {
-               /*
-                * "Infinite" content: we're done when the medium has
-                * nothing else for us.
-                */
-               status = buf_ensure_available_bits(notit);
-               if (status != BT_NOTIF_ITER_STATUS_OK) {
-                       /*
-                        * If this function returns
-                        * `BT_NOTIF_ITER_STATUS_EOF`:
-                        *
-                        * 1. bt_notif_iter_get_next_notification()
-                        *    emits a "packet end" notification. This
-                        *    resets the current packet. The state
-                        *    remains unchanged otherwise.
-                        * 2. This function is called again. It returns
-                        *    `BT_NOTIF_ITER_STATUS_EOF` again.
-                        * 3. bt_notif_iter_get_next_notification()
-                        *    emits a "stream end" notification because
-                        *    there's no current packet. It sets the
-                        *    current state to `STATE_DONE`.
-                        */
-                       goto end;
-               }
-       }
-
-       release_event_dscopes(notit);
-       BT_ASSERT(notit->meta.sc);
-       event_header_fc = notit->meta.sc->event_header_fc;
-       if (!event_header_fc) {
-               notit->state = STATE_AFTER_EVENT_HEADER;
-               goto end;
-       }
-
-       if (event_header_fc->in_ir) {
-               BT_ASSERT(!notit->event_header_field);
-               notit->event_header_field =
-                       bt_event_header_field_create(
-                               notit->meta.sc->ir_sc);
-               if (!notit->event_header_field) {
-                       BT_LOGE_STR("Cannot create event header field wrapper from trace class.");
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               notit->dscopes.event_header =
-                       bt_event_header_field_borrow_field(
-                               notit->event_header_field);
-               BT_ASSERT(notit->dscopes.event_header);
-       }
-
-       BT_LOGV("Decoding event header field: "
-               "notit-addr=%p, stream-class-addr=%p, "
-               "stream-class-id=%" PRId64 ", "
-               "fc-addr=%p",
-               notit, notit->meta.sc,
-               notit->meta.sc->id,
-               event_header_fc);
-       status = read_dscope_begin_state(notit, event_header_fc,
-               STATE_AFTER_EVENT_HEADER,
-               STATE_DSCOPE_EVENT_HEADER_CONTINUE,
-               notit->dscopes.event_header);
-       if (status < 0) {
-               BT_LOGW("Cannot decode event header field: "
-                       "notit-addr=%p, stream-class-addr=%p, "
-                       "stream-class-id=%" PRId64 ", fc-addr=%p",
-                       notit, notit->meta.sc,
-                       notit->meta.sc->id,
-                       event_header_fc);
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_header_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit,
-               STATE_AFTER_EVENT_HEADER);
-}
-
-static inline
-enum bt_notif_iter_status set_current_event_class(struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-
-       struct ctf_event_class *new_event_class = NULL;
-
-       if (notit->cur_event_class_id == -1) {
-               /*
-                * No current event class ID field, therefore only one
-                * event class.
-                */
-               if (notit->meta.sc->event_classes->len != 1) {
-                       BT_LOGW("Need exactly one event class since there's "
-                               "no event class ID field: "
-                               "notit-addr=%p", notit);
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               new_event_class = notit->meta.sc->event_classes->pdata[0];
-               notit->cur_event_class_id = new_event_class->id;
-       }
-
-       new_event_class = ctf_stream_class_borrow_event_class_by_id(
-               notit->meta.sc, notit->cur_event_class_id);
-       if (!new_event_class) {
-               BT_LOGW("No event class with ID of event class ID to use in stream class: "
-                       "notit-addr=%p, stream-class-id=%" PRIu64 ", "
-                       "event-class-id=%" PRIu64 ", "
-                       "trace-class-addr=%p",
-                       notit, notit->meta.sc->id, notit->cur_event_class_id,
-                       notit->meta.tc);
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       notit->meta.ec = new_event_class;
-       BT_LOGV("Set current event class: "
-               "notit-addr=%p, event-class-addr=%p, "
-               "event-class-id=%" PRId64 ", "
-               "event-class-name=\"%s\"",
-               notit, notit->meta.ec, notit->meta.ec->id,
-               notit->meta.ec->name->str);
-
-end:
-       return status;
-}
-
-static inline
-enum bt_notif_iter_status set_current_event_notification(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       bt_notification *notif = NULL;
-
-       BT_ASSERT(notit->meta.ec);
-       BT_ASSERT(notit->packet);
-       BT_LOGV("Creating event notification from event class and packet: "
-               "notit-addr=%p, ec-addr=%p, ec-name=\"%s\", packet-addr=%p",
-               notit, notit->meta.ec,
-               notit->meta.ec->name->str,
-               notit->packet);
-       BT_ASSERT(notit->notif_iter);
-       notif = bt_notification_event_create(notit->notif_iter,
-               notit->meta.ec->ir_ec, notit->packet);
-       if (!notif) {
-               BT_LOGE("Cannot create event notification: "
-                       "notit-addr=%p, ec-addr=%p, ec-name=\"%s\", "
-                       "packet-addr=%p",
-                       notit, notit->meta.ec,
-                       notit->meta.ec->name->str,
-                       notit->packet);
-               goto error;
-       }
-
-       goto end;
-
-error:
-       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
-       status = BT_NOTIF_ITER_STATUS_ERROR;
-
-end:
-       BT_NOTIFICATION_MOVE_REF(notit->event_notif, notif);
-       return status;
-}
-
-static
-enum bt_notif_iter_status after_event_header_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status;
-
-       status = set_current_event_class(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               goto end;
-       }
-
-       status = set_current_event_notification(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               goto end;
-       }
-
-       notit->event = bt_notification_event_borrow_event(
-               notit->event_notif);
-       BT_ASSERT(notit->event);
-
-       if (notit->event_header_field) {
-               int ret;
-
-               BT_ASSERT(notit->event);
-               ret = bt_event_move_header_field(notit->event,
-                       notit->event_header_field);
-               if (ret) {
-                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-
-               notit->event_header_field = NULL;
-
-               /*
-                * At this point notit->dscopes.event_header has
-                * the same value as the event header field within
-                * notit->event.
-                */
-               BT_ASSERT(bt_event_borrow_header_field(
-                       notit->event) == notit->dscopes.event_header);
-       }
-
-       notit->state = STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN;
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_common_context_begin_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_field_class *event_common_context_fc;
-
-       event_common_context_fc = notit->meta.sc->event_common_context_fc;
-       if (!event_common_context_fc) {
-               notit->state = STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN;
-               goto end;
-       }
-
-       if (event_common_context_fc->in_ir) {
-               BT_ASSERT(!notit->dscopes.event_common_context);
-               notit->dscopes.event_common_context =
-                       bt_event_borrow_common_context_field(
-                               notit->event);
-               BT_ASSERT(notit->dscopes.event_common_context);
-       }
-
-       BT_LOGV("Decoding event common context field: "
-               "notit-addr=%p, stream-class-addr=%p, "
-               "stream-class-id=%" PRId64 ", "
-               "fc-addr=%p",
-               notit, notit->meta.sc,
-               notit->meta.sc->id,
-               event_common_context_fc);
-       status = read_dscope_begin_state(notit, event_common_context_fc,
-               STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN,
-               STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE,
-               notit->dscopes.event_common_context);
-       if (status < 0) {
-               BT_LOGW("Cannot decode event common context field: "
-                       "notit-addr=%p, stream-class-addr=%p, "
-                       "stream-class-id=%" PRId64 ", fc-addr=%p",
-                       notit, notit->meta.sc,
-                       notit->meta.sc->id,
-                       event_common_context_fc);
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_common_context_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit,
-               STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN);
-}
-
-static
-enum bt_notif_iter_status read_event_spec_context_begin_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_field_class *event_spec_context_fc;
-
-       event_spec_context_fc = notit->meta.ec->spec_context_fc;
-       if (!event_spec_context_fc) {
-               notit->state = STATE_DSCOPE_EVENT_PAYLOAD_BEGIN;
-               goto end;
-       }
-
-       if (event_spec_context_fc->in_ir) {
-               BT_ASSERT(!notit->dscopes.event_spec_context);
-               notit->dscopes.event_spec_context =
-                       bt_event_borrow_specific_context_field(
-                               notit->event);
-               BT_ASSERT(notit->dscopes.event_spec_context);
-       }
-
-       BT_LOGV("Decoding event specific context field: "
-               "notit-addr=%p, event-class-addr=%p, "
-               "event-class-name=\"%s\", event-class-id=%" PRId64 ", "
-               "fc-addr=%p",
-               notit, notit->meta.ec,
-               notit->meta.ec->name->str,
-               notit->meta.ec->id,
-               event_spec_context_fc);
-       status = read_dscope_begin_state(notit, event_spec_context_fc,
-               STATE_DSCOPE_EVENT_PAYLOAD_BEGIN,
-               STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE,
-               notit->dscopes.event_spec_context);
-       if (status < 0) {
-               BT_LOGW("Cannot decode event specific context field: "
-                       "notit-addr=%p, event-class-addr=%p, "
-                       "event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64 ", fc-addr=%p",
-                       notit, notit->meta.ec,
-                       notit->meta.ec->name->str,
-                       notit->meta.ec->id,
-                       event_spec_context_fc);
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_spec_context_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit,
-               STATE_DSCOPE_EVENT_PAYLOAD_BEGIN);
-}
-
-static
-enum bt_notif_iter_status read_event_payload_begin_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct ctf_field_class *event_payload_fc;
-
-       event_payload_fc = notit->meta.ec->payload_fc;
-       if (!event_payload_fc) {
-               notit->state = STATE_EMIT_NOTIF_EVENT;
-               goto end;
-       }
-
-       if (event_payload_fc->in_ir) {
-               BT_ASSERT(!notit->dscopes.event_payload);
-               notit->dscopes.event_payload =
-                       bt_event_borrow_payload_field(
-                               notit->event);
-               BT_ASSERT(notit->dscopes.event_payload);
-       }
-
-       BT_LOGV("Decoding event payload field: "
-               "notit-addr=%p, event-class-addr=%p, "
-               "event-class-name=\"%s\", event-class-id=%" PRId64 ", "
-               "fc-addr=%p",
-               notit, notit->meta.ec,
-               notit->meta.ec->name->str,
-               notit->meta.ec->id,
-               event_payload_fc);
-       status = read_dscope_begin_state(notit, event_payload_fc,
-               STATE_EMIT_NOTIF_EVENT,
-               STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE,
-               notit->dscopes.event_payload);
-       if (status < 0) {
-               BT_LOGW("Cannot decode event payload field: "
-                       "notit-addr=%p, event-class-addr=%p, "
-                       "event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64 ", fc-addr=%p",
-                       notit, notit->meta.ec,
-                       notit->meta.ec->name->str,
-                       notit->meta.ec->id,
-                       event_payload_fc);
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_notif_iter_status read_event_payload_continue_state(
-               struct bt_notif_iter *notit)
-{
-       return read_dscope_continue_state(notit, STATE_EMIT_NOTIF_EVENT);
-}
-
-static
-enum bt_notif_iter_status skip_packet_padding_state(
-               struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       size_t bits_to_skip;
-
-       BT_ASSERT(notit->cur_exp_packet_total_size > 0);
-       bits_to_skip = notit->cur_exp_packet_total_size - packet_at(notit);
-       if (bits_to_skip == 0) {
-               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
-               goto end;
-       } else {
-               size_t bits_to_consume;
-
-               BT_LOGV("Trying to skip %zu bits of padding: notit-addr=%p, size=%zu",
-                       bits_to_skip, notit, bits_to_skip);
-               status = buf_ensure_available_bits(notit);
-               if (status != BT_NOTIF_ITER_STATUS_OK) {
-                       goto end;
-               }
-
-               bits_to_consume = MIN(buf_available_bits(notit), bits_to_skip);
-               BT_LOGV("Skipping %zu bits of padding: notit-addr=%p, size=%zu",
-                       bits_to_consume, notit, bits_to_consume);
-               buf_consume_bits(notit, bits_to_consume);
-               bits_to_skip = notit->cur_exp_packet_total_size -
-                       packet_at(notit);
-               if (bits_to_skip == 0) {
-                       notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
-                       goto end;
-               }
-       }
-
-end:
-       return status;
-}
-
-static inline
-enum bt_notif_iter_status handle_state(struct bt_notif_iter *notit)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       const enum state state = notit->state;
-
-       BT_LOGV("Handling state: notit-addr=%p, state=%s",
-               notit, state_string(state));
-
-       // TODO: optimalize!
-       switch (state) {
-       case STATE_INIT:
-               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
-               break;
-       case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
-               status = read_packet_header_begin_state(notit);
-               break;
-       case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
-               status = read_packet_header_continue_state(notit);
-               break;
-       case STATE_AFTER_TRACE_PACKET_HEADER:
-               status = after_packet_header_state(notit);
-               break;
-       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
-               status = read_packet_context_begin_state(notit);
-               break;
-       case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
-               status = read_packet_context_continue_state(notit);
-               break;
-       case STATE_AFTER_STREAM_PACKET_CONTEXT:
-               status = after_packet_context_state(notit);
-               break;
-       case STATE_EMIT_NOTIF_NEW_STREAM:
-               notit->state = STATE_EMIT_NOTIF_NEW_PACKET;
-               break;
-       case STATE_EMIT_NOTIF_NEW_PACKET:
-               notit->state = STATE_DSCOPE_EVENT_HEADER_BEGIN;
-               break;
-       case STATE_DSCOPE_EVENT_HEADER_BEGIN:
-               status = read_event_header_begin_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_HEADER_CONTINUE:
-               status = read_event_header_continue_state(notit);
-               break;
-       case STATE_AFTER_EVENT_HEADER:
-               status = after_event_header_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN:
-               status = read_event_common_context_begin_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE:
-               status = read_event_common_context_continue_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN:
-               status = read_event_spec_context_begin_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE:
-               status = read_event_spec_context_continue_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_PAYLOAD_BEGIN:
-               status = read_event_payload_begin_state(notit);
-               break;
-       case STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE:
-               status = read_event_payload_continue_state(notit);
-               break;
-       case STATE_EMIT_NOTIF_EVENT:
-               notit->state = STATE_DSCOPE_EVENT_HEADER_BEGIN;
-               break;
-       case STATE_SKIP_PACKET_PADDING:
-               status = skip_packet_padding_state(notit);
-               break;
-       case STATE_EMIT_NOTIF_END_OF_PACKET:
-               notit->state = STATE_SKIP_PACKET_PADDING;
-               break;
-       default:
-               BT_LOGD("Unknown CTF plugin notification iterator state: "
-                       "notit-addr=%p, state=%d", notit, notit->state);
-               abort();
-       }
-
-       BT_LOGV("Handled state: notit-addr=%p, status=%s, "
-               "prev-state=%s, cur-state=%s",
-               notit, bt_notif_iter_status_string(status),
-               state_string(state), state_string(notit->state));
-       return status;
-}
-
-/**
- * Resets the internal state of a CTF notification iterator.
- */
-BT_HIDDEN
-void bt_notif_iter_reset(struct bt_notif_iter *notit)
-{
-       BT_ASSERT(notit);
-       BT_LOGD("Resetting notification iterator: addr=%p", notit);
-       stack_clear(notit->stack);
-       notit->meta.sc = NULL;
-       notit->meta.ec = NULL;
-       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
-       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
-       BT_NOTIFICATION_PUT_REF_AND_RESET(notit->event_notif);
-       release_all_dscopes(notit);
-       notit->cur_dscope_field = NULL;
-
-       if (notit->packet_header_field) {
-               bt_packet_header_field_release(notit->packet_header_field);
-               notit->packet_header_field = NULL;
-       }
-
-       if (notit->packet_context_field) {
-               bt_packet_context_field_release(notit->packet_context_field);
-               notit->packet_context_field = NULL;
-       }
-
-       if (notit->event_header_field) {
-               bt_event_header_field_release(notit->event_header_field);
-               notit->event_header_field = NULL;
-       }
-
-       notit->buf.addr = NULL;
-       notit->buf.sz = 0;
-       notit->buf.at = 0;
-       notit->buf.last_eh_at = SIZE_MAX;
-       notit->buf.packet_offset = 0;
-       notit->state = STATE_INIT;
-       notit->cur_exp_packet_content_size = -1;
-       notit->cur_exp_packet_total_size = -1;
-       notit->cur_packet_offset = -1;
-       notit->cur_stream_class_id = -1;
-       notit->cur_event_class_id = -1;
-       notit->cur_data_stream_id = -1;
-       notit->stream_begin_emitted = false;
-}
-
-static
-int bt_notif_iter_switch_packet(struct bt_notif_iter *notit)
-{
-       int ret = 0;
-
-       /*
-        * We don't put the stream class here because we need to make
-        * sure that all the packets processed by the same notification
-        * iterator refer to the same stream class (the first one).
-        */
-       BT_ASSERT(notit);
-
-       if (notit->cur_exp_packet_total_size != -1) {
-               notit->cur_packet_offset += notit->cur_exp_packet_total_size;
-       }
-
-       BT_LOGV("Switching packet: notit-addr=%p, cur=%zu, "
-               "packet-offset=%" PRId64, notit, notit->buf.at,
-               notit->cur_packet_offset);
-       stack_clear(notit->stack);
-       notit->meta.ec = NULL;
-       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
-       BT_NOTIFICATION_PUT_REF_AND_RESET(notit->event_notif);
-       release_all_dscopes(notit);
-       notit->cur_dscope_field = NULL;
-
-       /*
-        * Adjust current buffer so that addr points to the beginning of the new
-        * packet.
-        */
-       if (notit->buf.addr) {
-               size_t consumed_bytes = (size_t) (notit->buf.at / CHAR_BIT);
-
-               /* Packets are assumed to start on a byte frontier. */
-               if (notit->buf.at % CHAR_BIT) {
-                       BT_LOGW("Cannot switch packet: current position is not a multiple of 8: "
-                               "notit-addr=%p, cur=%zu", notit, notit->buf.at);
-                       ret = -1;
-                       goto end;
-               }
-
-               notit->buf.addr += consumed_bytes;
-               notit->buf.sz -= consumed_bytes;
-               notit->buf.at = 0;
-               notit->buf.packet_offset = 0;
-               BT_LOGV("Adjusted buffer: addr=%p, size=%zu",
-                       notit->buf.addr, notit->buf.sz);
-       }
-
-       notit->cur_exp_packet_content_size = -1;
-       notit->cur_exp_packet_total_size = -1;
-       notit->cur_stream_class_id = -1;
-       notit->cur_event_class_id = -1;
-       notit->cur_data_stream_id = -1;
-       notit->snapshots.discarded_events = UINT64_C(-1);
-       notit->snapshots.packets = UINT64_C(-1);
-       notit->snapshots.beginning_clock = UINT64_C(-1);
-       notit->snapshots.end_clock = UINT64_C(-1);
-
-end:
-       return ret;
-}
-
-static
-bt_field *borrow_next_field(struct bt_notif_iter *notit)
-{
-       bt_field *next_field = NULL;
-       bt_field *base_field;
-       const bt_field_class *base_fc;
-       size_t index;
-
-       BT_ASSERT(!stack_empty(notit->stack));
-       index = stack_top(notit->stack)->index;
-       base_field = stack_top(notit->stack)->base;
-       BT_ASSERT(base_field);
-       base_fc = bt_field_borrow_class_const(base_field);
-       BT_ASSERT(base_fc);
-
-       switch (bt_field_class_get_type(base_fc)) {
-       case BT_FIELD_CLASS_TYPE_STRUCTURE:
-       {
-               BT_ASSERT(index <
-                       bt_field_class_structure_get_member_count(
-                               bt_field_borrow_class_const(
-                                               base_field)));
-               next_field =
-                       bt_field_structure_borrow_member_field_by_index(
-                               base_field, index);
-               break;
-       }
-       case BT_FIELD_CLASS_TYPE_STATIC_ARRAY:
-       case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY:
-               BT_ASSERT(index < bt_field_array_get_length(base_field));
-               next_field = bt_field_array_borrow_element_field_by_index(
-                       base_field, index);
-               break;
-       case BT_FIELD_CLASS_TYPE_VARIANT:
-               BT_ASSERT(index == 0);
-               next_field = bt_field_variant_borrow_selected_option_field(
-                       base_field);
-               break;
-       default:
-               abort();
-       }
-
-       BT_ASSERT(next_field);
-       return next_field;
-}
-
-static
-void update_default_clock(struct bt_notif_iter *notit, uint64_t new_val,
-               uint64_t new_val_size)
-{
-       uint64_t new_val_mask;
-       uint64_t cur_value_masked;
-
-       BT_ASSERT(new_val_size > 0);
-
-       /*
-        * Special case for a 64-bit new value, which is the limit
-        * of a clock value as of this version: overwrite the
-        * current value directly.
-        */
-       if (new_val_size == 64) {
-               notit->default_clock_val = new_val;
-               goto end;
-       }
-
-       new_val_mask = (1ULL << new_val_size) - 1;
-       cur_value_masked = notit->default_clock_val & new_val_mask;
-
-       if (new_val < cur_value_masked) {
-               /*
-                * It looks like a wrap happened on the number of bits
-                * of the requested new value. Assume that the clock
-                * value wrapped only one time.
-                */
-               notit->default_clock_val += new_val_mask + 1;
-       }
-
-       /* Clear the low bits of the current clock value. */
-       notit->default_clock_val &= ~new_val_mask;
-
-       /* Set the low bits of the current clock value. */
-       notit->default_clock_val |= new_val;
-
-end:
-       BT_LOGV("Updated default clock's value from integer field's value: "
-               "value=%" PRIu64, notit->default_clock_val);
-}
-
-static
-enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
-               struct ctf_field_class *fc, void *data)
-{
-       struct bt_notif_iter *notit = data;
-       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       bt_field *field = NULL;
-       struct ctf_field_class_int *int_fc = (void *) fc;
-
-       BT_LOGV("Unsigned integer function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
-               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
-
-       if (likely(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE)) {
-               goto update_def_clock;
-       }
-
-       switch (int_fc->meaning) {
-       case CTF_FIELD_CLASS_MEANING_EVENT_CLASS_ID:
-               notit->cur_event_class_id = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_DATA_STREAM_ID:
-               notit->cur_data_stream_id = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME:
-               notit->snapshots.beginning_clock = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_PACKET_END_TIME:
-               notit->snapshots.end_clock = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_STREAM_CLASS_ID:
-               notit->cur_stream_class_id = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_MAGIC:
-               if (value != 0xc1fc1fc1) {
-                       BT_LOGW("Invalid CTF magic number: notit-addr=%p, "
-                               "magic=%" PRIx64, notit, value);
-                       status = BT_BFCR_STATUS_ERROR;
-                       goto end;
-               }
-
-               break;
-       case CTF_FIELD_CLASS_MEANING_PACKET_COUNTER_SNAPSHOT:
-               notit->snapshots.packets = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_DISC_EV_REC_COUNTER_SNAPSHOT:
-               notit->snapshots.discarded_events = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_EXP_PACKET_TOTAL_SIZE:
-               notit->cur_exp_packet_total_size = value;
-               break;
-       case CTF_FIELD_CLASS_MEANING_EXP_PACKET_CONTENT_SIZE:
-               notit->cur_exp_packet_content_size = value;
-               break;
-       default:
-               abort();
-       }
-
-update_def_clock:
-       if (unlikely(int_fc->mapped_clock_class)) {
-               update_default_clock(notit, value, int_fc->base.size);
-       }
-
-       if (unlikely(int_fc->storing_index >= 0)) {
-               g_array_index(notit->stored_values, uint64_t,
-                       (uint64_t) int_fc->storing_index) = value;
-       }
-
-       if (unlikely(!fc->in_ir)) {
-               goto end;
-       }
-
-       field = borrow_next_field(notit);
-       BT_ASSERT(field);
-       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
-                 bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
-       bt_field_unsigned_integer_set_value(field, value);
-       stack_top(notit->stack)->index++;
-
-end:
-       return status;
-}
-
-static
-enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
-               struct ctf_field_class *fc, void *data)
-{
-       int ret;
-       struct bt_notif_iter *notit = data;
-       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       bt_field *string_field = NULL;
-       struct ctf_field_class_int *int_fc = (void *) fc;
-       char str[2] = {'\0', '\0'};
-
-       BT_LOGV("Unsigned integer character function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
-               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
-       BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
-       BT_ASSERT(!int_fc->mapped_clock_class);
-       BT_ASSERT(int_fc->storing_index < 0);
-
-       if (unlikely(!fc->in_ir)) {
-               goto end;
-       }
-
-       if (notit->done_filling_string) {
-               goto end;
-       }
-
-       if (value == 0) {
-               notit->done_filling_string = true;
-               goto end;
-       }
-
-       string_field = stack_top(notit->stack)->base;
-       BT_ASSERT(bt_field_get_class_type(string_field) ==
-                 BT_FIELD_CLASS_TYPE_STRING);
-
-       /* Append character */
-       str[0] = (char) value;
-       ret = bt_field_string_append_with_length(string_field, str, 1);
-       if (ret) {
-               BT_LOGE("Cannot append character to string field's value: "
-                       "notit-addr=%p, field-addr=%p, ret=%d",
-                       notit, string_field, ret);
-               status = BT_BFCR_STATUS_ERROR;
-               goto end;
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
-               struct ctf_field_class *fc, void *data)
-{
-       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       bt_field *field = NULL;
-       struct bt_notif_iter *notit = data;
-       struct ctf_field_class_int *int_fc = (void *) fc;
-
-       BT_LOGV("Signed integer function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d, value=%" PRId64,
-               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
-       BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
-
-       if (unlikely(int_fc->storing_index >= 0)) {
-               g_array_index(notit->stored_values, uint64_t,
-                       (uint64_t) int_fc->storing_index) = (uint64_t) value;
-       }
-
-       if (unlikely(!fc->in_ir)) {
-               goto end;
-       }
-
-       field = borrow_next_field(notit);
-       BT_ASSERT(field);
-       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER ||
-                 bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
-       bt_field_signed_integer_set_value(field, value);
-       stack_top(notit->stack)->index++;
-
-end:
-       return status;
-}
-
-static
-enum bt_bfcr_status bfcr_floating_point_cb(double value,
-               struct ctf_field_class *fc, void *data)
-{
-       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       bt_field *field = NULL;
-       struct bt_notif_iter *notit = data;
-
-       BT_LOGV("Floating point number function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d, value=%f",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
-       BT_ASSERT(fc->in_ir);
-       field = borrow_next_field(notit);
-       BT_ASSERT(field);
-       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_REAL);
-       bt_field_real_set_value(field, value);
-       stack_top(notit->stack)->index++;
-       return status;
-}
-
-static
-enum bt_bfcr_status bfcr_string_begin_cb(
-               struct ctf_field_class *fc, void *data)
-{
-       bt_field *field = NULL;
-       struct bt_notif_iter *notit = data;
-       int ret;
-
-       BT_LOGV("String (beginning) function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir);
-
-       BT_ASSERT(fc->in_ir);
-       field = borrow_next_field(notit);
-       BT_ASSERT(field);
-       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(field) ==
-                 BT_FIELD_CLASS_TYPE_STRING);
-       ret = bt_field_string_clear(field);
-       BT_ASSERT(ret == 0);
-
-       /*
-        * Push on stack. Not a compound class per se, but we know that
-        * only bfcr_string_cb() may be called between this call and a
-        * subsequent call to bfcr_string_end_cb().
-        */
-       stack_push(notit->stack, field);
-       return BT_BFCR_STATUS_OK;
-}
-
-static
-enum bt_bfcr_status bfcr_string_cb(const char *value,
-               size_t len, struct ctf_field_class *fc, void *data)
-{
-       enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       bt_field *field = NULL;
-       struct bt_notif_iter *notit = data;
-       int ret;
-
-       BT_LOGV("String (substring) function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d, string-length=%zu",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir,
-               len);
-       BT_ASSERT(fc->in_ir);
-       field = stack_top(notit->stack)->base;
-       BT_ASSERT(field);
-
-       /* Append current substring */
-       ret = bt_field_string_append_with_length(field, value, len);
-       if (ret) {
-               BT_LOGE("Cannot append substring to string field's value: "
-                       "notit-addr=%p, field-addr=%p, string-length=%zu, "
-                       "ret=%d", notit, field, len, ret);
-               status = BT_BFCR_STATUS_ERROR;
-               goto end;
-       }
-
-end:
-       return status;
-}
-
-static
-enum bt_bfcr_status bfcr_string_end_cb(
-               struct ctf_field_class *fc, void *data)
-{
-       struct bt_notif_iter *notit = data;
-
-       BT_LOGV("String (end) function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir);
-       BT_ASSERT(fc->in_ir);
-
-       /* Pop string field */
-       stack_pop(notit->stack);
-
-       /* Go to next field */
-       stack_top(notit->stack)->index++;
-       return BT_BFCR_STATUS_OK;
-}
-
-enum bt_bfcr_status bfcr_compound_begin_cb(
-               struct ctf_field_class *fc, void *data)
-{
-       struct bt_notif_iter *notit = data;
-       bt_field *field;
-
-       BT_LOGV("Compound (beginning) function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir);
-
-       if (!fc->in_ir) {
-               goto end;
-       }
-
-       /* Borrow field */
-       if (stack_empty(notit->stack)) {
-               /* Root: already set by read_dscope_begin_state() */
-               field = notit->cur_dscope_field;
-       } else {
-               field = borrow_next_field(notit);
-               BT_ASSERT(field);
-       }
-
-       /* Push field */
-       BT_ASSERT(field);
-       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
-       stack_push(notit->stack, field);
-
-       /*
-        * Change BFCR "unsigned int" callback if it's a text
-        * array/sequence.
-        */
-       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
-                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
-               struct ctf_field_class_array_base *array_fc = (void *) fc;
-
-               if (array_fc->is_text) {
-                       int ret;
-
-                       BT_ASSERT(bt_field_get_class_type(field) ==
-                                 BT_FIELD_CLASS_TYPE_STRING);
-                       notit->done_filling_string = false;
-                       ret = bt_field_string_clear(field);
-                       BT_ASSERT(ret == 0);
-                       bt_bfcr_set_unsigned_int_cb(notit->bfcr,
-                               bfcr_unsigned_int_char_cb);
-               }
-       }
-
-end:
-       return BT_BFCR_STATUS_OK;
-}
-
-enum bt_bfcr_status bfcr_compound_end_cb(
-               struct ctf_field_class *fc, void *data)
-{
-       struct bt_notif_iter *notit = data;
-
-       BT_LOGV("Compound (end) function called from BFCR: "
-               "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
-               "fc-type=%d, fc-in-ir=%d",
-               notit, notit->bfcr, fc, fc->type, fc->in_ir);
-
-       if (!fc->in_ir) {
-               goto end;
-       }
-
-       BT_ASSERT(!stack_empty(notit->stack));
-       BT_ASSERT(bt_field_borrow_class_const(stack_top(notit->stack)->base) ==
-               fc->ir_fc);
-
-       /*
-        * Reset BFCR "unsigned int" callback if it's a text
-        * array/sequence.
-        */
-       if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY ||
-                       fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
-               struct ctf_field_class_array_base *array_fc = (void *) fc;
-
-               if (array_fc->is_text) {
-                       BT_ASSERT(bt_field_get_class_type(
-                               stack_top(notit->stack)->base) ==
-                               BT_FIELD_CLASS_TYPE_STRING);
-                       bt_bfcr_set_unsigned_int_cb(notit->bfcr,
-                               bfcr_unsigned_int_cb);
-               }
-       }
-
-       /* Pop stack */
-       stack_pop(notit->stack);
-
-       /* If the stack is not empty, increment the base's index */
-       if (!stack_empty(notit->stack)) {
-               stack_top(notit->stack)->index++;
-       }
-
-end:
-       return BT_BFCR_STATUS_OK;
-}
-
-static
-int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
-{
-       bt_field *seq_field;
-       struct bt_notif_iter *notit = data;
-       struct ctf_field_class_sequence *seq_fc = (void *) fc;
-       int64_t length = -1;
-       int ret;
-
-       length = (uint64_t) g_array_index(notit->stored_values, uint64_t,
-               seq_fc->stored_length_index);
-       seq_field = stack_top(notit->stack)->base;
-       BT_ASSERT(seq_field);
-       ret = bt_field_dynamic_array_set_length(seq_field, (uint64_t) length);
-       if (ret) {
-               BT_LOGE("Cannot set dynamic array field's length field: "
-                       "notit-addr=%p, field-addr=%p, "
-                       "length=%" PRIu64, notit, seq_field, length);
-       }
-
-       return length;
-}
-
-static
-struct ctf_field_class *bfcr_borrow_variant_selected_field_class_cb(
-               struct ctf_field_class *fc, void *data)
-{
-       int ret;
-       uint64_t i;
-       int64_t option_index = -1;
-       struct bt_notif_iter *notit = data;
-       struct ctf_field_class_variant *var_fc = (void *) fc;
-       struct ctf_named_field_class *selected_option = NULL;
-       struct ctf_field_class *ret_fc = NULL;
-       union {
-               uint64_t u;
-               int64_t i;
-       } tag;
-
-       /* Get variant's tag */
-       tag.u = g_array_index(notit->stored_values, uint64_t,
-               var_fc->stored_tag_index);
-
-       /*
-        * Check each range to find the selected option's index.
-        */
-       if (var_fc->tag_fc->base.is_signed) {
-               for (i = 0; i < var_fc->ranges->len; i++) {
-                       struct ctf_field_class_variant_range *range =
-                               ctf_field_class_variant_borrow_range_by_index(
-                                       var_fc, i);
-
-                       if (tag.i >= range->range.lower.i &&
-                                       tag.i <= range->range.upper.i) {
-                               option_index = (int64_t) range->option_index;
-                               break;
-                       }
-               }
-       } else {
-               for (i = 0; i < var_fc->ranges->len; i++) {
-                       struct ctf_field_class_variant_range *range =
-                               ctf_field_class_variant_borrow_range_by_index(
-                                       var_fc, i);
-
-                       if (tag.u >= range->range.lower.u &&
-                                       tag.u <= range->range.upper.u) {
-                               option_index = (int64_t) range->option_index;
-                               break;
-                       }
-               }
-       }
-
-       if (option_index < 0) {
-               BT_LOGW("Cannot find variant field class's option: "
-                       "notit-addr=%p, var-fc-addr=%p, u-tag=%" PRIu64 ", "
-                       "i-tag=%" PRId64, notit, var_fc, tag.u, tag.i);
-               goto end;
-       }
-
-       selected_option = ctf_field_class_variant_borrow_option_by_index(
-               var_fc, (uint64_t) option_index);
-
-       if (selected_option->fc->in_ir) {
-               bt_field *var_field = stack_top(notit->stack)->base;
-
-               ret = bt_field_variant_select_option_field(
-                       var_field, option_index);
-               if (ret) {
-                       BT_LOGW("Cannot select variant field's option field: "
-                               "notit-addr=%p, var-field-addr=%p, "
-                               "opt-index=%" PRId64, notit, var_field,
-                               option_index);
-                       goto end;
-               }
-       }
-
-       ret_fc = selected_option->fc;
-
-end:
-       return ret_fc;
-}
-
-static
-void set_event_default_clock_value(struct bt_notif_iter *notit)
-{
-       bt_event *event =
-               bt_notification_event_borrow_event(
-                       notit->event_notif);
-       bt_stream_class *sc = notit->meta.sc->ir_sc;
-
-       BT_ASSERT(event);
-
-       if (bt_stream_class_borrow_default_clock_class(sc)) {
-               bt_event_set_default_clock_value(event,
-                       notit->default_clock_val);
-       }
-}
-
-static
-void notify_new_stream(struct bt_notif_iter *notit,
-               bt_notification **notification)
-{
-       enum bt_notif_iter_status status;
-       bt_notification *ret = NULL;
-
-       status = set_current_stream(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               BT_NOTIFICATION_PUT_REF_AND_RESET(ret);
-               goto end;
-       }
-
-       BT_ASSERT(notit->stream);
-       BT_ASSERT(notit->notif_iter);
-       ret = bt_notification_stream_beginning_create(notit->notif_iter,
-               notit->stream);
-       if (!ret) {
-               BT_LOGE("Cannot create stream beginning notification: "
-                       "notit-addr=%p, stream-addr=%p",
-                       notit, notit->stream);
-               return;
-       }
-
-end:
-       *notification = ret;
-}
-
-static
-void notify_end_of_stream(struct bt_notif_iter *notit,
-               bt_notification **notification)
-{
-       bt_notification *ret;
-
-       if (!notit->stream) {
-               BT_LOGE("Cannot create stream for stream notification: "
-                       "notit-addr=%p", notit);
-               return;
-       }
-
-       BT_ASSERT(notit->notif_iter);
-       ret = bt_notification_stream_end_create(notit->notif_iter,
-               notit->stream);
-       if (!ret) {
-               BT_LOGE("Cannot create stream beginning notification: "
-                       "notit-addr=%p, stream-addr=%p",
-                       notit, notit->stream);
-               return;
-       }
-       *notification = ret;
-}
-
-static
-void notify_new_packet(struct bt_notif_iter *notit,
-               bt_notification **notification)
-{
-       int ret;
-       enum bt_notif_iter_status status;
-       bt_notification *notif = NULL;
-       const bt_stream_class *sc;
-
-       status = set_current_packet(notit);
-       if (status != BT_NOTIF_ITER_STATUS_OK) {
-               goto end;
-       }
-
-       BT_ASSERT(notit->packet);
-       sc = notit->meta.sc->ir_sc;
-       BT_ASSERT(sc);
-
-       if (bt_stream_class_packets_have_discarded_event_counter_snapshot(sc)) {
-               BT_ASSERT(notit->snapshots.discarded_events != UINT64_C(-1));
-               bt_packet_set_discarded_event_counter_snapshot(
-                       notit->packet, notit->snapshots.discarded_events);
-       }
-
-       if (bt_stream_class_packets_have_packet_counter_snapshot(sc)) {
-               BT_ASSERT(notit->snapshots.packets != UINT64_C(-1));
-               bt_packet_set_packet_counter_snapshot(
-                       notit->packet, notit->snapshots.packets);
-       }
-
-       if (bt_stream_class_packets_have_default_beginning_clock_value(sc)) {
-               BT_ASSERT(notit->snapshots.beginning_clock != UINT64_C(-1));
-               bt_packet_set_default_beginning_clock_value(
-                       notit->packet, notit->snapshots.beginning_clock);
-       }
-
-       if (bt_stream_class_packets_have_default_end_clock_value(sc)) {
-               BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
-               bt_packet_set_default_end_clock_value(
-                       notit->packet, notit->snapshots.end_clock);
-       }
-
-       if (notit->packet_header_field) {
-               ret = bt_packet_move_header_field(
-                       notit->packet, notit->packet_header_field);
-               if (ret) {
-                       goto end;
-               }
-
-               notit->packet_header_field = NULL;
-
-               /*
-                * At this point notit->dscopes.trace_packet_header has
-                * the same value as the packet header field within
-                * notit->packet.
-                */
-               BT_ASSERT(bt_packet_borrow_header_field(
-                       notit->packet) ==
-                       notit->dscopes.trace_packet_header);
-       }
-
-       if (notit->packet_context_field) {
-               ret = bt_packet_move_context_field(
-                       notit->packet, notit->packet_context_field);
-               if (ret) {
-                       goto end;
-               }
-
-               notit->packet_context_field = NULL;
-
-               /*
-                * At this point notit->dscopes.trace_packet_header has
-                * the same value as the packet header field within
-                * notit->packet.
-                */
-               BT_ASSERT(bt_packet_borrow_context_field(
-                       notit->packet) ==
-                       notit->dscopes.stream_packet_context);
-       }
-
-       BT_ASSERT(notit->notif_iter);
-       notif = bt_notification_packet_beginning_create(notit->notif_iter,
-               notit->packet);
-       if (!notif) {
-               BT_LOGE("Cannot create packet beginning notification: "
-                       "notit-addr=%p, packet-addr=%p",
-                       notit, notit->packet);
-               goto end;
-       }
-
-       *notification = notif;
-
-end:
-       return;
-}
-
-static
-void notify_end_of_packet(struct bt_notif_iter *notit,
-               bt_notification **notification)
-{
-       bt_notification *notif;
-
-       if (!notit->packet) {
-               return;
-       }
-
-       /* Update default clock from packet's end time */
-       if (notit->snapshots.end_clock != UINT64_C(-1)) {
-               notit->default_clock_val = notit->snapshots.end_clock;
-       }
-
-       BT_ASSERT(notit->notif_iter);
-       notif = bt_notification_packet_end_create(notit->notif_iter,
-               notit->packet);
-       if (!notif) {
-               BT_LOGE("Cannot create packet end notification: "
-                       "notit-addr=%p, packet-addr=%p",
-                       notit, notit->packet);
-               return;
-
-       }
-
-       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
-       *notification = notif;
-}
-
-BT_HIDDEN
-struct bt_notif_iter *bt_notif_iter_create(struct ctf_trace_class *tc,
-               size_t max_request_sz,
-               struct bt_notif_iter_medium_ops medops, void *data)
-{
-       struct bt_notif_iter *notit = NULL;
-       struct bt_bfcr_cbs cbs = {
-               .classes = {
-                       .signed_int = bfcr_signed_int_cb,
-                       .unsigned_int = bfcr_unsigned_int_cb,
-                       .floating_point = bfcr_floating_point_cb,
-                       .string_begin = bfcr_string_begin_cb,
-                       .string = bfcr_string_cb,
-                       .string_end = bfcr_string_end_cb,
-                       .compound_begin = bfcr_compound_begin_cb,
-                       .compound_end = bfcr_compound_end_cb,
-               },
-               .query = {
-                       .get_sequence_length = bfcr_get_sequence_length_cb,
-                       .borrow_variant_selected_field_class = bfcr_borrow_variant_selected_field_class_cb,
-               },
-       };
-
-       BT_ASSERT(tc);
-       BT_ASSERT(medops.request_bytes);
-       BT_ASSERT(medops.borrow_stream);
-       BT_LOGD("Creating CTF plugin notification iterator: "
-               "trace-addr=%p, max-request-size=%zu, "
-               "data=%p", tc, max_request_sz, data);
-       notit = g_new0(struct bt_notif_iter, 1);
-       if (!notit) {
-               BT_LOGE_STR("Failed to allocate one CTF plugin notification iterator.");
-               goto end;
-       }
-       notit->meta.tc = tc;
-       notit->medium.medops = medops;
-       notit->medium.max_request_sz = max_request_sz;
-       notit->medium.data = data;
-       notit->stack = stack_new(notit);
-       notit->stored_values = g_array_new(FALSE, TRUE, sizeof(uint64_t));
-       g_array_set_size(notit->stored_values, tc->stored_value_count);
-
-       if (!notit->stack) {
-               BT_LOGE_STR("Failed to create field stack.");
-               goto error;
-       }
-
-       notit->bfcr = bt_bfcr_create(cbs, notit);
-       if (!notit->bfcr) {
-               BT_LOGE_STR("Failed to create binary class reader (BFCR).");
-               goto error;
-       }
-
-       bt_notif_iter_reset(notit);
-       BT_LOGD("Created CTF plugin notification iterator: "
-               "trace-addr=%p, max-request-size=%zu, "
-               "data=%p, notit-addr=%p",
-               tc, max_request_sz, data, notit);
-       notit->cur_packet_offset = 0;
-
-end:
-       return notit;
-
-error:
-       bt_notif_iter_destroy(notit);
-       notit = NULL;
-       goto end;
-}
-
-void bt_notif_iter_destroy(struct bt_notif_iter *notit)
-{
-       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
-       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
-       release_all_dscopes(notit);
-
-       BT_LOGD("Destroying CTF plugin notification iterator: addr=%p", notit);
-
-       if (notit->stack) {
-               BT_LOGD_STR("Destroying field stack.");
-               stack_destroy(notit->stack);
-       }
-
-       if (notit->bfcr) {
-               BT_LOGD("Destroying BFCR: bfcr-addr=%p", notit->bfcr);
-               bt_bfcr_destroy(notit->bfcr);
-       }
-
-       if (notit->stored_values) {
-               g_array_free(notit->stored_values, TRUE);
-       }
-
-       g_free(notit);
-}
-
-enum bt_notif_iter_status bt_notif_iter_get_next_notification(
-               struct bt_notif_iter *notit,
-               bt_self_notification_iterator *notif_iter,
-               bt_notification **notification)
-{
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-
-       BT_ASSERT(notit);
-       BT_ASSERT(notification);
-
-       if (notit->state == STATE_DONE) {
-               status = BT_NOTIF_ITER_STATUS_EOF;
-               goto end;
-       }
-
-       notit->notif_iter = notif_iter;
-
-       BT_LOGV("Getting next notification: notit-addr=%p", notit);
-
-       while (true) {
-               status = handle_state(notit);
-               if (status == BT_NOTIF_ITER_STATUS_AGAIN) {
-                       BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_AGAIN.");
-                       goto end;
-               }
-
-               if (status != BT_NOTIF_ITER_STATUS_OK) {
-                       if (status == BT_NOTIF_ITER_STATUS_EOF) {
-                               enum state next_state = notit->state;
-
-                               BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_EOF.");
-
-                               if (notit->packet) {
-                                       notify_end_of_packet(notit,
-                                               notification);
-                               } else {
-                                       notify_end_of_stream(notit,
-                                               notification);
-                                       next_state = STATE_DONE;
-                               }
-
-                               if (!*notification) {
-                                       status = BT_NOTIF_ITER_STATUS_ERROR;
-                                       goto end;
-                               }
-
-                               status = BT_NOTIF_ITER_STATUS_OK;
-                               notit->state = next_state;
-                       } else {
-                               BT_LOGW("Cannot handle state: "
-                                       "notit-addr=%p, state=%s",
-                                       notit, state_string(notit->state));
-                       }
-
-                       goto end;
-               }
-
-               switch (notit->state) {
-               case STATE_EMIT_NOTIF_NEW_STREAM:
-                       /* notify_new_stream() logs errors */
-                       notify_new_stream(notit, notification);
-
-                       if (!*notification) {
-                               status = BT_NOTIF_ITER_STATUS_ERROR;
-                       }
-
-                       notit->stream_begin_emitted = true;
-                       goto end;
-               case STATE_EMIT_NOTIF_NEW_PACKET:
-                       /* notify_new_packet() logs errors */
-                       notify_new_packet(notit, notification);
-
-                       if (!*notification) {
-                               status = BT_NOTIF_ITER_STATUS_ERROR;
-                       }
-
-                       goto end;
-               case STATE_EMIT_NOTIF_EVENT:
-                       BT_ASSERT(notit->event_notif);
-                       set_event_default_clock_value(notit);
-                       *notification = notit->event_notif;
-                       notit->event_notif = NULL;
-                       goto end;
-               case STATE_EMIT_NOTIF_END_OF_PACKET:
-                       /* notify_end_of_packet() logs errors */
-                       notify_end_of_packet(notit, notification);
-
-                       if (!*notification) {
-                               status = BT_NOTIF_ITER_STATUS_ERROR;
-                       }
-
-                       goto end;
-               default:
-                       /* Non-emitting state: continue */
-                       break;
-               }
-       }
-
-end:
-       return status;
-}
-
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields(
-               struct bt_notif_iter *notit,
-               bt_field **packet_header_field,
-               bt_field **packet_context_field)
-{
-       int ret;
-       enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-
-       BT_ASSERT(notit);
-
-       if (notit->state == STATE_EMIT_NOTIF_NEW_PACKET) {
-               /* We're already there */
-               goto set_fields;
-       }
-
-       while (true) {
-               status = handle_state(notit);
-               if (status == BT_NOTIF_ITER_STATUS_AGAIN) {
-                       BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_AGAIN.");
-                       goto end;
-               }
-               if (status != BT_NOTIF_ITER_STATUS_OK) {
-                       if (status == BT_NOTIF_ITER_STATUS_EOF) {
-                               BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_EOF.");
-                       } else {
-                               BT_LOGW("Cannot handle state: "
-                                       "notit-addr=%p, state=%s",
-                                       notit, state_string(notit->state));
-                       }
-                       goto end;
-               }
-
-               switch (notit->state) {
-               case STATE_EMIT_NOTIF_NEW_PACKET:
-                       /*
-                        * Packet header and context fields are
-                        * potentially decoded (or they don't exist).
-                        */
-                       goto set_fields;
-               case STATE_INIT:
-               case STATE_EMIT_NOTIF_NEW_STREAM:
-               case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
-               case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
-               case STATE_AFTER_TRACE_PACKET_HEADER:
-               case STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN:
-               case STATE_DSCOPE_STREAM_PACKET_CONTEXT_CONTINUE:
-               case STATE_AFTER_STREAM_PACKET_CONTEXT:
-                       /* Non-emitting state: continue */
-                       break;
-               default:
-                       /*
-                        * We should never get past the
-                        * STATE_EMIT_NOTIF_NEW_PACKET state.
-                        */
-                       BT_LOGF("Unexpected state: notit-addr=%p, state=%s",
-                               notit, state_string(notit->state));
-                       abort();
-               }
-       }
-
-set_fields:
-       ret = set_current_packet_content_sizes(notit);
-       if (ret) {
-               status = BT_NOTIF_ITER_STATUS_ERROR;
-               goto end;
-       }
-
-       if (packet_header_field) {
-               *packet_header_field = notit->dscopes.trace_packet_header;
-       }
-
-       if (packet_context_field) {
-               *packet_context_field = notit->dscopes.stream_packet_context;
-       }
-
-end:
-       return status;
-}
-
-BT_HIDDEN
-void bt_notif_iter_set_medops_data(struct bt_notif_iter *notit,
-               void *medops_data)
-{
-       BT_ASSERT(notit);
-       notit->medium.data = medops_data;
-}
-
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_seek(
-               struct bt_notif_iter *notit, off_t offset)
-{
-       enum bt_notif_iter_status ret = BT_NOTIF_ITER_STATUS_OK;
-       enum bt_notif_iter_medium_status medium_status;
-
-       BT_ASSERT(notit);
-       if (offset < 0) {
-               BT_LOGE("Cannot seek to negative offset: offset=%jd", offset);
-               ret = BT_NOTIF_ITER_STATUS_INVAL;
-               goto end;
-       }
-
-       if (!notit->medium.medops.seek) {
-               ret = BT_NOTIF_ITER_STATUS_UNSUPPORTED;
-               BT_LOGD("Aborting seek as the iterator's underlying media does not implement seek support.");
-               goto end;
-       }
-
-       medium_status = notit->medium.medops.seek(
-               BT_NOTIF_ITER_SEEK_WHENCE_SET, offset, notit->medium.data);
-       if (medium_status != BT_NOTIF_ITER_MEDIUM_STATUS_OK) {
-               if (medium_status == BT_NOTIF_ITER_MEDIUM_STATUS_EOF) {
-                       ret = BT_NOTIF_ITER_STATUS_EOF;
-               } else {
-                       ret = BT_NOTIF_ITER_STATUS_ERROR;
-                       goto end;
-               }
-       }
-
-       bt_notif_iter_reset(notit);
-       notit->cur_packet_offset = offset;
-
-end:
-       return ret;
-}
-
-BT_HIDDEN
-off_t bt_notif_iter_get_current_packet_offset(struct bt_notif_iter *notit)
-{
-       BT_ASSERT(notit);
-       return notit->cur_packet_offset;
-}
-
-BT_HIDDEN
-off_t bt_notif_iter_get_current_packet_size(
-               struct bt_notif_iter *notit)
-{
-       BT_ASSERT(notit);
-       return notit->cur_exp_packet_total_size;
-}
-
-BT_HIDDEN
-void bt_notif_trace_class_changed(struct bt_notif_iter *notit)
-{
-       if (notit->meta.tc->stored_value_count > notit->stored_values->len) {
-               g_array_set_size(notit->stored_values,
-                       notit->meta.tc->stored_value_count);
-       }
-}
-
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_get_packet_properties(
-               struct bt_notif_iter *notit,
-               struct bt_notif_iter_packet_properties *props)
-{
-       BT_ASSERT(notit);
-       BT_ASSERT(props);
-
-       props->exp_packet_total_size =
-               (uint64_t) notit->cur_exp_packet_total_size;
-       props->exp_packet_content_size =
-               (uint64_t) notit->cur_exp_packet_content_size;
-       BT_ASSERT(props->stream_class_id >= 0);
-       props->stream_class_id = (uint64_t) notit->cur_stream_class_id;
-       props->data_stream_id = notit->cur_data_stream_id;
-       props->snapshots.discarded_events = notit->snapshots.discarded_events;
-       props->snapshots.packets = notit->snapshots.packets;
-       props->snapshots.beginning_clock = notit->snapshots.beginning_clock;
-       props->snapshots.end_clock = notit->snapshots.end_clock;
-       return BT_NOTIF_ITER_STATUS_OK;
-}
diff --git a/plugins/ctf/common/notif-iter/notif-iter.h b/plugins/ctf/common/notif-iter/notif-iter.h
deleted file mode 100644 (file)
index c0f187e..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-#ifndef CTF_NOTIF_ITER_H
-#define CTF_NOTIF_ITER_H
-
-/*
- * Babeltrace - CTF notification iterator
- *                  Â¯Â¯Â¯Â¯Â¯        Â¯Â¯Â¯Â¯
- * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <babeltrace/babeltrace.h>
-#include <babeltrace/babeltrace-internal.h>
-
-#include "../metadata/ctf-meta.h"
-
-/**
- * @file ctf-notif-iter.h
- *
- * CTF notification iterator
- *     Â¯Â¯Â¯Â¯Â¯        Â¯Â¯Â¯Â¯
- * This is a common internal API used by CTF source plugins. It allows
- * one to get notifications from a user-provided medium.
- */
-
-/**
- * Medium operations status codes.
- */
-enum bt_notif_iter_medium_status {
-       /**
-        * End of file.
-        *
-        * The medium function called by the notification iterator
-        * function reached the end of the file.
-        */
-       BT_NOTIF_ITER_MEDIUM_STATUS_EOF = 1,
-
-       /**
-        * There is no data available right now, try again later.
-        */
-       BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN = 11,
-
-       /** Unsupported operation. */
-       BT_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED = -3,
-
-       /** Invalid argument. */
-       BT_NOTIF_ITER_MEDIUM_STATUS_INVAL = -2,
-
-       /** General error. */
-       BT_NOTIF_ITER_MEDIUM_STATUS_ERROR = -1,
-
-       /** Everything okay. */
-       BT_NOTIF_ITER_MEDIUM_STATUS_OK = 0,
-};
-
-/**
- * CTF notification iterator API status code.
- */
-enum bt_notif_iter_status {
-       /**
-        * End of file.
-        *
-        * The medium function called by the notification iterator
-        * function reached the end of the file.
-        */
-       BT_NOTIF_ITER_STATUS_EOF = BT_NOTIF_ITER_MEDIUM_STATUS_EOF,
-
-       /**
-        * There is no data available right now, try again later.
-        *
-        * Some condition resulted in the
-        * bt_notif_iter_medium_ops::request_bytes() user function not
-        * having access to any data now. You should retry calling the
-        * last called notification iterator function once the situation
-        * is resolved.
-        */
-       BT_NOTIF_ITER_STATUS_AGAIN = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN,
-
-       /** Invalid argument. */
-       BT_NOTIF_ITER_STATUS_INVAL = BT_NOTIF_ITER_MEDIUM_STATUS_INVAL,
-
-       /** Unsupported operation. */
-       BT_NOTIF_ITER_STATUS_UNSUPPORTED = BT_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED,
-
-       /** General error. */
-       BT_NOTIF_ITER_STATUS_ERROR = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR,
-
-       /** Everything okay. */
-       BT_NOTIF_ITER_STATUS_OK =       0,
-};
-
-/**
- * CTF notification iterator seek operation directives.
- */
-enum bt_notif_iter_seek_whence {
-       /**
-        * Set the iterator's position to an absolute offset in the underlying
-        * medium.
-        */
-       BT_NOTIF_ITER_SEEK_WHENCE_SET,
-};
-
-/**
- * Medium operations.
- *
- * Those user functions are called by the notification iterator
- * functions to request medium actions.
- */
-struct bt_notif_iter_medium_ops {
-       /**
-        * Returns the next byte buffer to be used by the binary file
-        * reader to deserialize binary data.
-        *
-        * This function \em must be defined.
-        *
-        * The purpose of this function is to return a buffer of bytes
-        * to the notification iterator, of a maximum of \p request_sz
-        * bytes. If this function cannot return a buffer of at least
-        * \p request_sz bytes, it may return a smaller buffer. In
-        * either cases, \p buffer_sz must be set to the returned buffer
-        * size (in bytes).
-        *
-        * The returned buffer's ownership remains the medium, in that
-        * it won't be freed by the notification iterator functions. The
-        * returned buffer won't be modified by the notification
-        * iterator functions either.
-        *
-        * When this function is called for the first time for a given
-        * file, the offset within the file is considered to be 0. The
-        * next times this function is called, the returned buffer's
-        * byte offset within the complete file must be the previous
-        * offset plus the last returned value of \p buffer_sz by this
-        * medium.
-        *
-        * This function must return one of the following statuses:
-        *
-        *   - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_OK</b>: Everything
-        *     is okay, i.e. \p buffer_sz is set to a positive value
-        *     reflecting the number of available bytes in the buffer
-        *     starting at the address written in \p buffer_addr.
-        *   - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN</b>: No data is
-        *     available right now. In this case, the notification
-        *     iterator function called by the user returns
-        *     #BT_NOTIF_ITER_STATUS_AGAIN, and it is the user's
-        *     responsibility to make sure enough data becomes available
-        *     before calling the \em same notification iterator
-        *     function again to continue the decoding process.
-        *   - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_EOF</b>: The end of
-        *     the file was reached, and no more data will ever be
-        *     available for this file. In this case, the notification
-        *     iterator function called by the user returns
-        *     #BT_NOTIF_ITER_STATUS_EOF. This must \em not be
-        *     returned when returning at least one byte of data to the
-        *     caller, i.e. this must be returned when there's
-        *     absolutely nothing left; should the request size be
-        *     larger than what's left in the file, this function must
-        *     return what's left, setting \p buffer_sz to the number of
-        *     remaining bytes, and return
-        *     #BT_NOTIF_ITER_MEDIUM_STATUS_EOF on the \em following
-        *     call.
-        *   - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
-        *     error occured during this operation. In this case, the
-        *     notification iterator function called by the user returns
-        *     #BT_NOTIF_ITER_STATUS_ERROR.
-        *
-        * If #BT_NOTIF_ITER_MEDIUM_STATUS_OK is not returned, the
-        * values of \p buffer_sz and \p buffer_addr are \em ignored by
-        * the caller.
-        *
-        * @param request_sz    Requested buffer size (bytes)
-        * @param buffer_addr   Returned buffer address
-        * @param buffer_sz     Returned buffer's size (bytes)
-        * @param data          User data
-        * @returns             Status code (see description above)
-        */
-       enum bt_notif_iter_medium_status (* request_bytes)(
-                       size_t request_sz, uint8_t **buffer_addr,
-                       size_t *buffer_sz, void *data);
-
-       /**
-        * Repositions the underlying stream's position.
-        *
-        * This *optional* method repositions the underlying stream
-        * to a given absolute or relative position, as indicated by
-        * the whence directive.
-        *
-        * @param whence        One of #bt_notif_iter_seek_whence values
-        * @param offset        Offset to use for the given directive
-        * @param data          User data
-        * @returns             One of #bt_notif_iter_medium_status values
-        */
-       enum bt_notif_iter_medium_status (* seek)(
-                       enum bt_notif_iter_seek_whence whence,
-                       off_t offset, void *data);
-
-       /**
-        * Returns a stream instance (weak reference) for the given
-        * stream class.
-        *
-        * This is called after a packet header is read, and the
-        * corresponding stream class is found by the notification
-        * iterator.
-        *
-        * @param stream_class  Stream class of the stream to get
-        * @param stream_id     Stream (instance) ID of the stream
-        *                      to get (-1ULL if not available)
-        * @param data          User data
-        * @returns             Stream instance (weak reference) or
-        *                      \c NULL on error
-        */
-       bt_stream * (* borrow_stream)(
-                       bt_stream_class *stream_class,
-                       int64_t stream_id, void *data);
-};
-
-/** CTF notification iterator. */
-struct bt_notif_iter;
-
-/**
- * Creates a CTF notification iterator.
- *
- * Upon successful completion, the reference count of \p trace is
- * incremented.
- *
- * @param trace                        Trace to read
- * @param max_request_sz       Maximum buffer size, in bytes, to
- *                             request to
- *                             bt_notif_iter_medium_ops::request_bytes()
- *                             at a time
- * @param medops               Medium operations
- * @param medops_data          User data (passed to medium operations)
- * @returns                    New CTF notification iterator on
- *                             success, or \c NULL on error
- */
-BT_HIDDEN
-struct bt_notif_iter *bt_notif_iter_create(struct ctf_trace_class *tc,
-       size_t max_request_sz, struct bt_notif_iter_medium_ops medops,
-       void *medops_data);
-
-/**
- * Destroys a CTF notification iterator, freeing all internal resources.
- *
- * The registered trace's reference count is decremented.
- *
- * @param notif_iter           CTF notification iterator
- */
-BT_HIDDEN
-void bt_notif_iter_destroy(struct bt_notif_iter *notif_iter);
-
-/**
- * Returns the next notification from a CTF notification iterator.
- *
- * Upon successful completion, #BT_NOTIF_ITER_STATUS_OK is
- * returned, and the next notification is written to \p notif.
- * In this case, the caller is responsible for calling
- * bt_notification_put() on the returned notification.
- *
- * If this function returns #BT_NOTIF_ITER_STATUS_AGAIN, the caller
- * should make sure that data becomes available to its medium, and
- * call this function again, until another status is returned.
- *
- * @param notif_iter           CTF notification iterator
- * @param notification         Returned notification if the function's
- *                             return value is #BT_NOTIF_ITER_STATUS_OK
- * @returns                    One of #bt_notif_iter_status values
- */
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_get_next_notification(
-               struct bt_notif_iter *notit,
-               bt_self_notification_iterator *notif_iter,
-               bt_notification **notification);
-
-/**
- * Returns the first packet header and context fields. This function
- * never needs to call the `borrow_stream()` medium operation because
- * it does not create packet or event objects.
- *
- * @param notif_iter           CTF notification iterator
- * @param packet_header_field  Packet header field (\c NULL if there's
- *                             no packet header field)
- * @param packet_context_field Packet context field (\c NULL if there's
- *                             no packet context field)
- * @returns                    One of #bt_notif_iter_status values
- */
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields(
-               struct bt_notif_iter *notit,
-               bt_field **packet_header_field,
-               bt_field **packet_context_field);
-
-struct bt_notif_iter_packet_properties {
-       uint64_t exp_packet_total_size;
-       uint64_t exp_packet_content_size;
-       uint64_t stream_class_id;
-       int64_t data_stream_id;
-
-       struct {
-               uint64_t discarded_events;
-               uint64_t packets;
-               uint64_t beginning_clock;
-               uint64_t end_clock;
-       } snapshots;
-};
-
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_get_packet_properties(
-               struct bt_notif_iter *notit,
-               struct bt_notif_iter_packet_properties *props);
-
-BT_HIDDEN
-void bt_notif_iter_set_medops_data(struct bt_notif_iter *notit,
-               void *medops_data);
-
-BT_HIDDEN
-enum bt_notif_iter_status bt_notif_iter_seek(
-               struct bt_notif_iter *notit, off_t offset);
-
-/*
- * Get the current packet's offset in bytes relative to the media's initial
- * position.
- */
-BT_HIDDEN
-off_t bt_notif_iter_get_current_packet_offset(
-               struct bt_notif_iter *notit);
-
-/* Get the current packet's size (in bits). */
-BT_HIDDEN
-off_t bt_notif_iter_get_current_packet_size(
-               struct bt_notif_iter *notit);
-
-/*
- * Resets the iterator so that the next requested medium bytes are
- * assumed to be the first bytes of a new stream. The first notification
- * which this iterator emits after calling bt_notif_iter_reset() is a
- * BT_NOTIFICATION_TYPE_STREAM_BEGINNING one.
- */
-BT_HIDDEN
-void bt_notif_iter_reset(struct bt_notif_iter *notit);
-
-/*
- * Notify the iterator that the trace class changed somehow (new
- * stream/event classes).
- */
-BT_HIDDEN
-void bt_notif_trace_class_changed(struct bt_notif_iter *notit);
-
-static inline
-const char *bt_notif_iter_medium_status_string(
-               enum bt_notif_iter_medium_status status)
-{
-       switch (status) {
-       case BT_NOTIF_ITER_MEDIUM_STATUS_EOF:
-               return "BT_NOTIF_ITER_MEDIUM_STATUS_EOF";
-       case BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN:
-               return "BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN";
-       case BT_NOTIF_ITER_MEDIUM_STATUS_INVAL:
-               return "BT_NOTIF_ITER_MEDIUM_STATUS_INVAL";
-       case BT_NOTIF_ITER_MEDIUM_STATUS_ERROR:
-               return "BT_NOTIF_ITER_MEDIUM_STATUS_ERROR";
-       case BT_NOTIF_ITER_MEDIUM_STATUS_OK:
-               return "BT_NOTIF_ITER_MEDIUM_STATUS_OK";
-       default:
-               return "(unknown)";
-       }
-}
-
-static inline
-const char *bt_notif_iter_status_string(
-               enum bt_notif_iter_status status)
-{
-       switch (status) {
-       case BT_NOTIF_ITER_STATUS_EOF:
-               return "BT_NOTIF_ITER_STATUS_EOF";
-       case BT_NOTIF_ITER_STATUS_AGAIN:
-               return "BT_NOTIF_ITER_STATUS_AGAIN";
-       case BT_NOTIF_ITER_STATUS_INVAL:
-               return "BT_NOTIF_ITER_STATUS_INVAL";
-       case BT_NOTIF_ITER_STATUS_ERROR:
-               return "BT_NOTIF_ITER_STATUS_ERROR";
-       case BT_NOTIF_ITER_STATUS_OK:
-               return "BT_NOTIF_ITER_STATUS_OK";
-       default:
-               return "(unknown)";
-       }
-}
-
-#endif /* CTF_NOTIF_ITER_H */
index ff6035133bcd21ead40114a6e8e33cd2e6529fec..38db9a5e474da2991b9250c100d73d9cd3d0aee4 100644 (file)
@@ -109,9 +109,9 @@ end:
 }
 
 static
-enum bt_component_status handle_notification(
+enum bt_component_status handle_message(
                struct writer_component *writer_component,
-               const bt_notification *notification)
+               const bt_message *message)
 {
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
 
@@ -120,11 +120,11 @@ enum bt_component_status handle_notification(
                goto end;
        }
 
-       switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
+       switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
        {
                const bt_packet *packet =
-                       bt_notification_packet_beginning_get_packet(notification);
+                       bt_message_packet_beginning_get_packet(message);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -135,10 +135,10 @@ enum bt_component_status handle_notification(
                bt_packet_put_ref(packet);
                break;
        }
-       case BT_NOTIFICATION_TYPE_PACKET_END:
+       case BT_MESSAGE_TYPE_PACKET_END:
        {
                const bt_packet *packet =
-                       bt_notification_packet_end_get_packet(notification);
+                       bt_message_packet_end_get_packet(message);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -148,10 +148,10 @@ enum bt_component_status handle_notification(
                bt_packet_put_ref(packet);
                break;
        }
-       case BT_NOTIFICATION_TYPE_EVENT:
+       case BT_MESSAGE_TYPE_EVENT:
        {
-               const bt_event *event = bt_notification_event_get_event(
-                               notification);
+               const bt_event *event = bt_message_event_get_event(
+                               message);
 
                if (!event) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -164,10 +164,10 @@ enum bt_component_status handle_notification(
                }
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
        {
                const bt_stream *stream =
-                       bt_notification_stream_beginning_get_stream(notification);
+                       bt_message_stream_beginning_get_stream(message);
 
                if (!stream) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -177,10 +177,10 @@ enum bt_component_status handle_notification(
                bt_stream_put_ref(stream);
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_END:
        {
                const bt_stream *stream =
-                       bt_notification_stream_end_get_stream(notification);
+                       bt_message_stream_end_get_stream(message);
 
                if (!stream) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -212,7 +212,7 @@ void writer_component_port_connected(
        BT_ASSERT(!writer->input_iterator);
        connection = bt_private_port_get_connection(self_port);
        BT_ASSERT(connection);
-       conn_status = bt_private_connection_create_notification_iterator(
+       conn_status = bt_private_connection_create_message_iterator(
                connection, &writer->input_iterator);
        if (conn_status != BT_CONNECTION_STATUS_OK) {
                writer->error = true;
@@ -225,11 +225,11 @@ BT_HIDDEN
 enum bt_component_status writer_run(bt_self_component *component)
 {
        enum bt_component_status ret;
-       const bt_notification *notification = NULL;
-       bt_notification_iterator *it;
+       const bt_message *message = NULL;
+       bt_message_iterator *it;
        struct writer_component *writer_component =
                bt_self_component_get_user_data(component);
-       enum bt_notification_iterator_status it_ret;
+       enum bt_message_iterator_status it_ret;
 
        if (unlikely(writer_component->error)) {
                ret = BT_COMPONENT_STATUS_ERROR;
@@ -238,28 +238,28 @@ enum bt_component_status writer_run(bt_self_component *component)
 
        it = writer_component->input_iterator;
        BT_ASSERT(it);
-       it_ret = bt_notification_iterator_next(it);
+       it_ret = bt_message_iterator_next(it);
 
        switch (it_ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+       case BT_MESSAGE_ITERATOR_STATUS_END:
                ret = BT_COMPONENT_STATUS_END;
                BT_OBJECT_PUT_REF_AND_RESET(writer_component->input_iterator);
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                ret = BT_COMPONENT_STATUS_AGAIN;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
                break;
        default:
                ret = BT_COMPONENT_STATUS_ERROR;
                goto end;
        }
 
-       notification = bt_notification_iterator_get_notification(it);
-       BT_ASSERT(notification);
-       ret = handle_notification(writer_component, notification);
+       message = bt_message_iterator_get_message(it);
+       BT_ASSERT(message);
+       ret = handle_message(writer_component, message);
 end:
-       bt_object_put_ref(notification);
+       bt_object_put_ref(message);
        return ret;
 }
 
index 5a0981040a90b7003a87ca59477a58a6c9809ac3..965f3d2cb6cb3f0070c1f0f1b5d1bd8dbb8b30a4 100644 (file)
@@ -39,7 +39,7 @@ struct writer_component {
        /* Map between bt_trace and struct fs_writer. */
        GHashTable *trace_map;
        FILE *err;
-       bt_notification_iterator *input_iterator;
+       bt_message_iterator *input_iterator;
        bool error;
        bool single_trace;
        unsigned int nr_traces;
@@ -48,7 +48,7 @@ struct writer_component {
 enum fs_writer_stream_state {
        /*
         * We know the stream exists but we have never received a
-        * stream_begin notification for it.
+        * stream_begin message for it.
         */
        FS_WRITER_UNKNOWN_STREAM,
        /* We know this stream is active (between stream_begin and _end). */
index dca33e2e4b8da85b083f29c1a61c124a15a8f807..da4d1fa57b4f89e988b4d0bef9637882096f8fd1 100644 (file)
@@ -35,7 +35,7 @@
 #include <babeltrace/common-internal.h>
 #include "file.h"
 #include "metadata.h"
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 #include <babeltrace/assert-internal.h>
 #include "data-stream-file.h"
 #include <string.h>
@@ -75,11 +75,11 @@ end:
 }
 
 static
-enum bt_notif_iter_medium_status ds_file_mmap_next(
+enum bt_msg_iter_medium_status ds_file_mmap_next(
                struct ctf_fs_ds_file *ds_file)
 {
-       enum bt_notif_iter_medium_status ret =
-                       BT_NOTIF_ITER_MEDIUM_STATUS_OK;
+       enum bt_msg_iter_medium_status ret =
+                       BT_MSG_ITER_MEDIUM_STATUS_OK;
 
        /* Unmap old region */
        if (ds_file->mmap_addr) {
@@ -99,7 +99,7 @@ enum bt_notif_iter_medium_status ds_file_mmap_next(
        ds_file->mmap_len = MIN(ds_file->file->size - ds_file->mmap_offset,
                        ds_file->mmap_max_len);
        if (ds_file->mmap_len == 0) {
-               ret = BT_NOTIF_ITER_MEDIUM_STATUS_EOF;
+               ret = BT_MSG_ITER_MEDIUM_STATUS_EOF;
                goto end;
        }
        /* Map new region */
@@ -118,18 +118,18 @@ enum bt_notif_iter_medium_status ds_file_mmap_next(
        goto end;
 error:
        ds_file_munmap(ds_file);
-       ret = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR;
+       ret = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
 end:
        return ret;
 }
 
 static
-enum bt_notif_iter_medium_status medop_request_bytes(
+enum bt_msg_iter_medium_status medop_request_bytes(
                size_t request_sz, uint8_t **buffer_addr,
                size_t *buffer_sz, void *data)
 {
-       enum bt_notif_iter_medium_status status =
-               BT_NOTIF_ITER_MEDIUM_STATUS_OK;
+       enum bt_msg_iter_medium_status status =
+               BT_MSG_ITER_MEDIUM_STATUS_OK;
        struct ctf_fs_ds_file *ds_file = data;
 
        if (request_sz == 0) {
@@ -142,15 +142,15 @@ enum bt_notif_iter_medium_status medop_request_bytes(
                if (ds_file->mmap_offset >= ds_file->file->size) {
                        BT_LOGD("Reached end of file \"%s\" (%p)",
                                ds_file->file->path->str, ds_file->file->fp);
-                       status = BT_NOTIF_ITER_MEDIUM_STATUS_EOF;
+                       status = BT_MSG_ITER_MEDIUM_STATUS_EOF;
                        goto end;
                }
 
                status = ds_file_mmap_next(ds_file);
                switch (status) {
-               case BT_NOTIF_ITER_MEDIUM_STATUS_OK:
+               case BT_MSG_ITER_MEDIUM_STATUS_OK:
                        break;
-               case BT_NOTIF_ITER_MEDIUM_STATUS_EOF:
+               case BT_MSG_ITER_MEDIUM_STATUS_EOF:
                        goto end;
                default:
                        BT_LOGE("Cannot memory-map next region of file \"%s\" (%p)",
@@ -166,7 +166,7 @@ enum bt_notif_iter_medium_status medop_request_bytes(
        goto end;
 
 error:
-       status = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR;
+       status = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
 
 end:
        return status;
@@ -199,21 +199,21 @@ end:
 }
 
 static
-enum bt_notif_iter_medium_status medop_seek(
-               enum bt_notif_iter_seek_whence whence, off_t offset,
+enum bt_msg_iter_medium_status medop_seek(
+               enum bt_msg_iter_seek_whence whence, off_t offset,
                void *data)
 {
-       enum bt_notif_iter_medium_status ret =
-                       BT_NOTIF_ITER_MEDIUM_STATUS_OK;
+       enum bt_msg_iter_medium_status ret =
+                       BT_MSG_ITER_MEDIUM_STATUS_OK;
        struct ctf_fs_ds_file *ds_file = data;
        off_t file_size = ds_file->file->size;
 
-       if (whence != BT_NOTIF_ITER_SEEK_WHENCE_SET ||
+       if (whence != BT_MSG_ITER_SEEK_WHENCE_SET ||
                offset < 0 || offset > file_size) {
                BT_LOGE("Invalid medium seek request: whence=%d, offset=%jd, "
                                "file-size=%jd", (int) whence, offset,
                                file_size);
-               ret = BT_NOTIF_ITER_MEDIUM_STATUS_INVAL;
+               ret = BT_MSG_ITER_MEDIUM_STATUS_INVAL;
                goto end;
        }
 
@@ -232,14 +232,14 @@ enum bt_notif_iter_medium_status medop_seek(
                                ds_file->mmap_len);
                unmap_ret = ds_file_munmap(ds_file);
                if (unmap_ret) {
-                       ret = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR;
+                       ret = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
                        goto end;
                }
 
                ds_file->mmap_offset = offset - offset_in_mapping;
                ds_file->request_offset = offset_in_mapping;
                ret = ds_file_mmap_next(ds_file);
-               if (ret != BT_NOTIF_ITER_MEDIUM_STATUS_OK) {
+               if (ret != BT_MSG_ITER_MEDIUM_STATUS_OK) {
                        goto end;
                }
        } else {
@@ -252,7 +252,7 @@ end:
 }
 
 BT_HIDDEN
-struct bt_notif_iter_medium_ops ctf_fs_ds_file_medops = {
+struct bt_msg_iter_medium_ops ctf_fs_ds_file_medops = {
        .request_bytes = medop_request_bytes,
        .borrow_stream = medop_borrow_stream,
        .seek = medop_seek,
@@ -320,20 +320,20 @@ struct ctf_fs_ds_index *build_index_from_idx_file(
        size_t file_entry_count;
        size_t i;
        struct ctf_stream_class *sc;
-       struct bt_notif_iter_packet_properties props;
+       struct bt_msg_iter_packet_properties props;
 
        BT_LOGD("Building index from .idx file of stream file %s",
                        ds_file->file->path->str);
 
-       ret = bt_notif_iter_borrow_packet_header_context_fields(
-               ds_file->notif_iter, NULL, NULL);
+       ret = bt_msg_iter_borrow_packet_header_context_fields(
+               ds_file->msg_iter, NULL, NULL);
        if (ret) {
                BT_LOGD_STR("Cannot borrow first packet's header and context "
                        "fields.");
                goto error;
        }
 
-       ret = bt_notif_iter_get_packet_properties(ds_file->notif_iter, &props);
+       ret = bt_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
        BT_ASSERT(ret == 0);
        sc = ctf_trace_class_borrow_stream_class_by_id(ds_file->metadata->tc,
                props.stream_class_id);
@@ -493,7 +493,7 @@ error:
 static
 int init_index_entry(struct ctf_fs_ds_index_entry *entry,
                struct ctf_fs_ds_file *ds_file,
-               struct bt_notif_iter_packet_properties *props,
+               struct bt_msg_iter_packet_properties *props,
                off_t packet_size, off_t packet_offset)
 {
        int ret;
@@ -534,7 +534,7 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
 {
        int ret;
        struct ctf_fs_ds_index *index = NULL;
-       enum bt_notif_iter_status iter_status;
+       enum bt_msg_iter_status iter_status;
 
        BT_LOGD("Indexing stream file %s", ds_file->file->path->str);
 
@@ -548,24 +548,24 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                off_t next_packet_offset;
                off_t current_packet_size_bytes;
                struct ctf_fs_ds_index_entry *entry;
-               struct bt_notif_iter_packet_properties props;
+               struct bt_msg_iter_packet_properties props;
 
-               iter_status = bt_notif_iter_borrow_packet_header_context_fields(
-                       ds_file->notif_iter, NULL, NULL);
-               if (iter_status != BT_NOTIF_ITER_STATUS_OK) {
-                       if (iter_status == BT_NOTIF_ITER_STATUS_EOF) {
+               iter_status = bt_msg_iter_borrow_packet_header_context_fields(
+                       ds_file->msg_iter, NULL, NULL);
+               if (iter_status != BT_MSG_ITER_STATUS_OK) {
+                       if (iter_status == BT_MSG_ITER_STATUS_EOF) {
                                break;
                        }
                        goto error;
                }
 
-               ret = bt_notif_iter_get_packet_properties(ds_file->notif_iter,
+               ret = bt_msg_iter_get_packet_properties(ds_file->msg_iter,
                        &props);
                BT_ASSERT(ret == 0);
 
                current_packet_offset =
-                       bt_notif_iter_get_current_packet_offset(
-                               ds_file->notif_iter);
+                       bt_msg_iter_get_current_packet_offset(
+                               ds_file->msg_iter);
                if (current_packet_offset < 0) {
                        BT_LOGE_STR("Cannot get the current packet's offset.");
                        goto error;
@@ -604,11 +604,11 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                        goto error;
                }
 
-               iter_status = bt_notif_iter_seek(ds_file->notif_iter,
+               iter_status = bt_msg_iter_seek(ds_file->msg_iter,
                                next_packet_offset);
-       } while (iter_status == BT_NOTIF_ITER_STATUS_OK);
+       } while (iter_status == BT_MSG_ITER_STATUS_OK);
 
-       if (iter_status != BT_NOTIF_ITER_STATUS_EOF) {
+       if (iter_status != BT_MSG_ITER_STATUS_EOF) {
                goto error;
        }
 
@@ -624,8 +624,8 @@ error:
 BT_HIDDEN
 struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                struct ctf_fs_trace *ctf_fs_trace,
-               bt_self_notification_iterator *pc_notif_iter,
-               struct bt_notif_iter *notif_iter,
+               bt_self_message_iterator *pc_msg_iter,
+               struct bt_msg_iter *msg_iter,
                bt_stream *stream, const char *path)
 {
        int ret;
@@ -636,7 +636,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                goto error;
        }
 
-       ds_file->pc_notif_iter = pc_notif_iter;
+       ds_file->pc_msg_iter = pc_msg_iter;
        ds_file->file = ctf_fs_file_create();
        if (!ds_file->file) {
                goto error;
@@ -651,9 +651,9 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                goto error;
        }
 
-       ds_file->notif_iter = notif_iter;
-       bt_notif_iter_set_medops_data(ds_file->notif_iter, ds_file);
-       if (!ds_file->notif_iter) {
+       ds_file->msg_iter = msg_iter;
+       bt_msg_iter_set_medops_data(ds_file->msg_iter, ds_file);
+       if (!ds_file->msg_iter) {
                goto error;
        }
 
@@ -706,34 +706,34 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file)
 }
 
 BT_HIDDEN
-enum bt_notification_iterator_status ctf_fs_ds_file_next(
+enum bt_message_iterator_status ctf_fs_ds_file_next(
                struct ctf_fs_ds_file *ds_file,
-               bt_notification **notif)
+               bt_message **msg)
 {
-       enum bt_notif_iter_status notif_iter_status;
-       enum bt_notification_iterator_status status;
+       enum bt_msg_iter_status msg_iter_status;
+       enum bt_message_iterator_status status;
 
-       notif_iter_status = bt_notif_iter_get_next_notification(
-               ds_file->notif_iter, ds_file->pc_notif_iter, notif);
+       msg_iter_status = bt_msg_iter_get_next_message(
+               ds_file->msg_iter, ds_file->pc_msg_iter, msg);
 
-       switch (notif_iter_status) {
-       case BT_NOTIF_ITER_STATUS_EOF:
-               status = BT_NOTIFICATION_ITERATOR_STATUS_END;
+       switch (msg_iter_status) {
+       case BT_MSG_ITER_STATUS_EOF:
+               status = BT_MESSAGE_ITERATOR_STATUS_END;
                break;
-       case BT_NOTIF_ITER_STATUS_OK:
-               status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       case BT_MSG_ITER_STATUS_OK:
+               status = BT_MESSAGE_ITERATOR_STATUS_OK;
                break;
-       case BT_NOTIF_ITER_STATUS_AGAIN:
+       case BT_MSG_ITER_STATUS_AGAIN:
                /*
                 * Should not make it this far as this is
                 * medium-specific; there is nothing for the user to do
                 * and it should have been handled upstream.
                 */
                abort();
-       case BT_NOTIF_ITER_STATUS_INVAL:
-       case BT_NOTIF_ITER_STATUS_ERROR:
+       case BT_MSG_ITER_STATUS_INVAL:
+       case BT_MSG_ITER_STATUS_ERROR:
        default:
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                break;
        }
        return status;
@@ -745,20 +745,20 @@ int ctf_fs_ds_file_borrow_packet_header_context_fields(
                bt_field **packet_header_field,
                bt_field **packet_context_field)
 {
-       enum bt_notif_iter_status notif_iter_status;
+       enum bt_msg_iter_status msg_iter_status;
        int ret = 0;
 
        BT_ASSERT(ds_file);
-       notif_iter_status = bt_notif_iter_borrow_packet_header_context_fields(
-               ds_file->notif_iter, packet_header_field, packet_context_field);
-       switch (notif_iter_status) {
-       case BT_NOTIF_ITER_STATUS_EOF:
-       case BT_NOTIF_ITER_STATUS_OK:
+       msg_iter_status = bt_msg_iter_borrow_packet_header_context_fields(
+               ds_file->msg_iter, packet_header_field, packet_context_field);
+       switch (msg_iter_status) {
+       case BT_MSG_ITER_STATUS_EOF:
+       case BT_MSG_ITER_STATUS_OK:
                break;
-       case BT_NOTIF_ITER_STATUS_AGAIN:
+       case BT_MSG_ITER_STATUS_AGAIN:
                abort();
-       case BT_NOTIF_ITER_STATUS_INVAL:
-       case BT_NOTIF_ITER_STATUS_ERROR:
+       case BT_MSG_ITER_STATUS_INVAL:
+       case BT_MSG_ITER_STATUS_ERROR:
        default:
                goto error;
                break;
index d8e6ff99f8336c0bf3777cb15754af229d0a0201..544e35591660c9c47ee4c78c07c1b1f39e23326f 100644 (file)
@@ -29,7 +29,7 @@
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/babeltrace.h>
 
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 #include "lttng-index.h"
 
 struct ctf_fs_component;
@@ -91,7 +91,7 @@ struct ctf_fs_ds_file {
        struct ctf_fs_metadata *metadata;
 
        /* Weak */
-       bt_self_notification_iterator *pc_notif_iter;
+       bt_self_message_iterator *pc_msg_iter;
 
        /* Owned by this */
        struct ctf_fs_file *file;
@@ -100,7 +100,7 @@ struct ctf_fs_ds_file {
        bt_stream *stream;
 
        /* Weak */
-       struct bt_notif_iter *notif_iter;
+       struct bt_msg_iter *msg_iter;
 
        void *mmap_addr;
 
@@ -128,8 +128,8 @@ struct ctf_fs_ds_file {
 BT_HIDDEN
 struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                struct ctf_fs_trace *ctf_fs_trace,
-               bt_self_notification_iterator *pc_notif_iter,
-               struct bt_notif_iter *notif_iter,
+               bt_self_message_iterator *pc_msg_iter,
+               struct bt_msg_iter *msg_iter,
                bt_stream *stream, const char *path);
 
 BT_HIDDEN
@@ -142,9 +142,9 @@ BT_HIDDEN
 void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
 
 BT_HIDDEN
-enum bt_notification_iterator_status ctf_fs_ds_file_next(
+enum bt_message_iterator_status ctf_fs_ds_file_next(
                struct ctf_fs_ds_file *ds_file,
-               bt_notification **notif);
+               bt_message **msg);
 
 BT_HIDDEN
 struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
@@ -153,6 +153,6 @@ struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
 BT_HIDDEN
 void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
 
-extern struct bt_notif_iter_medium_ops ctf_fs_ds_file_medops;
+extern struct bt_msg_iter_medium_ops ctf_fs_ds_file_medops;
 
 #endif /* CTF_FS_DS_FILE_H */
index b612d2c6809ff8d2fb423fca5ae9771b36c6fe71..5b15ffa2491a57e4349f2c7909c985b12bf7710b 100644 (file)
@@ -37,7 +37,7 @@
 #include "data-stream-file.h"
 #include "file.h"
 #include "../common/metadata/decoder.h"
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 #include "../common/utils/utils.h"
 #include "query.h"
 
 #include "logging.h"
 
 static
-int notif_iter_data_set_current_ds_file(struct ctf_fs_notif_iter_data *notif_iter_data)
+int msg_iter_data_set_current_ds_file(struct ctf_fs_msg_iter_data *msg_iter_data)
 {
        struct ctf_fs_ds_file_info *ds_file_info;
        int ret = 0;
 
-       BT_ASSERT(notif_iter_data->ds_file_info_index <
-               notif_iter_data->ds_file_group->ds_file_infos->len);
+       BT_ASSERT(msg_iter_data->ds_file_info_index <
+               msg_iter_data->ds_file_group->ds_file_infos->len);
        ds_file_info = g_ptr_array_index(
-               notif_iter_data->ds_file_group->ds_file_infos,
-               notif_iter_data->ds_file_info_index);
-
-       ctf_fs_ds_file_destroy(notif_iter_data->ds_file);
-       notif_iter_data->ds_file = ctf_fs_ds_file_create(
-               notif_iter_data->ds_file_group->ctf_fs_trace,
-               notif_iter_data->pc_notif_iter,
-               notif_iter_data->notif_iter,
-               notif_iter_data->ds_file_group->stream,
+               msg_iter_data->ds_file_group->ds_file_infos,
+               msg_iter_data->ds_file_info_index);
+
+       ctf_fs_ds_file_destroy(msg_iter_data->ds_file);
+       msg_iter_data->ds_file = ctf_fs_ds_file_create(
+               msg_iter_data->ds_file_group->ctf_fs_trace,
+               msg_iter_data->pc_msg_iter,
+               msg_iter_data->msg_iter,
+               msg_iter_data->ds_file_group->stream,
                ds_file_info->path->str);
-       if (!notif_iter_data->ds_file) {
+       if (!msg_iter_data->ds_file) {
                ret = -1;
        }
 
@@ -71,121 +71,121 @@ int notif_iter_data_set_current_ds_file(struct ctf_fs_notif_iter_data *notif_ite
 }
 
 static
-void ctf_fs_notif_iter_data_destroy(
-               struct ctf_fs_notif_iter_data *notif_iter_data)
+void ctf_fs_msg_iter_data_destroy(
+               struct ctf_fs_msg_iter_data *msg_iter_data)
 {
-       if (!notif_iter_data) {
+       if (!msg_iter_data) {
                return;
        }
 
-       ctf_fs_ds_file_destroy(notif_iter_data->ds_file);
+       ctf_fs_ds_file_destroy(msg_iter_data->ds_file);
 
-       if (notif_iter_data->notif_iter) {
-               bt_notif_iter_destroy(notif_iter_data->notif_iter);
+       if (msg_iter_data->msg_iter) {
+               bt_msg_iter_destroy(msg_iter_data->msg_iter);
        }
 
-       g_free(notif_iter_data);
+       g_free(msg_iter_data);
 }
 
 static
-enum bt_self_notification_iterator_status ctf_fs_iterator_next_one(
-               struct ctf_fs_notif_iter_data *notif_iter_data,
-               const bt_notification **notif)
+enum bt_self_message_iterator_status ctf_fs_iterator_next_one(
+               struct ctf_fs_msg_iter_data *msg_iter_data,
+               const bt_message **msg)
 {
-       enum bt_self_notification_iterator_status status;
-       bt_notification *priv_notif;
+       enum bt_self_message_iterator_status status;
+       bt_message *priv_msg;
        int ret;
 
-       BT_ASSERT(notif_iter_data->ds_file);
-       status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif);
-       *notif = priv_notif;
+       BT_ASSERT(msg_iter_data->ds_file);
+       status = ctf_fs_ds_file_next(msg_iter_data->ds_file, &priv_msg);
+       *msg = priv_msg;
 
-       if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK &&
-                       bt_notification_get_type(*notif) ==
-                       BT_NOTIFICATION_TYPE_STREAM_BEGINNING) {
-               if (notif_iter_data->skip_stream_begin_notifs) {
+       if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK &&
+                       bt_message_get_type(*msg) ==
+                       BT_MESSAGE_TYPE_STREAM_BEGINNING) {
+               if (msg_iter_data->skip_stream_begin_msgs) {
                        /*
                         * We already emitted a
-                        * BT_NOTIFICATION_TYPE_STREAM_BEGINNING
-                        * notification: skip this one, get a new one.
+                        * BT_MESSAGE_TYPE_STREAM_BEGINNING
+                        * message: skip this one, get a new one.
                         */
-                       BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
-                       status = ctf_fs_ds_file_next(notif_iter_data->ds_file,
-                               &priv_notif);
-                       *notif = priv_notif;
-                       BT_ASSERT(status != BT_SELF_NOTIFICATION_ITERATOR_STATUS_END);
+                       BT_MESSAGE_PUT_REF_AND_RESET(*msg);
+                       status = ctf_fs_ds_file_next(msg_iter_data->ds_file,
+                               &priv_msg);
+                       *msg = priv_msg;
+                       BT_ASSERT(status != BT_SELF_MESSAGE_ITERATOR_STATUS_END);
                        goto end;
                } else {
                        /*
-                        * First BT_NOTIFICATION_TYPE_STREAM_BEGINNING
-                        * notification: skip all following.
+                        * First BT_MESSAGE_TYPE_STREAM_BEGINNING
+                        * message: skip all following.
                         */
-                       notif_iter_data->skip_stream_begin_notifs = true;
+                       msg_iter_data->skip_stream_begin_msgs = true;
                        goto end;
                }
        }
 
-       if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK &&
-                       bt_notification_get_type(*notif) ==
-                       BT_NOTIFICATION_TYPE_STREAM_END) {
-               notif_iter_data->ds_file_info_index++;
+       if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK &&
+                       bt_message_get_type(*msg) ==
+                       BT_MESSAGE_TYPE_STREAM_END) {
+               msg_iter_data->ds_file_info_index++;
 
-               if (notif_iter_data->ds_file_info_index ==
-                               notif_iter_data->ds_file_group->ds_file_infos->len) {
+               if (msg_iter_data->ds_file_info_index ==
+                               msg_iter_data->ds_file_group->ds_file_infos->len) {
                        /*
                         * No more stream files to read: we reached the
                         * real end. Emit this
-                        * BT_NOTIFICATION_TYPE_STREAM_END notification.
+                        * BT_MESSAGE_TYPE_STREAM_END message.
                         * The next time ctf_fs_iterator_next() is
-                        * called for this notification iterator,
+                        * called for this message iterator,
                         * ctf_fs_ds_file_next() will return
-                        * BT_SELF_NOTIFICATION_ITERATOR_STATUS_END().
+                        * BT_SELF_MESSAGE_ITERATOR_STATUS_END().
                         */
                        goto end;
                }
 
-               BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
-               bt_notif_iter_reset(notif_iter_data->notif_iter);
+               BT_MESSAGE_PUT_REF_AND_RESET(*msg);
+               bt_msg_iter_reset(msg_iter_data->msg_iter);
 
                /*
                 * Open and start reading the next stream file within
                 * our stream file group.
                 */
-               ret = notif_iter_data_set_current_ds_file(notif_iter_data);
+               ret = msg_iter_data_set_current_ds_file(msg_iter_data);
                if (ret) {
-                       status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                       status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                        goto end;
                }
 
-               status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif);
-               *notif = priv_notif;
+               status = ctf_fs_ds_file_next(msg_iter_data->ds_file, &priv_msg);
+               *msg = priv_msg;
 
                /*
-                * If we get a notification, we expect to get a
-                * BT_NOTIFICATION_TYPE_STREAM_BEGINNING notification
+                * If we get a message, we expect to get a
+                * BT_MESSAGE_TYPE_STREAM_BEGINNING message
                 * because the iterator's state machine emits one before
                 * even requesting the first block of data from the
-                * medium. Skip this notification because we're not
+                * medium. Skip this message because we're not
                 * really starting a new stream here, and try getting a
-                * new notification (which, if it works, is a
-                * BT_NOTIFICATION_TYPE_PACKET_BEGINNING one). We're sure to
+                * new message (which, if it works, is a
+                * BT_MESSAGE_TYPE_PACKET_BEGINNING one). We're sure to
                 * get at least one pair of
-                * BT_NOTIFICATION_TYPE_PACKET_BEGINNING and
-                * BT_NOTIFICATION_TYPE_PACKET_END notifications in the
+                * BT_MESSAGE_TYPE_PACKET_BEGINNING and
+                * BT_MESSAGE_TYPE_PACKET_END messages in the
                 * case of a single, empty packet. We know there's at
                 * least one packet because the stream file group does
                 * not contain empty stream files.
                 */
-               BT_ASSERT(notif_iter_data->skip_stream_begin_notifs);
-
-               if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
-                       BT_ASSERT(bt_notification_get_type(*notif) ==
-                               BT_NOTIFICATION_TYPE_STREAM_BEGINNING);
-                       BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
-                       status = ctf_fs_ds_file_next(notif_iter_data->ds_file,
-                               &priv_notif);
-                       *notif = priv_notif;
-                       BT_ASSERT(status != BT_SELF_NOTIFICATION_ITERATOR_STATUS_END);
+               BT_ASSERT(msg_iter_data->skip_stream_begin_msgs);
+
+               if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+                       BT_ASSERT(bt_message_get_type(*msg) ==
+                               BT_MESSAGE_TYPE_STREAM_BEGINNING);
+                       BT_MESSAGE_PUT_REF_AND_RESET(*msg);
+                       status = ctf_fs_ds_file_next(msg_iter_data->ds_file,
+                               &priv_msg);
+                       *msg = priv_msg;
+                       BT_ASSERT(status != BT_SELF_MESSAGE_ITERATOR_STATUS_END);
                }
        }
 
@@ -194,20 +194,20 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status ctf_fs_iterator_next(
-               bt_self_notification_iterator *iterator,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status ctf_fs_iterator_next(
+               bt_self_message_iterator *iterator,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       enum bt_self_notification_iterator_status status =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
-       struct ctf_fs_notif_iter_data *notif_iter_data =
-               bt_self_notification_iterator_get_data(iterator);
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+       struct ctf_fs_msg_iter_data *msg_iter_data =
+               bt_self_message_iterator_get_data(iterator);
        uint64_t i = 0;
 
-       while (i < capacity && status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
-               status = ctf_fs_iterator_next_one(notif_iter_data, &notifs[i]);
-               if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
+       while (i < capacity && status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+               status = ctf_fs_iterator_next_one(msg_iter_data, &msgs[i]);
+               if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        i++;
                }
        }
@@ -215,81 +215,81 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next(
        if (i > 0) {
                /*
                 * Even if ctf_fs_iterator_next_one() returned something
-                * else than BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK, we
-                * accumulated notification objects in the output
-                * notification array, so we need to return
-                * BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK so that they are
+                * else than BT_SELF_MESSAGE_ITERATOR_STATUS_OK, we
+                * accumulated message objects in the output
+                * message array, so we need to return
+                * BT_SELF_MESSAGE_ITERATOR_STATUS_OK so that they are
                 * transfered to downstream. This other status occurs
-                * again the next time muxer_notif_iter_do_next() is
+                * again the next time muxer_msg_iter_do_next() is
                 * called, possibly without any accumulated
-                * notification, in which case we'll return it.
+                * message, in which case we'll return it.
                 */
                *count = i;
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
        }
 
        return status;
 }
 
-void ctf_fs_iterator_finalize(bt_self_notification_iterator *it)
+void ctf_fs_iterator_finalize(bt_self_message_iterator *it)
 {
-       ctf_fs_notif_iter_data_destroy(
-               bt_self_notification_iterator_get_data(it));
+       ctf_fs_msg_iter_data_destroy(
+               bt_self_message_iterator_get_data(it));
 }
 
-enum bt_self_notification_iterator_status ctf_fs_iterator_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status ctf_fs_iterator_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port)
 {
        struct ctf_fs_port_data *port_data;
-       struct ctf_fs_notif_iter_data *notif_iter_data = NULL;
-       enum bt_self_notification_iterator_status ret =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       struct ctf_fs_msg_iter_data *msg_iter_data = NULL;
+       enum bt_self_message_iterator_status ret =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
        int iret;
 
        port_data = bt_self_component_port_get_data(
                bt_self_component_port_output_as_self_component_port(
                        self_port));
        BT_ASSERT(port_data);
-       notif_iter_data = g_new0(struct ctf_fs_notif_iter_data, 1);
-       if (!notif_iter_data) {
-               ret = BT_SELF_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+       msg_iter_data = g_new0(struct ctf_fs_msg_iter_data, 1);
+       if (!msg_iter_data) {
+               ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
                goto error;
        }
 
-       notif_iter_data->pc_notif_iter = self_notif_iter;
-       notif_iter_data->notif_iter = bt_notif_iter_create(
+       msg_iter_data->pc_msg_iter = self_msg_iter;
+       msg_iter_data->msg_iter = bt_msg_iter_create(
                port_data->ds_file_group->ctf_fs_trace->metadata->tc,
                bt_common_get_page_size() * 8,
                ctf_fs_ds_file_medops, NULL);
-       if (!notif_iter_data->notif_iter) {
-               BT_LOGE_STR("Cannot create a CTF notification iterator.");
-               ret = BT_SELF_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+       if (!msg_iter_data->msg_iter) {
+               BT_LOGE_STR("Cannot create a CTF message iterator.");
+               ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
                goto error;
        }
 
-       notif_iter_data->ds_file_group = port_data->ds_file_group;
-       iret = notif_iter_data_set_current_ds_file(notif_iter_data);
+       msg_iter_data->ds_file_group = port_data->ds_file_group;
+       iret = msg_iter_data_set_current_ds_file(msg_iter_data);
        if (iret) {
-               ret = BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                goto error;
        }
 
-       bt_self_notification_iterator_set_data(self_notif_iter,
-               notif_iter_data);
-       if (ret != BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
+       bt_self_message_iterator_set_data(self_msg_iter,
+               msg_iter_data);
+       if (ret != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                goto error;
        }
 
-       notif_iter_data = NULL;
+       msg_iter_data = NULL;
        goto end;
 
 error:
-       bt_self_notification_iterator_set_data(self_notif_iter, NULL);
+       bt_self_message_iterator_set_data(self_msg_iter, NULL);
 
 end:
-       ctf_fs_notif_iter_data_destroy(notif_iter_data);
+       ctf_fs_msg_iter_data_destroy(msg_iter_data);
        return ret;
 }
 
@@ -341,7 +341,7 @@ void ctf_fs_trace_destroy(struct ctf_fs_trace *ctf_fs_trace)
 }
 
 static
-void ctf_fs_trace_destroy_notifier(void *data)
+void ctf_fs_trace_destroy_msgier(void *data)
 {
        struct ctf_fs_trace *trace = data;
        ctf_fs_trace_destroy(trace);
@@ -623,18 +623,18 @@ int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace,
        size_t i;
        struct ctf_fs_ds_file *ds_file = NULL;
        struct ctf_fs_ds_index *index = NULL;
-       struct bt_notif_iter *notif_iter = NULL;
+       struct bt_msg_iter *msg_iter = NULL;
        struct ctf_stream_class *sc = NULL;
-       struct bt_notif_iter_packet_properties props;
+       struct bt_msg_iter_packet_properties props;
 
-       notif_iter = bt_notif_iter_create(ctf_fs_trace->metadata->tc,
+       msg_iter = bt_msg_iter_create(ctf_fs_trace->metadata->tc,
                bt_common_get_page_size() * 8, ctf_fs_ds_file_medops, NULL);
-       if (!notif_iter) {
-               BT_LOGE_STR("Cannot create a CTF notification iterator.");
+       if (!msg_iter) {
+               BT_LOGE_STR("Cannot create a CTF message iterator.");
                goto error;
        }
 
-       ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, notif_iter,
+       ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, msg_iter,
                NULL, path);
        if (!ds_file) {
                goto error;
@@ -648,7 +648,7 @@ int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace,
                goto error;
        }
 
-       ret = bt_notif_iter_get_packet_properties(ds_file->notif_iter, &props);
+       ret = bt_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
        BT_ASSERT(ret == 0);
        sc = ctf_trace_class_borrow_stream_class_by_id(ds_file->metadata->tc,
                props.stream_class_id);
@@ -757,8 +757,8 @@ end:
 
        ctf_fs_ds_file_destroy(ds_file);
 
-       if (notif_iter) {
-               bt_notif_iter_destroy(notif_iter);
+       if (msg_iter) {
+               bt_msg_iter_destroy(msg_iter);
        }
 
        ctf_fs_ds_index_destroy(index);
@@ -1361,7 +1361,7 @@ struct ctf_fs_component *ctf_fs_create(
        }
 
        ctf_fs->traces = g_ptr_array_new_with_free_func(
-                       ctf_fs_trace_destroy_notifier);
+                       ctf_fs_trace_destroy_msgier);
        if (!ctf_fs->traces) {
                goto error;
        }
index 1660169389e582b58ad290d01a125303e1aeffe0..bbcf48eead7f82e5bf46ba23cf04699e7d5c1d9b 100644 (file)
@@ -134,9 +134,9 @@ struct ctf_fs_port_data {
        struct ctf_fs_component *ctf_fs;
 };
 
-struct ctf_fs_notif_iter_data {
+struct ctf_fs_msg_iter_data {
        /* Weak */
-       bt_self_notification_iterator *pc_notif_iter;
+       bt_self_message_iterator *pc_msg_iter;
 
        /* Weak, belongs to ctf_fs_trace */
        struct ctf_fs_ds_file_group *ds_file_group;
@@ -148,10 +148,10 @@ struct ctf_fs_notif_iter_data {
        size_t ds_file_info_index;
 
        /* Owned by this */
-       struct bt_notif_iter *notif_iter;
+       struct bt_msg_iter *msg_iter;
 
-       /* True to skip BT_NOTIFICATION_TYPE_STREAM_BEGINNING notifications */
-       bool skip_stream_begin_notifs;
+       /* True to skip BT_MESSAGE_TYPE_STREAM_BEGINNING messages */
+       bool skip_stream_begin_msgs;
 };
 
 BT_HIDDEN
@@ -183,18 +183,18 @@ BT_HIDDEN
 GList *ctf_fs_create_trace_names(GList *trace_paths, const char *base_path);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status ctf_fs_iterator_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status ctf_fs_iterator_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port);
 
 BT_HIDDEN
-void ctf_fs_iterator_finalize(bt_self_notification_iterator *it);
+void ctf_fs_iterator_finalize(bt_self_message_iterator *it);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status ctf_fs_iterator_next(
-               bt_self_notification_iterator *iterator,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status ctf_fs_iterator_next(
+               bt_self_message_iterator *iterator,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count);
 
 #endif /* BABELTRACE_PLUGIN_CTF_FS_H */
index c0233e1195834d5cdcba8c1d2e0c64e9728d60f8..54eb9dfc626a308ebf55ce91a74687e135597e28 100644 (file)
 #include <inttypes.h>
 #include <babeltrace/compat/mman-internal.h>
 #include <babeltrace/babeltrace.h>
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 #include <babeltrace/assert-internal.h>
 
 #include "data-stream.h"
 
 static
-enum bt_notif_iter_medium_status medop_request_bytes(
+enum bt_msg_iter_medium_status medop_request_bytes(
                size_t request_sz, uint8_t **buffer_addr,
                size_t *buffer_sz, void *data)
 {
-       enum bt_notif_iter_medium_status status =
-               BT_NOTIF_ITER_MEDIUM_STATUS_OK;
+       enum bt_msg_iter_medium_status status =
+               BT_MSG_ITER_MEDIUM_STATUS_OK;
        struct lttng_live_stream_iterator *stream = data;
        struct lttng_live_trace *trace = stream->trace;
        struct lttng_live_session *session = trace->session;
@@ -57,7 +57,7 @@ enum bt_notif_iter_medium_status medop_request_bytes(
        len_left = stream->base_offset + stream->len - stream->offset;
        if (!len_left) {
                stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
-               status = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN;
+               status = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
                return status;
        }
        read_len = MIN(request_sz, stream->buflen);
@@ -105,19 +105,19 @@ const bt_stream *medop_get_stream(
        return lttng_live_stream->stream;
 }
 
-static struct bt_notif_iter_medium_ops medops = {
+static struct bt_msg_iter_medium_ops medops = {
        .request_bytes = medop_request_bytes,
        .get_stream = medop_get_stream,
 };
 
 BT_HIDDEN
-enum bt_lttng_live_iterator_status lttng_live_lazy_notif_init(
+enum bt_lttng_live_iterator_status lttng_live_lazy_msg_init(
                struct lttng_live_session *session)
 {
        struct lttng_live_component *lttng_live = session->lttng_live;
        struct lttng_live_trace *trace;
 
-       if (!session->lazy_stream_notif_init) {
+       if (!session->lazy_stream_msg_init) {
                return BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
        }
 
@@ -125,19 +125,19 @@ enum bt_lttng_live_iterator_status lttng_live_lazy_notif_init(
                struct lttng_live_stream_iterator *stream;
 
                bt_list_for_each_entry(stream, &trace->streams, node) {
-                       if (stream->notif_iter) {
+                       if (stream->msg_iter) {
                                continue;
                        }
-                       stream->notif_iter = bt_notif_iter_create(trace->trace,
+                       stream->msg_iter = bt_msg_iter_create(trace->trace,
                                        lttng_live->max_query_size, medops,
                                        stream);
-                       if (!stream->notif_iter) {
+                       if (!stream->msg_iter) {
                                goto error;
                        }
                }
        }
 
-       session->lazy_stream_notif_init = false;
+       session->lazy_stream_msg_init = false;
 
        return BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
 
@@ -170,10 +170,10 @@ struct lttng_live_stream_iterator *lttng_live_stream_iterator_create(
        stream->last_returned_inactivity_timestamp = INT64_MIN;
 
        if (trace->trace) {
-               stream->notif_iter = bt_notif_iter_create(trace->trace,
+               stream->msg_iter = bt_msg_iter_create(trace->trace,
                                lttng_live->max_query_size, medops,
                                stream);
-               if (!stream->notif_iter) {
+               if (!stream->msg_iter) {
                        goto error;
                }
        }
@@ -212,11 +212,11 @@ void lttng_live_stream_iterator_destroy(struct lttng_live_stream_iterator *strea
                BT_OBJECT_PUT_REF_AND_RESET(stream->stream);
        }
 
-       if (stream->notif_iter) {
-               bt_notif_iter_destroy(stream->notif_iter);
+       if (stream->msg_iter) {
+               bt_msg_iter_destroy(stream->msg_iter);
        }
        g_free(stream->buf);
-       BT_OBJECT_PUT_REF_AND_RESET(stream->packet_end_notif_queue);
+       BT_OBJECT_PUT_REF_AND_RESET(stream->packet_end_msg_queue);
        bt_list_del(&stream->node);
        /*
         * Ensure we poke the trace metadata in the future, which is
index f36e787ca0fe09a2a4775023eadf28a3c2940380..3812315ed7cf46d9bcb0f1db219e4af5f6df3d56 100644 (file)
@@ -29,9 +29,9 @@
 #include <babeltrace/babeltrace.h>
 
 #include "lttng-live-internal.h"
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 
-enum bt_lttng_live_iterator_status lttng_live_lazy_notif_init(
+enum bt_lttng_live_iterator_status lttng_live_lazy_msg_init(
                struct lttng_live_session *session);
 
 struct lttng_live_stream_iterator *lttng_live_stream_iterator_create(
index d9c328d3d3a965dcb7773a8dbeeef35c042892d5..f8923a744df25b94d9053527ca25e74c5e65945d 100644 (file)
@@ -78,9 +78,9 @@ struct lttng_live_stream_iterator {
 
        /*
         * Since only a single iterator per viewer connection, we have
-        * only a single notification iterator per stream.
+        * only a single message iterator per stream.
         */
-       struct bt_notif_iter *notif_iter;
+       struct bt_msg_iter *msg_iter;
 
        uint64_t viewer_stream_id;
 
@@ -95,7 +95,7 @@ struct lttng_live_stream_iterator {
        enum lttng_live_stream_state state;
 
        uint64_t current_packet_end_timestamp;
-       const bt_notification *packet_end_notif_queue;
+       const bt_message *packet_end_msg_queue;
 
        uint8_t *buf;
        size_t buflen;
@@ -165,7 +165,7 @@ struct lttng_live_session {
 
        bool attached;
        bool new_streams_needed;
-       bool lazy_stream_notif_init;
+       bool lazy_stream_msg_init;
        bool closed;
 };
 
@@ -193,7 +193,7 @@ struct lttng_live_component {
 enum bt_lttng_live_iterator_status {
        /** Iterator state has progressed. Continue iteration immediately. */
        BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE = 3,
-       /** No notification available for now. Try again later. */
+       /** No message available for now. Try again later. */
        BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN = 2,
        /** No more CTF_LTTNG_LIVEs to be delivered. */
        BT_LTTNG_LIVE_ITERATOR_STATUS_END = 1,
@@ -219,19 +219,19 @@ bt_component_class_query_method_return lttng_live_query(
 
 void lttng_live_component_finalize(bt_self_component *component);
 
-bt_notification_iterator_next_method_return lttng_live_iterator_next(
-        bt_self_notification_iterator *iterator);
+bt_message_iterator_next_method_return lttng_live_iterator_next(
+        bt_self_message_iterator *iterator);
 
 enum bt_component_status lttng_live_accept_port_connection(
                bt_self_component *private_component,
                struct bt_private_port *self_private_port,
                const bt_port *other_port);
 
-enum bt_notification_iterator_status lttng_live_iterator_init(
-               bt_self_notification_iterator *it,
+enum bt_message_iterator_status lttng_live_iterator_init(
+               bt_self_message_iterator *it,
                struct bt_private_port *port);
 
-void lttng_live_iterator_finalize(bt_self_notification_iterator *it);
+void lttng_live_iterator_finalize(bt_self_message_iterator *it);
 
 int lttng_live_create_viewer_session(struct lttng_live_component *lttng_live);
 int lttng_live_attach_session(struct lttng_live_session *session);
@@ -250,7 +250,7 @@ enum bt_lttng_live_iterator_status lttng_live_get_next_index(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream,
                struct packet_index *index);
-enum bt_notif_iter_medium_status lttng_live_get_stream_bytes(
+enum bt_msg_iter_medium_status lttng_live_get_stream_bytes(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream, uint8_t *buf, uint64_t offset,
                uint64_t req_len, uint64_t *recv_len);
index ff646bb23ecbbc49ae52ec3fb1f440438606eb63..1bc5dc60ce865dc6501d69998e3d5f7266a6a660 100644 (file)
@@ -339,10 +339,10 @@ void lttng_live_destroy_session(struct lttng_live_session *session)
 }
 
 BT_HIDDEN
-void lttng_live_iterator_finalize(bt_self_notification_iterator *it)
+void lttng_live_iterator_finalize(bt_self_message_iterator *it)
 {
        struct lttng_live_stream_iterator_generic *s =
-                       bt_self_notification_iterator_get_user_data(it);
+                       bt_self_message_iterator_get_user_data(it);
 
        switch (s->type) {
        case LIVE_STREAM_TYPE_NO_STREAM:
@@ -442,11 +442,11 @@ end:
 }
 
 /*
- * Creation of the notification requires the ctf trace to be created
+ * Creation of the message requires the ctf trace to be created
  * beforehand, but the live protocol gives us all streams (including
  * metadata) at once. So we split it in three steps: getting streams,
  * getting metadata (which creates the ctf trace), and then creating the
- * per-stream notifications.
+ * per-stream messages.
  */
 static
 enum bt_lttng_live_iterator_status lttng_live_get_session(
@@ -475,7 +475,7 @@ enum bt_lttng_live_iterator_status lttng_live_get_session(
                        return status;
                }
        }
-       return lttng_live_lazy_notif_init(session);
+       return lttng_live_lazy_msg_init(session);
 }
 
 BT_HIDDEN
@@ -553,10 +553,10 @@ end:
 }
 
 static
-enum bt_lttng_live_iterator_status emit_inactivity_notification(
+enum bt_lttng_live_iterator_status emit_inactivity_message(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *lttng_live_stream,
-               const bt_notification **notification,
+               const bt_message **message,
                uint64_t timestamp)
 {
        enum bt_lttng_live_iterator_status ret =
@@ -564,7 +564,7 @@ enum bt_lttng_live_iterator_status emit_inactivity_notification(
        struct lttng_live_trace *trace;
        const bt_clock_class *clock_class = NULL;
        bt_clock_value *clock_value = NULL;
-       const bt_notification *notif = NULL;
+       const bt_message *msg = NULL;
        int retval;
 
        trace = lttng_live_stream->trace;
@@ -579,15 +579,15 @@ enum bt_lttng_live_iterator_status emit_inactivity_notification(
        if (!clock_value) {
                goto error;
        }
-       notif = bt_notification_inactivity_create(trace->cc_prio_map);
-       if (!notif) {
+       msg = bt_message_inactivity_create(trace->cc_prio_map);
+       if (!msg) {
                goto error;
        }
-       retval = bt_notification_inactivity_set_clock_value(notif, clock_value);
+       retval = bt_message_inactivity_set_clock_value(msg, clock_value);
        if (retval) {
                goto error;
        }
-       *notification = notif;
+       *message = msg;
 end:
        bt_object_put_ref(clock_value);
        bt_clock_class_put_ref(clock_class);
@@ -595,7 +595,7 @@ end:
 
 error:
        ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
-       bt_notification_put_ref(notif);
+       bt_message_put_ref(msg);
        goto end;
 }
 
@@ -603,7 +603,7 @@ static
 enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *lttng_live_stream,
-               const bt_notification **notification)
+               const bt_message **message)
 {
        enum bt_lttng_live_iterator_status ret =
                        BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
@@ -621,7 +621,7 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent
                goto end;
        }
 
-       ret = emit_inactivity_notification(lttng_live, lttng_live_stream, notification,
+       ret = emit_inactivity_message(lttng_live, lttng_live_stream, message,
                        (uint64_t) lttng_live_stream->current_inactivity_timestamp);
 
        lttng_live_stream->last_returned_inactivity_timestamp =
@@ -636,11 +636,11 @@ static
 enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *lttng_live_stream,
-               const bt_notification **notification)
+               const bt_message **message)
 {
        enum bt_lttng_live_iterator_status ret =
                        BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
-       enum bt_notif_iter_status status;
+       enum bt_msg_iter_status status;
        struct lttng_live_session *session;
 
        bt_list_for_each_entry(session, &lttng_live->sessions, node) {
@@ -659,36 +659,36 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_da
        if (lttng_live_stream->state != LTTNG_LIVE_STREAM_ACTIVE_DATA) {
                return BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
        }
-       if (lttng_live_stream->packet_end_notif_queue) {
-               *notification = lttng_live_stream->packet_end_notif_queue;
-               lttng_live_stream->packet_end_notif_queue = NULL;
-               status = BT_NOTIF_ITER_STATUS_OK;
+       if (lttng_live_stream->packet_end_msg_queue) {
+               *message = lttng_live_stream->packet_end_msg_queue;
+               lttng_live_stream->packet_end_msg_queue = NULL;
+               status = BT_MSG_ITER_STATUS_OK;
        } else {
-               status = bt_notif_iter_get_next_notification(
-                               lttng_live_stream->notif_iter,
+               status = bt_msg_iter_get_next_message(
+                               lttng_live_stream->msg_iter,
                                lttng_live_stream->trace->cc_prio_map,
-                               notification);
-               if (status == BT_NOTIF_ITER_STATUS_OK) {
+                               message);
+               if (status == BT_MSG_ITER_STATUS_OK) {
                        /*
                         * Consider empty packets as inactivity.
                         */
-                       if (bt_notification_get_type(*notification) == BT_NOTIFICATION_TYPE_PACKET_END) {
-                               lttng_live_stream->packet_end_notif_queue = *notification;
-                               *notification = NULL;
-                               return emit_inactivity_notification(lttng_live,
-                                               lttng_live_stream, notification,
+                       if (bt_message_get_type(*message) == BT_MESSAGE_TYPE_PACKET_END) {
+                               lttng_live_stream->packet_end_msg_queue = *message;
+                               *message = NULL;
+                               return emit_inactivity_message(lttng_live,
+                                               lttng_live_stream, message,
                                                lttng_live_stream->current_packet_end_timestamp);
                        }
                }
        }
        switch (status) {
-       case BT_NOTIF_ITER_STATUS_EOF:
+       case BT_MSG_ITER_STATUS_EOF:
                ret = BT_LTTNG_LIVE_ITERATOR_STATUS_END;
                break;
-       case BT_NOTIF_ITER_STATUS_OK:
+       case BT_MSG_ITER_STATUS_OK:
                ret = BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
                break;
-       case BT_NOTIF_ITER_STATUS_AGAIN:
+       case BT_MSG_ITER_STATUS_AGAIN:
                /*
                 * Continue immediately (end of packet). The next
                 * get_index may return AGAIN to delay the following
@@ -696,9 +696,9 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_da
                 */
                ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE;
                break;
-       case BT_NOTIF_ITER_STATUS_INVAL:
+       case BT_MSG_ITER_STATUS_INVAL:
                /* No argument provided by the user, so don't return INVAL. */
-       case BT_NOTIF_ITER_STATUS_ERROR:
+       case BT_MSG_ITER_STATUS_ERROR:
        default:
                ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
                break;
@@ -741,7 +741,7 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_da
  *            handle_active_data_streams()
  *                - if at least one stream is ACTIVE_DATA:
  *                    - get stream event with lowest timestamp from heap
- *                    - make that stream event the current notification.
+ *                    - make that stream event the current message.
  *                    - move this stream heap position to its next event
  *                      - if we need to fetch data from relayd, move
  *                        stream to ACTIVE_NO_DATA.
@@ -755,18 +755,18 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_da
  * When disconnected from relayd: try to re-connect endlessly.
  */
 static
-bt_notification_iterator_next_method_return lttng_live_iterator_next_stream(
-               bt_self_notification_iterator *iterator,
+bt_message_iterator_next_method_return lttng_live_iterator_next_stream(
+               bt_self_message_iterator *iterator,
                struct lttng_live_stream_iterator *stream_iter)
 {
        enum bt_lttng_live_iterator_status status;
-       bt_notification_iterator_next_method_return next_return;
+       bt_message_iterator_next_method_return next_return;
        struct lttng_live_component *lttng_live;
 
        lttng_live = stream_iter->trace->session->lttng_live;
 retry:
        print_stream_state(stream_iter);
-       next_return.notification = NULL;
+       next_return.message = NULL;
        status = lttng_live_iterator_next_handle_new_streams_and_metadata(lttng_live);
        if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) {
                goto end;
@@ -777,18 +777,18 @@ retry:
                goto end;
        }
        status = lttng_live_iterator_next_handle_one_quiescent_stream(
-                       lttng_live, stream_iter, &next_return.notification);
+                       lttng_live, stream_iter, &next_return.message);
        if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) {
-               BT_ASSERT(next_return.notification == NULL);
+               BT_ASSERT(next_return.message == NULL);
                goto end;
        }
-       if (next_return.notification) {
+       if (next_return.message) {
                goto end;
        }
        status = lttng_live_iterator_next_handle_one_active_data_stream(lttng_live,
-                       stream_iter, &next_return.notification);
+                       stream_iter, &next_return.message);
        if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) {
-               BT_ASSERT(next_return.notification == NULL);
+               BT_ASSERT(next_return.message == NULL);
        }
 
 end:
@@ -797,47 +797,47 @@ end:
                print_dbg("continue");
                goto retry;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_AGAIN;
                print_dbg("again");
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_END:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_END;
                print_dbg("end");
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_OK:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_OK;
                print_dbg("ok");
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_INVALID;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_UNSUPPORTED;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR:
        default:        /* fall-through */
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                break;
        }
        return next_return;
 }
 
 static
-bt_notification_iterator_next_method_return lttng_live_iterator_next_no_stream(
-               bt_self_notification_iterator *iterator,
+bt_message_iterator_next_method_return lttng_live_iterator_next_no_stream(
+               bt_self_message_iterator *iterator,
                struct lttng_live_no_stream_iterator *no_stream_iter)
 {
        enum bt_lttng_live_iterator_status status;
-       bt_notification_iterator_next_method_return next_return;
+       bt_message_iterator_next_method_return next_return;
        struct lttng_live_component *lttng_live;
 
        lttng_live = no_stream_iter->lttng_live;
 retry:
        lttng_live_force_new_streams_and_metadata(lttng_live);
-       next_return.notification = NULL;
+       next_return.message = NULL;
        status = lttng_live_iterator_next_handle_new_streams_and_metadata(lttng_live);
        if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) {
                goto end;
@@ -852,35 +852,35 @@ end:
        case BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE:
                goto retry;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_AGAIN;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_END:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_END;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_INVALID;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_UNSUPPORTED;
                break;
        case BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR:
        default:        /* fall-through */
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                break;
        }
        return next_return;
 }
 
 BT_HIDDEN
-bt_notification_iterator_next_method_return lttng_live_iterator_next(
-               bt_self_notification_iterator *iterator)
+bt_message_iterator_next_method_return lttng_live_iterator_next(
+               bt_self_message_iterator *iterator)
 {
        struct lttng_live_stream_iterator_generic *s =
-                       bt_self_notification_iterator_get_user_data(iterator);
-       bt_notification_iterator_next_method_return next_return;
+                       bt_self_message_iterator_get_user_data(iterator);
+       bt_message_iterator_next_method_return next_return;
 
        switch (s->type) {
        case LIVE_STREAM_TYPE_NO_STREAM:
@@ -892,19 +892,19 @@ bt_notification_iterator_next_method_return lttng_live_iterator_next(
                        container_of(s, struct lttng_live_stream_iterator, p));
                break;
        default:
-               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               next_return.status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                break;
        }
        return next_return;
 }
 
 BT_HIDDEN
-enum bt_notification_iterator_status lttng_live_iterator_init(
-               bt_self_notification_iterator *it,
+enum bt_message_iterator_status lttng_live_iterator_init(
+               bt_self_message_iterator *it,
                struct bt_private_port *port)
 {
-       enum bt_notification_iterator_status ret =
-                       BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status ret =
+                       BT_MESSAGE_ITERATOR_STATUS_OK;
        struct lttng_live_stream_iterator_generic *s;
 
        BT_ASSERT(it);
@@ -916,7 +916,7 @@ enum bt_notification_iterator_status lttng_live_iterator_init(
        {
                struct lttng_live_no_stream_iterator *no_stream_iter =
                        container_of(s, struct lttng_live_no_stream_iterator, p);
-               ret = bt_self_notification_iterator_set_user_data(it, no_stream_iter);
+               ret = bt_self_message_iterator_set_user_data(it, no_stream_iter);
                if (ret) {
                        goto error;
                }
@@ -926,22 +926,22 @@ enum bt_notification_iterator_status lttng_live_iterator_init(
        {
                struct lttng_live_stream_iterator *stream_iter =
                        container_of(s, struct lttng_live_stream_iterator, p);
-               ret = bt_self_notification_iterator_set_user_data(it, stream_iter);
+               ret = bt_self_message_iterator_set_user_data(it, stream_iter);
                if (ret) {
                        goto error;
                }
                break;
        }
        default:
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
 end:
        return ret;
 error:
-       if (bt_self_notification_iterator_set_user_data(it, NULL)
-                       != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+       if (bt_self_message_iterator_set_user_data(it, NULL)
+                       != BT_MESSAGE_ITERATOR_STATUS_OK) {
                BT_LOGE("Error setting private data to NULL");
        }
        goto end;
index 71047f8c79d2175c764ae2f435f5616abf7006d4..79b056950e44a22e954376eb83c0e540a98c2992 100644 (file)
@@ -90,7 +90,7 @@ enum lttng_viewer_get_metadata_return_code {
 
 enum lttng_viewer_connection_type {
        LTTNG_VIEWER_CLIENT_COMMAND             = 1,
-       LTTNG_VIEWER_CLIENT_NOTIFICATION        = 2,
+       LTTNG_VIEWER_CLIENT_MESSAGE     = 2,
 };
 
 enum lttng_viewer_seek {
index 2549875013a01c7bf39fdc3a9844ecd764f28027..b40289780f8a6adb9a9a5a38278ec814ddc74297 100644 (file)
@@ -770,7 +770,7 @@ int receive_streams(struct lttng_live_session *session,
 
                                goto error;
                        }
-                       session->lazy_stream_notif_init = true;
+                       session->lazy_stream_msg_init = true;
                } else {
                        BT_LOGD("    stream %" PRIu64 " : %s/%s",
                                        stream_id, stream.path_name,
@@ -1212,11 +1212,11 @@ error:
 }
 
 BT_HIDDEN
-enum bt_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_component *lttng_live,
+enum bt_msg_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream, uint8_t *buf, uint64_t offset,
                uint64_t req_len, uint64_t *recv_len)
 {
-       enum bt_notif_iter_medium_status retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_OK;
+       enum bt_msg_iter_medium_status retstatus = BT_MSG_ITER_MEDIUM_STATUS_OK;
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_packet rq;
        struct lttng_viewer_trace_packet rp;
@@ -1280,7 +1280,7 @@ enum bt_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_c
        case LTTNG_VIEWER_GET_PACKET_RETRY:
                /* Unimplemented by relay daemon */
                BT_LOGD("get_data_packet: retry");
-               retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN;
+               retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
                goto end;
        case LTTNG_VIEWER_GET_PACKET_ERR:
                if (flags & LTTNG_VIEWER_FLAG_NEW_METADATA) {
@@ -1293,13 +1293,13 @@ enum bt_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_c
                }
                if (flags & (LTTNG_VIEWER_FLAG_NEW_METADATA
                                | LTTNG_VIEWER_FLAG_NEW_STREAM)) {
-                       retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN;
+                       retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
                        goto end;
                }
                BT_LOGE("get_data_packet: error");
                goto error;
        case LTTNG_VIEWER_GET_PACKET_EOF:
-               retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_EOF;
+               retstatus = BT_MSG_ITER_MEDIUM_STATUS_EOF;
                goto end;
        default:
                BT_LOGE("get_data_packet: unknown");
@@ -1326,9 +1326,9 @@ end:
 
 error:
        if (lttng_live_is_canceled(lttng_live)) {
-               retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN;
+               retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
        } else {
-               retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR;
+               retstatus = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
        }
        return retstatus;
 }
index 06a715b4655bfca6a5bc3d2a0fac8ff83a8bcd15..e87f83fe06135c1555e919b8dff7a81e63557d12 100644 (file)
@@ -46,9 +46,9 @@ BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(fs,
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(fs, ctf_fs_init);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_QUERY_METHOD(fs, ctf_fs_query);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD(fs, ctf_fs_finalize);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(fs,
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(fs,
        ctf_fs_iterator_init);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(fs,
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(fs,
        ctf_fs_iterator_finalize);
 
 #if 0
@@ -73,8 +73,8 @@ BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID(auto, lttng_live,
        lttng_live_component_finalize);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_ACCEPT_PORT_CONNECTION_METHOD_WITH_ID(auto,
        lttng_live, lttng_live_accept_port_connection);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(
        auto, lttng_live, lttng_live_iterator_init);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(
        auto, lttng_live, lttng_live_iterator_finalize);
 #endif
index 71ce63c151f7cc6cbf146d80fa60e890a120af4e..00ec45b71afb91464830f10bbc72be50c4a0c4b7 100644 (file)
@@ -1413,7 +1413,7 @@ const bt_stream *debug_info_stream_end(struct debug_info_iterator *debug_it,
                goto error;
        }
        /*
-        * Take the ref on the stream and keep it until the notification
+        * Take the ref on the stream and keep it until the message
         * is created.
         */
        bt_stream_get_ref(writer_stream);
index 58cb5728f67019ae8019314c5efb79854c0bb362..4b765d16ae30c4a72851c782e8be52ac72edb76e 100644 (file)
@@ -45,7 +45,7 @@
 enum debug_info_stream_state {
        /*
         * We know the stream exists but we have never received a
-        * stream_begin notification for it.
+        * stream_begin message for it.
         */
        DEBUG_INFO_UNKNOWN_STREAM,
        /* We know this stream is active (between stream_begin and _end). */
@@ -68,8 +68,8 @@ struct debug_info_iterator {
        GHashTable *trace_map;
        /* Input iterators associated with this output iterator. */
        GPtrArray *input_iterator_group;
-       const bt_notification *current_notification;
-       bt_notification_iterator *input_iterator;
+       const bt_message *current_message;
+       bt_message_iterator *input_iterator;
        FILE *err;
 };
 
index 09740c677308d1542452a5ca8011a8b32a313878..6654e76d68d6c129a03ed429058e7f49763b5b29 100644 (file)
@@ -83,11 +83,11 @@ void unref_trace(struct debug_info_trace *di_trace)
 }
 
 static
-void debug_info_iterator_destroy(bt_self_notification_iterator *it)
+void debug_info_iterator_destroy(bt_self_message_iterator *it)
 {
        struct debug_info_iterator *it_data;
 
-       it_data = bt_self_notification_iterator_get_user_data(it);
+       it_data = bt_self_message_iterator_get_user_data(it);
        BT_ASSERT(it_data);
 
        if (it_data->input_iterator_group) {
@@ -98,24 +98,24 @@ void debug_info_iterator_destroy(bt_self_notification_iterator *it)
                        empty_trace_map, it_data);
        g_hash_table_destroy(it_data->trace_map);
 
-       bt_notification_put_ref(it_data->current_notification);
+       bt_message_put_ref(it_data->current_message);
        bt_object_put_ref(it_data->input_iterator);
 
        g_free(it_data);
 }
 
 static
-const bt_notification *handle_notification(FILE *err,
+const bt_message *handle_message(FILE *err,
                struct debug_info_iterator *debug_it,
-               const bt_notification *notification)
+               const bt_message *message)
 {
-       const bt_notification *new_notification = NULL;
+       const bt_message *new_message = NULL;
 
-       switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
+       switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
        {
                const bt_packet *packet =
-                       bt_notification_packet_beginning_get_packet(notification);
+                       bt_message_packet_beginning_get_packet(message);
                const bt_packet *writer_packet;
 
                if (!packet) {
@@ -124,17 +124,17 @@ const bt_notification *handle_notification(FILE *err,
 
                writer_packet = debug_info_new_packet(debug_it, packet);
                BT_ASSERT(writer_packet);
-               new_notification = bt_notification_packet_beginning_create(
+               new_message = bt_message_packet_beginning_create(
                                writer_packet);
-               BT_ASSERT(new_notification);
+               BT_ASSERT(new_message);
                bt_packet_put_ref(packet);
                bt_packet_put_ref(writer_packet);
                break;
        }
-       case BT_NOTIFICATION_TYPE_PACKET_END:
+       case BT_MESSAGE_TYPE_PACKET_END:
        {
                const bt_packet *packet =
-                       bt_notification_packet_end_get_packet(notification);
+                       bt_message_packet_end_get_packet(message);
                const bt_packet *writer_packet;
 
                if (!packet) {
@@ -143,39 +143,39 @@ const bt_notification *handle_notification(FILE *err,
 
                writer_packet = debug_info_close_packet(debug_it, packet);
                BT_ASSERT(writer_packet);
-               new_notification = bt_notification_packet_end_create(
+               new_message = bt_message_packet_end_create(
                                writer_packet);
-               BT_ASSERT(new_notification);
+               BT_ASSERT(new_message);
                bt_packet_put_ref(packet);
                bt_packet_put_ref(writer_packet);
                break;
        }
-       case BT_NOTIFICATION_TYPE_EVENT:
+       case BT_MESSAGE_TYPE_EVENT:
        {
-               const bt_event *event = bt_notification_event_get_event(
-                               notification);
+               const bt_event *event = bt_message_event_get_event(
+                               message);
                const bt_event *writer_event;
                bt_clock_class_priority_map *cc_prio_map =
-                       bt_notification_event_get_clock_class_priority_map(
-                                       notification);
+                       bt_message_event_get_clock_class_priority_map(
+                                       message);
 
                if (!event) {
                        goto end;
                }
                writer_event = debug_info_output_event(debug_it, event);
                BT_ASSERT(writer_event);
-               new_notification = bt_notification_event_create(writer_event,
+               new_message = bt_message_event_create(writer_event,
                                cc_prio_map);
                bt_object_put_ref(cc_prio_map);
-               BT_ASSERT(new_notification);
+               BT_ASSERT(new_message);
                bt_object_put_ref(event);
                bt_object_put_ref(writer_event);
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
        {
                const bt_stream *stream =
-                       bt_notification_stream_beginning_get_stream(notification);
+                       bt_message_stream_beginning_get_stream(message);
                const bt_stream *writer_stream;
 
                if (!stream) {
@@ -184,17 +184,17 @@ const bt_notification *handle_notification(FILE *err,
 
                writer_stream = debug_info_stream_begin(debug_it, stream);
                BT_ASSERT(writer_stream);
-               new_notification = bt_notification_stream_beginning_create(
+               new_message = bt_message_stream_beginning_create(
                                writer_stream);
-               BT_ASSERT(new_notification);
+               BT_ASSERT(new_message);
                bt_stream_put_ref(stream);
                bt_stream_put_ref(writer_stream);
                break;
        }
-       case BT_NOTIFICATION_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_END:
        {
                const bt_stream *stream =
-                       bt_notification_stream_end_get_stream(notification);
+                       bt_message_stream_end_get_stream(message);
                const bt_stream *writer_stream;
 
                if (!stream) {
@@ -203,62 +203,62 @@ const bt_notification *handle_notification(FILE *err,
 
                writer_stream = debug_info_stream_end(debug_it, stream);
                BT_ASSERT(writer_stream);
-               new_notification = bt_notification_stream_end_create(
+               new_message = bt_message_stream_end_create(
                                writer_stream);
-               BT_ASSERT(new_notification);
+               BT_ASSERT(new_message);
                bt_stream_put_ref(stream);
                bt_stream_put_ref(writer_stream);
                break;
        }
        default:
-               new_notification = bt_notification_get_ref(notification);
+               new_message = bt_message_get_ref(message);
                break;
        }
 
 end:
-       return new_notification;
+       return new_message;
 }
 
 static
-bt_notification_iterator_next_method_return debug_info_iterator_next(
-               bt_self_notification_iterator *iterator)
+bt_message_iterator_next_method_return debug_info_iterator_next(
+               bt_self_message_iterator *iterator)
 {
        struct debug_info_iterator *debug_it = NULL;
        bt_self_component *component = NULL;
        struct debug_info_component *debug_info = NULL;
-       bt_notification_iterator *source_it = NULL;
-       const bt_notification *notification;
-       bt_notification_iterator_next_method_return ret = {
-               .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
-               .notification = NULL,
+       bt_message_iterator *source_it = NULL;
+       const bt_message *message;
+       bt_message_iterator_next_method_return ret = {
+               .status = BT_MESSAGE_ITERATOR_STATUS_OK,
+               .message = NULL,
        };
 
-       debug_it = bt_self_notification_iterator_get_user_data(iterator);
+       debug_it = bt_self_message_iterator_get_user_data(iterator);
        BT_ASSERT(debug_it);
 
-       component = bt_self_notification_iterator_get_private_component(iterator);
+       component = bt_self_message_iterator_get_private_component(iterator);
        BT_ASSERT(component);
        debug_info = bt_self_component_get_user_data(component);
        BT_ASSERT(debug_info);
 
        source_it = debug_it->input_iterator;
 
-       ret.status = bt_notification_iterator_next(source_it);
-       if (ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+       ret.status = bt_message_iterator_next(source_it);
+       if (ret.status != BT_MESSAGE_ITERATOR_STATUS_OK) {
                goto end;
        }
 
-       notification = bt_notification_iterator_get_notification(
+       message = bt_message_iterator_get_message(
                        source_it);
-       if (!notification) {
-               ret.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+       if (!message) {
+               ret.status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
-       ret.notification = handle_notification(debug_info->err, debug_it,
-                       notification);
-       BT_ASSERT(ret.notification);
-       bt_notification_put_ref(notification);
+       ret.message = handle_message(debug_info->err, debug_it,
+                       message);
+       BT_ASSERT(ret.message);
+       bt_message_put_ref(message);
 
 end:
        bt_object_put_ref(component);
@@ -266,43 +266,43 @@ end:
 }
 
 static
-enum bt_notification_iterator_status debug_info_iterator_init(
-               bt_self_notification_iterator *iterator,
+enum bt_message_iterator_status debug_info_iterator_init(
+               bt_self_message_iterator *iterator,
                struct bt_private_port *port)
 {
-       enum bt_notification_iterator_status ret =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       enum bt_notification_iterator_status it_ret;
+       enum bt_message_iterator_status ret =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status it_ret;
        enum bt_connection_status conn_status;
        struct bt_private_connection *connection = NULL;
        bt_self_component *component =
-               bt_self_notification_iterator_get_private_component(iterator);
+               bt_self_message_iterator_get_private_component(iterator);
        struct debug_info_iterator *it_data = g_new0(struct debug_info_iterator, 1);
        struct bt_private_port *input_port;
 
        if (!it_data) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+               ret = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
                goto end;
        }
 
        input_port = bt_self_component_filter_get_input_port_by_name(
                        component, "in");
        if (!input_port) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
        connection = bt_private_port_get_connection(input_port);
        bt_object_put_ref(input_port);
        if (!connection) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
-       conn_status = bt_private_connection_create_notification_iterator(
+       conn_status = bt_private_connection_create_message_iterator(
                        connection, &it_data->input_iterator);
        if (conn_status != BT_CONNECTION_STATUS_OK) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
@@ -312,7 +312,7 @@ enum bt_notification_iterator_status debug_info_iterator_init(
        it_data->trace_map = g_hash_table_new_full(g_direct_hash,
                        g_direct_equal, NULL, (GDestroyNotify) unref_trace);
 
-       it_ret = bt_self_notification_iterator_set_user_data(iterator, it_data);
+       it_ret = bt_self_message_iterator_set_user_data(iterator, it_data);
        if (it_ret) {
                goto end;
        }
@@ -451,7 +451,7 @@ BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(lttng_utils,
        debug_info, debug_info_component_init);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID(lttng_utils,
        debug_info, destroy_debug_info_component);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(
        lttng_utils, debug_info, debug_info_iterator_init);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD_WITH_ID(
        lttng_utils, debug_info, debug_info_iterator_destroy);
index 1d721ab16dce8e1e27d30b62aa20e879a4f29bf2..c85eb16a54a83fa2aceb0a417d560d47d5f31777 100644 (file)
 
 struct dmesg_component;
 
-struct dmesg_notif_iter {
+struct dmesg_msg_iter {
        struct dmesg_component *dmesg_comp;
-       bt_self_notification_iterator *pc_notif_iter; /* Weak */
+       bt_self_message_iterator *pc_msg_iter; /* Weak */
        char *linebuf;
        size_t linebuf_len;
        FILE *fp;
-       bt_notification *tmp_event_notif;
+       bt_message *tmp_event_msg;
 
        enum {
                STATE_EMIT_STREAM_BEGINNING,
@@ -432,18 +432,18 @@ void dmesg_finalize(bt_self_component_source *self_comp)
 }
 
 static
-bt_notification *create_init_event_notif_from_line(
-               struct dmesg_notif_iter *notif_iter,
+bt_message *create_init_event_msg_from_line(
+               struct dmesg_msg_iter *msg_iter,
                const char *line, const char **new_start)
 {
        bt_event *event;
-       bt_notification *notif = NULL;
+       bt_message *msg = NULL;
        bool has_timestamp = false;
        unsigned long sec, usec, msec;
        unsigned int year, mon, mday, hour, min;
        uint64_t ts = 0;
        int ret = 0;
-       struct dmesg_component *dmesg_comp = notif_iter->dmesg_comp;
+       struct dmesg_component *dmesg_comp = msg_iter->dmesg_comp;
 
        *new_start = line;
 
@@ -507,14 +507,14 @@ skip_ts:
                goto error;
        }
 
-       notif = bt_notification_event_create(notif_iter->pc_notif_iter,
+       msg = bt_message_event_create(msg_iter->pc_msg_iter,
                dmesg_comp->event_class, dmesg_comp->packet);
-       if (!notif) {
-               BT_LOGE_STR("Cannot create event notification.");
+       if (!msg) {
+               BT_LOGE_STR("Cannot create event message.");
                goto error;
        }
 
-       event = bt_notification_event_borrow_event(notif);
+       event = bt_message_event_borrow_event(msg);
        BT_ASSERT(event);
 
        if (dmesg_comp->clock_class) {
@@ -524,10 +524,10 @@ skip_ts:
        goto end;
 
 error:
-       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
+       BT_MESSAGE_PUT_REF_AND_RESET(msg);
 
 end:
-       return notif;
+       return msg;
 }
 
 static
@@ -577,22 +577,22 @@ end:
 }
 
 static
-bt_notification *create_notif_from_line(
-               struct dmesg_notif_iter *dmesg_notif_iter, const char *line)
+bt_message *create_msg_from_line(
+               struct dmesg_msg_iter *dmesg_msg_iter, const char *line)
 {
        bt_event *event = NULL;
-       bt_notification *notif = NULL;
+       bt_message *msg = NULL;
        const char *new_start;
        int ret;
 
-       notif = create_init_event_notif_from_line(dmesg_notif_iter,
+       msg = create_init_event_msg_from_line(dmesg_msg_iter,
                line, &new_start);
-       if (!notif) {
-               BT_LOGE_STR("Cannot create and initialize event notification from line.");
+       if (!msg) {
+               BT_LOGE_STR("Cannot create and initialize event message from line.");
                goto error;
        }
 
-       event = bt_notification_event_borrow_event(notif);
+       event = bt_message_event_borrow_event(msg);
        BT_ASSERT(event);
        ret = fill_event_payload_from_line(new_start, event);
        if (ret) {
@@ -604,73 +604,73 @@ bt_notification *create_notif_from_line(
        goto end;
 
 error:
-       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
+       BT_MESSAGE_PUT_REF_AND_RESET(msg);
 
 end:
-       return notif;
+       return msg;
 }
 
 static
-void destroy_dmesg_notif_iter(struct dmesg_notif_iter *dmesg_notif_iter)
+void destroy_dmesg_msg_iter(struct dmesg_msg_iter *dmesg_msg_iter)
 {
-       if (!dmesg_notif_iter) {
+       if (!dmesg_msg_iter) {
                return;
        }
 
-       if (dmesg_notif_iter->fp && dmesg_notif_iter->fp != stdin) {
-               if (fclose(dmesg_notif_iter->fp)) {
+       if (dmesg_msg_iter->fp && dmesg_msg_iter->fp != stdin) {
+               if (fclose(dmesg_msg_iter->fp)) {
                        BT_LOGE_ERRNO("Cannot close input file", ".");
                }
        }
 
-       bt_notification_put_ref(dmesg_notif_iter->tmp_event_notif);
-       free(dmesg_notif_iter->linebuf);
-       g_free(dmesg_notif_iter);
+       bt_message_put_ref(dmesg_msg_iter->tmp_event_msg);
+       free(dmesg_msg_iter->linebuf);
+       g_free(dmesg_msg_iter);
 }
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status dmesg_notif_iter_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status dmesg_msg_iter_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port)
 {
        struct dmesg_component *dmesg_comp;
-       struct dmesg_notif_iter *dmesg_notif_iter =
-               g_new0(struct dmesg_notif_iter, 1);
-       enum bt_self_notification_iterator_status status =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       struct dmesg_msg_iter *dmesg_msg_iter =
+               g_new0(struct dmesg_msg_iter, 1);
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 
-       if (!dmesg_notif_iter) {
-               BT_LOGE_STR("Failed to allocate on dmesg notification iterator structure.");
+       if (!dmesg_msg_iter) {
+               BT_LOGE_STR("Failed to allocate on dmesg message iterator structure.");
                goto error;
        }
 
        dmesg_comp = bt_self_component_get_data(
                bt_self_component_source_as_self_component(self_comp));
        BT_ASSERT(dmesg_comp);
-       dmesg_notif_iter->dmesg_comp = dmesg_comp;
-       dmesg_notif_iter->pc_notif_iter = self_notif_iter;
+       dmesg_msg_iter->dmesg_comp = dmesg_comp;
+       dmesg_msg_iter->pc_msg_iter = self_msg_iter;
 
        if (dmesg_comp->params.read_from_stdin) {
-               dmesg_notif_iter->fp = stdin;
+               dmesg_msg_iter->fp = stdin;
        } else {
-               dmesg_notif_iter->fp = fopen(dmesg_comp->params.path->str, "r");
-               if (!dmesg_notif_iter->fp) {
+               dmesg_msg_iter->fp = fopen(dmesg_comp->params.path->str, "r");
+               if (!dmesg_msg_iter->fp) {
                        BT_LOGE_ERRNO("Cannot open input file in read mode", ": path=\"%s\"",
                                dmesg_comp->params.path->str);
                        goto error;
                }
        }
 
-       bt_self_notification_iterator_set_data(self_notif_iter,
-               dmesg_notif_iter);
+       bt_self_message_iterator_set_data(self_msg_iter,
+               dmesg_msg_iter);
        goto end;
 
 error:
-       destroy_dmesg_notif_iter(dmesg_notif_iter);
-       bt_self_notification_iterator_set_data(self_notif_iter, NULL);
+       destroy_dmesg_msg_iter(dmesg_msg_iter);
+       bt_self_message_iterator_set_data(self_msg_iter, NULL);
        if (status >= 0) {
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
        }
 
 end:
@@ -678,35 +678,35 @@ end:
 }
 
 BT_HIDDEN
-void dmesg_notif_iter_finalize(
-               bt_self_notification_iterator *priv_notif_iter)
+void dmesg_msg_iter_finalize(
+               bt_self_message_iterator *priv_msg_iter)
 {
-       destroy_dmesg_notif_iter(bt_self_notification_iterator_get_data(
-               priv_notif_iter));
+       destroy_dmesg_msg_iter(bt_self_message_iterator_get_data(
+               priv_msg_iter));
 }
 
 static
-enum bt_self_notification_iterator_status dmesg_notif_iter_next_one(
-               struct dmesg_notif_iter *dmesg_notif_iter,
-               bt_notification **notif)
+enum bt_self_message_iterator_status dmesg_msg_iter_next_one(
+               struct dmesg_msg_iter *dmesg_msg_iter,
+               bt_message **msg)
 {
        ssize_t len;
        struct dmesg_component *dmesg_comp;
-       enum bt_self_notification_iterator_status status =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 
-       BT_ASSERT(dmesg_notif_iter);
-       dmesg_comp = dmesg_notif_iter->dmesg_comp;
+       BT_ASSERT(dmesg_msg_iter);
+       dmesg_comp = dmesg_msg_iter->dmesg_comp;
        BT_ASSERT(dmesg_comp);
 
-       if (dmesg_notif_iter->state == STATE_DONE) {
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_END;
+       if (dmesg_msg_iter->state == STATE_DONE) {
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
                goto end;
        }
 
-       if (dmesg_notif_iter->tmp_event_notif ||
-                       dmesg_notif_iter->state == STATE_EMIT_PACKET_END ||
-                       dmesg_notif_iter->state == STATE_EMIT_STREAM_END) {
+       if (dmesg_msg_iter->tmp_event_msg ||
+                       dmesg_msg_iter->state == STATE_EMIT_PACKET_END ||
+                       dmesg_msg_iter->state == STATE_EMIT_STREAM_END) {
                goto handle_state;
        }
 
@@ -714,22 +714,22 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_next_one(
                const char *ch;
                bool only_spaces = true;
 
-               len = bt_getline(&dmesg_notif_iter->linebuf,
-                       &dmesg_notif_iter->linebuf_len, dmesg_notif_iter->fp);
+               len = bt_getline(&dmesg_msg_iter->linebuf,
+                       &dmesg_msg_iter->linebuf_len, dmesg_msg_iter->fp);
                if (len < 0) {
                        if (errno == EINVAL) {
-                               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                        } else if (errno == ENOMEM) {
                                status =
-                                       BT_SELF_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+                                       BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
                        } else {
-                               if (dmesg_notif_iter->state == STATE_EMIT_STREAM_BEGINNING) {
+                               if (dmesg_msg_iter->state == STATE_EMIT_STREAM_BEGINNING) {
                                        /* Stream did not even begin */
-                                       status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_END;
+                                       status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
                                        goto end;
                                } else {
                                        /* End current packet now */
-                                       dmesg_notif_iter->state =
+                                       dmesg_msg_iter->state =
                                                STATE_EMIT_PACKET_END;
                                        goto handle_state;
                                }
@@ -738,10 +738,10 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_next_one(
                        goto end;
                }
 
-               BT_ASSERT(dmesg_notif_iter->linebuf);
+               BT_ASSERT(dmesg_msg_iter->linebuf);
 
                /* Ignore empty lines, once trimmed */
-               for (ch = dmesg_notif_iter->linebuf; *ch != '\0'; ch++) {
+               for (ch = dmesg_msg_iter->linebuf; *ch != '\0'; ch++) {
                        if (!isspace(*ch)) {
                                only_spaces = false;
                                break;
@@ -753,54 +753,54 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_next_one(
                }
        }
 
-       dmesg_notif_iter->tmp_event_notif = create_notif_from_line(
-               dmesg_notif_iter, dmesg_notif_iter->linebuf);
-       if (!dmesg_notif_iter->tmp_event_notif) {
-               BT_LOGE("Cannot create event notification from line: "
+       dmesg_msg_iter->tmp_event_msg = create_msg_from_line(
+               dmesg_msg_iter, dmesg_msg_iter->linebuf);
+       if (!dmesg_msg_iter->tmp_event_msg) {
+               BT_LOGE("Cannot create event message from line: "
                        "dmesg-comp-addr=%p, line=\"%s\"", dmesg_comp,
-                       dmesg_notif_iter->linebuf);
+                       dmesg_msg_iter->linebuf);
                goto end;
        }
 
 handle_state:
        BT_ASSERT(dmesg_comp->trace);
 
-       switch (dmesg_notif_iter->state) {
+       switch (dmesg_msg_iter->state) {
        case STATE_EMIT_STREAM_BEGINNING:
-               BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
-               *notif = bt_notification_stream_beginning_create(
-                       dmesg_notif_iter->pc_notif_iter, dmesg_comp->stream);
-               dmesg_notif_iter->state = STATE_EMIT_PACKET_BEGINNING;
+               BT_ASSERT(dmesg_msg_iter->tmp_event_msg);
+               *msg = bt_message_stream_beginning_create(
+                       dmesg_msg_iter->pc_msg_iter, dmesg_comp->stream);
+               dmesg_msg_iter->state = STATE_EMIT_PACKET_BEGINNING;
                break;
        case STATE_EMIT_PACKET_BEGINNING:
-               BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
-               *notif = bt_notification_packet_beginning_create(
-                       dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet);
-               dmesg_notif_iter->state = STATE_EMIT_EVENT;
+               BT_ASSERT(dmesg_msg_iter->tmp_event_msg);
+               *msg = bt_message_packet_beginning_create(
+                       dmesg_msg_iter->pc_msg_iter, dmesg_comp->packet);
+               dmesg_msg_iter->state = STATE_EMIT_EVENT;
                break;
        case STATE_EMIT_EVENT:
-               BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
-               *notif = dmesg_notif_iter->tmp_event_notif;
-               dmesg_notif_iter->tmp_event_notif = NULL;
+               BT_ASSERT(dmesg_msg_iter->tmp_event_msg);
+               *msg = dmesg_msg_iter->tmp_event_msg;
+               dmesg_msg_iter->tmp_event_msg = NULL;
                break;
        case STATE_EMIT_PACKET_END:
-               *notif = bt_notification_packet_end_create(
-                       dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet);
-               dmesg_notif_iter->state = STATE_EMIT_STREAM_END;
+               *msg = bt_message_packet_end_create(
+                       dmesg_msg_iter->pc_msg_iter, dmesg_comp->packet);
+               dmesg_msg_iter->state = STATE_EMIT_STREAM_END;
                break;
        case STATE_EMIT_STREAM_END:
-               *notif = bt_notification_stream_end_create(
-                       dmesg_notif_iter->pc_notif_iter, dmesg_comp->stream);
-               dmesg_notif_iter->state = STATE_DONE;
+               *msg = bt_message_stream_end_create(
+                       dmesg_msg_iter->pc_msg_iter, dmesg_comp->stream);
+               dmesg_msg_iter->state = STATE_DONE;
                break;
        default:
                break;
        }
 
-       if (!*notif) {
-               BT_LOGE("Cannot create notification: dmesg-comp-addr=%p",
+       if (!*msg) {
+               BT_LOGE("Cannot create message: dmesg-comp-addr=%p",
                        dmesg_comp);
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
        }
 
 end:
@@ -808,45 +808,45 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status dmesg_notif_iter_next(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status dmesg_msg_iter_next(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       struct dmesg_notif_iter *dmesg_notif_iter =
-               bt_self_notification_iterator_get_data(
-                       self_notif_iter);
-       enum bt_self_notification_iterator_status status =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       struct dmesg_msg_iter *dmesg_msg_iter =
+               bt_self_message_iterator_get_data(
+                       self_msg_iter);
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
        uint64_t i = 0;
 
        while (i < capacity &&
-                       status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
-               bt_notification *priv_notif = NULL;
+                       status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+               bt_message *priv_msg = NULL;
 
-               status = dmesg_notif_iter_next_one(dmesg_notif_iter,
-                       &priv_notif);
-               notifs[i] = priv_notif;
-               if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
+               status = dmesg_msg_iter_next_one(dmesg_msg_iter,
+                       &priv_msg);
+               msgs[i] = priv_msg;
+               if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        i++;
                }
        }
 
        if (i > 0) {
                /*
-                * Even if dmesg_notif_iter_next_one() returned
+                * Even if dmesg_msg_iter_next_one() returned
                 * something else than
-                * BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK, we
-                * accumulated notification objects in the output
-                * notification array, so we need to return
-                * BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK so that they
+                * BT_SELF_MESSAGE_ITERATOR_STATUS_OK, we
+                * accumulated message objects in the output
+                * message array, so we need to return
+                * BT_SELF_MESSAGE_ITERATOR_STATUS_OK so that they
                 * are transfered to downstream. This other status
-                * occurs again the next time muxer_notif_iter_do_next()
+                * occurs again the next time muxer_msg_iter_do_next()
                 * is called, possibly without any accumulated
-                * notification, in which case we'll return it.
+                * message, in which case we'll return it.
                 */
                *count = i;
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
        }
 
        return status;
index 7fbaf4cc6653a49394aeb6b2bb5a1136f14f8f60..7560338136a91c0259f6a1d357a5f30c9520f1cd 100644 (file)
@@ -36,19 +36,19 @@ BT_HIDDEN
 void dmesg_finalize(bt_self_component_source *self_comp);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status dmesg_notif_iter_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status dmesg_msg_iter_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port);
 
 BT_HIDDEN
-void dmesg_notif_iter_finalize(
-               bt_self_notification_iterator *self_notif_iter);
+void dmesg_msg_iter_finalize(
+               bt_self_message_iterator *self_msg_iter);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status dmesg_notif_iter_next(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status dmesg_msg_iter_next(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count);
 
 #endif /* BABELTRACE_PLUGIN_TEXT_DMESG_DMESG_H */
index 2b09b77b38a7266a69c5f6182c66b9a86fc095b5..41da4395214a23f0e5d1506101ad47298abf8815 100644 (file)
@@ -40,15 +40,15 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(pretty, pretty_finalize);
 BT_PLUGIN_SINK_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD(pretty,
        pretty_port_connected);
 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(pretty,
-       "Pretty-print notifications (`text` format of Babeltrace 1).");
+       "Pretty-print messages (`text` format of Babeltrace 1).");
 
 /* dmesg source */
-BT_PLUGIN_SOURCE_COMPONENT_CLASS(dmesg, dmesg_notif_iter_next);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS(dmesg, dmesg_msg_iter_next);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(dmesg,
        "Read a dmesg output from a file or from standard input.");
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(dmesg, dmesg_init);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD(dmesg, dmesg_finalize);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(dmesg,
-       dmesg_notif_iter_init);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(dmesg,
-       dmesg_notif_iter_finalize);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(dmesg,
+       dmesg_msg_iter_init);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(dmesg,
+       dmesg_msg_iter_finalize);
index d9f1888bc1c1b8ed7000c2402faa6e2fae0ef3a4..abf14ecc7bd1b20d2f2b4ef42d4db8269e59ce10 100644 (file)
@@ -65,7 +65,7 @@ const char *plugin_options[] = {
 static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
-       bt_self_component_port_input_notification_iterator_put_ref(pretty->iterator);
+       bt_self_component_port_input_message_iterator_put_ref(pretty->iterator);
 
        if (pretty->string) {
                (void) g_string_free(pretty->string, TRUE);
@@ -121,27 +121,27 @@ void pretty_finalize(bt_self_component_sink *comp)
 }
 
 static
-enum bt_self_component_status handle_notification(
+enum bt_self_component_status handle_message(
                struct pretty_component *pretty,
-               const bt_notification *notification)
+               const bt_message *message)
 {
        enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
 
        BT_ASSERT(pretty);
 
-       switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               if (pretty_print_packet(pretty, notification)) {
+       switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               if (pretty_print_packet(pretty, message)) {
                        ret = BT_SELF_COMPONENT_STATUS_ERROR;
                }
                break;
-       case BT_NOTIFICATION_TYPE_EVENT:
-               if (pretty_print_event(pretty, notification)) {
+       case BT_MESSAGE_TYPE_EVENT:
+               if (pretty_print_event(pretty, message)) {
                        ret = BT_SELF_COMPONENT_STATUS_ERROR;
                }
                break;
-       case BT_NOTIFICATION_TYPE_INACTIVITY:
-               fprintf(stderr, "Inactivity notification\n");
+       case BT_MESSAGE_TYPE_INACTIVITY:
+               fprintf(stderr, "Inactivity message\n");
                break;
        default:
                break;
@@ -163,7 +163,7 @@ enum bt_self_component_status pretty_port_connected(
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(pretty);
        BT_ASSERT(!pretty->iterator);
-       pretty->iterator = bt_self_component_port_input_notification_iterator_create(
+       pretty->iterator = bt_self_component_port_input_message_iterator_create(
                self_port);
        if (!pretty->iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
@@ -177,30 +177,30 @@ enum bt_self_component_status pretty_consume(
                bt_self_component_sink *comp)
 {
        enum bt_self_component_status ret;
-       bt_notification_array_const notifs;
-       bt_self_component_port_input_notification_iterator *it;
+       bt_message_array_const msgs;
+       bt_self_component_port_input_message_iterator *it;
        struct pretty_component *pretty = bt_self_component_get_data(
                bt_self_component_sink_as_self_component(comp));
-       enum bt_notification_iterator_status it_ret;
+       enum bt_message_iterator_status it_ret;
        uint64_t count = 0;
        uint64_t i = 0;
 
        it = pretty->iterator;
-       it_ret = bt_self_component_port_input_notification_iterator_next(it,
-               &notifs, &count);
+       it_ret = bt_self_component_port_input_message_iterator_next(it,
+               &msgs, &count);
 
        switch (it_ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
                break;
-       case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
+       case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
                ret = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                ret = BT_SELF_COMPONENT_STATUS_AGAIN;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+       case BT_MESSAGE_ITERATOR_STATUS_END:
                ret = BT_SELF_COMPONENT_STATUS_END;
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
                        pretty->iterator);
                goto end;
        default:
@@ -208,20 +208,20 @@ enum bt_self_component_status pretty_consume(
                goto end;
        }
 
-       BT_ASSERT(it_ret == BT_NOTIFICATION_ITERATOR_STATUS_OK);
+       BT_ASSERT(it_ret == BT_MESSAGE_ITERATOR_STATUS_OK);
 
        for (i = 0; i < count; i++) {
-               ret = handle_notification(pretty, notifs[i]);
+               ret = handle_message(pretty, msgs[i]);
                if (ret) {
                        goto end;
                }
 
-               bt_notification_put_ref(notifs[i]);
+               bt_message_put_ref(msgs[i]);
        }
 
 end:
        for (; i < count; i++) {
-               bt_notification_put_ref(notifs[i]);
+               bt_message_put_ref(msgs[i]);
        }
 
        return ret;
index e8dcbc6576805107277bdd0717298c7cb741473d..86c2785368bf92ab4b05f37f5de4f473ac8623bc 100644 (file)
@@ -72,7 +72,7 @@ struct pretty_options {
 
 struct pretty_component {
        struct pretty_options options;
-       bt_self_component_port_input_notification_iterator *iterator;
+       bt_self_component_port_input_message_iterator *iterator;
        FILE *out, *err;
        int depth;      /* nesting, used for tabulation alignment. */
        bool start_line;
@@ -124,10 +124,10 @@ void pretty_finalize(bt_self_component_sink *component);
 
 BT_HIDDEN
 int pretty_print_event(struct pretty_component *pretty,
-               const bt_notification *event_notif);
+               const bt_message *event_msg);
 
 BT_HIDDEN
 int pretty_print_packet(struct pretty_component *pretty,
-               const bt_notification *packet_beginning_notif);
+               const bt_message *packet_beginning_msg);
 
 #endif /* BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H */
index 3c3988827df02d15dd081e7bc62cfe0daf477277..d0639817b7a61746e05d8a159af8774616a025c5 100644 (file)
@@ -1196,11 +1196,11 @@ end:
 
 BT_HIDDEN
 int pretty_print_event(struct pretty_component *pretty,
-               const bt_notification *event_notif)
+               const bt_message *event_msg)
 {
        int ret;
        const bt_event *event =
-               bt_notification_event_borrow_event_const(event_notif);
+               bt_message_event_borrow_event_const(event_msg);
 
        BT_ASSERT(event);
        pretty->start_line = true;
@@ -1370,11 +1370,11 @@ int print_discarded_elements_msg(
 
 BT_HIDDEN
 int pretty_print_packet(struct pretty_component *pretty,
-               const bt_notification *packet_beginning_notif)
+               const bt_message *packet_beginning_msg)
 {
 #if 0
-       const bt_packet *packet = bt_notification_packet_beginning_borrow_packet_const(
-               packet_beginning_notif);
+       const bt_packet *packet = bt_message_packet_beginning_borrow_packet_const(
+               packet_beginning_msg);
        uint64_t count;
        int status = 0;
 
index 5506e5800e896f3bb246a08b1fa4db9015108c22..e667e2529f134ad7c137b7e482fabdf3407dd83e 100644 (file)
@@ -64,25 +64,25 @@ void print_count(struct counter *counter)
        PRINTF_COUNT("inactivity", "inactivities", inactivity);
 
        if (counter->count.other > 0) {
-               PRINTF_COUNT("  other (unknown) notification",
-                       "  other (unknown) notifications", other);
+               PRINTF_COUNT("  other (unknown) message",
+                       "  other (unknown) messages", other);
        }
 
-       printf("%s%15" PRIu64 " notification%s (TOTAL)%s\n",
+       printf("%s%15" PRIu64 " message%s (TOTAL)%s\n",
                bt_common_color_bold(), total, total == 1 ? "" : "s",
                bt_common_color_reset());
        counter->last_printed_total = total;
 }
 
 static
-void try_print_count(struct counter *counter, uint64_t notif_count)
+void try_print_count(struct counter *counter, uint64_t msg_count)
 {
        if (counter->step == 0) {
                /* No update */
                return;
        }
 
-       counter->at += notif_count;
+       counter->at += msg_count;
 
        if (counter->at >= counter->step) {
                counter->at = 0;
@@ -103,7 +103,7 @@ void try_print_last(struct counter *counter)
 
 void destroy_private_counter_data(struct counter *counter)
 {
-       bt_self_component_port_input_notification_iterator_put_ref(counter->notif_iter);
+       bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter);
        g_free(counter);
 }
 
@@ -117,7 +117,7 @@ void counter_finalize(bt_self_component_sink *comp)
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
        try_print_last(counter);
-       bt_self_component_port_input_notification_iterator_put_ref(counter->notif_iter);
+       bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter);
        g_free(counter);
 }
 
@@ -183,20 +183,20 @@ enum bt_self_component_status counter_port_connected(
 {
        enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct counter *counter;
-       bt_self_component_port_input_notification_iterator *iterator;
+       bt_self_component_port_input_message_iterator *iterator;
 
        counter = bt_self_component_get_data(
                bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
-       iterator = bt_self_component_port_input_notification_iterator_create(
+       iterator = bt_self_component_port_input_message_iterator_create(
                self_port);
        if (!iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
        }
 
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(
-               counter->notif_iter, iterator);
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+               counter->msg_iter, iterator);
 
 end:
        return status;
@@ -208,81 +208,81 @@ enum bt_self_component_status counter_consume(
 {
        enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
        struct counter *counter;
-       enum bt_notification_iterator_status it_ret;
-       uint64_t notif_count;
-       bt_notification_array_const notifs;
+       enum bt_message_iterator_status it_ret;
+       uint64_t msg_count;
+       bt_message_array_const msgs;
 
        counter = bt_self_component_get_data(
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
 
-       if (unlikely(!counter->notif_iter)) {
+       if (unlikely(!counter->msg_iter)) {
                try_print_last(counter);
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
        }
 
-       /* Consume notifications */
-       it_ret = bt_self_component_port_input_notification_iterator_next(
-               counter->notif_iter, &notifs, &notif_count);
+       /* Consume messages */
+       it_ret = bt_self_component_port_input_message_iterator_next(
+               counter->msg_iter, &msgs, &msg_count);
        if (it_ret < 0) {
                ret = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
 
        switch (it_ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
        {
                uint64_t i;
 
-               for (i = 0; i < notif_count; i++) {
-                       const bt_notification *notif = notifs[i];
+               for (i = 0; i < msg_count; i++) {
+                       const bt_message *msg = msgs[i];
 
-                       BT_ASSERT(notif);
-                       switch (bt_notification_get_type(notif)) {
-                       case BT_NOTIFICATION_TYPE_EVENT:
+                       BT_ASSERT(msg);
+                       switch (bt_message_get_type(msg)) {
+                       case BT_MESSAGE_TYPE_EVENT:
                                counter->count.event++;
                                break;
-                       case BT_NOTIFICATION_TYPE_INACTIVITY:
+                       case BT_MESSAGE_TYPE_INACTIVITY:
                                counter->count.inactivity++;
                                break;
-                       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
+                       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
                                counter->count.stream_begin++;
                                break;
-                       case BT_NOTIFICATION_TYPE_STREAM_END:
+                       case BT_MESSAGE_TYPE_STREAM_END:
                                counter->count.stream_end++;
                                break;
-                       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
+                       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                                counter->count.packet_begin++;
                                break;
-                       case BT_NOTIFICATION_TYPE_PACKET_END:
+                       case BT_MESSAGE_TYPE_PACKET_END:
                                counter->count.packet_end++;
                                break;
                        default:
                                counter->count.other++;
                        }
 
-                       bt_notification_put_ref(notif);
+                       bt_message_put_ref(msg);
                }
 
                ret = BT_SELF_COMPONENT_STATUS_OK;
                break;
        }
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                ret = BT_SELF_COMPONENT_STATUS_AGAIN;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+       case BT_MESSAGE_ITERATOR_STATUS_END:
                try_print_last(counter);
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
+       case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
                ret = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
        default:
                break;
        }
 
-       try_print_count(counter, notif_count);
+       try_print_count(counter, msg_count);
 
 end:
        return ret;
index beed7ddc9bd47cac7e09254b4abfa1dc3c923142..eb8a37bbf81822b3b9bda08b0009ae2c88fe4c1f 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdint.h>
 
 struct counter {
-       bt_self_component_port_input_notification_iterator *notif_iter;
+       bt_self_component_port_input_message_iterator *msg_iter;
        struct {
                uint64_t event;
                uint64_t stream_begin;
index a2bab43008f978f128d9db05f4d595d18016013c..5d513cf216b66ee47fe8cdad653fd6edaee79d02 100644 (file)
@@ -28,7 +28,7 @@
 
 void destroy_private_dummy_data(struct dummy *dummy)
 {
-       bt_self_component_port_input_notification_iterator_put_ref(dummy->notif_iter);
+       bt_self_component_port_input_message_iterator_put_ref(dummy->msg_iter);
        g_free(dummy);
 
 }
@@ -84,20 +84,20 @@ enum bt_self_component_status dummy_port_connected(
 {
        enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct dummy *dummy;
-       bt_self_component_port_input_notification_iterator *iterator;
+       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_notification_iterator_create(
+       iterator = bt_self_component_port_input_message_iterator_create(
                self_port);
        if (!iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
        }
 
-       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(
-               dummy->notif_iter, iterator);
+       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+               dummy->msg_iter, iterator);
 
 end:
        return status;
@@ -108,43 +108,43 @@ enum bt_self_component_status dummy_consume(
                bt_self_component_sink *component)
 {
        enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
-       bt_notification_array_const notifs;
+       bt_message_array_const msgs;
        uint64_t count;
        struct dummy *dummy;
-       enum bt_notification_iterator_status it_ret;
+       enum 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->notif_iter)) {
+       if (unlikely(!dummy->msg_iter)) {
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
        }
 
-       /* Consume one notification  */
-       it_ret = bt_self_component_port_input_notification_iterator_next(
-               dummy->notif_iter, &notifs, &count);
+       /* Consume one message  */
+       it_ret = bt_self_component_port_input_message_iterator_next(
+               dummy->msg_iter, &msgs, &count);
        switch (it_ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
                ret = BT_SELF_COMPONENT_STATUS_OK;
 
                for (i = 0; i < count; i++) {
-                       bt_notification_put_ref(notifs[i]);
+                       bt_message_put_ref(msgs[i]);
                }
 
                break;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                ret = BT_SELF_COMPONENT_STATUS_AGAIN;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+       case BT_MESSAGE_ITERATOR_STATUS_END:
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
+       case BT_MESSAGE_ITERATOR_STATUS_ERROR:
                ret = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
+       case BT_MESSAGE_ITERATOR_STATUS_NOMEM:
                ret = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto end;
        default:
index 833df41e4b7e2890e35bd44fc860f37f28530a0a..c87969d1c471a8bdc54a2468e5935bceefa2ade2 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdbool.h>
 
 struct dummy {
-       bt_self_component_port_input_notification_iterator *notif_iter;
+       bt_self_component_port_input_message_iterator *msg_iter;
 };
 
 BT_HIDDEN
index 9aa69223dc8bdf9d44a06827bce090f250da7810..bb786ed9f54a42624c27b6b9d669f14f1baa6a2e 100644 (file)
@@ -28,7 +28,7 @@
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/value-internal.h>
 #include <babeltrace/graph/component-internal.h>
-#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/message-iterator-internal.h>
 #include <babeltrace/graph/connection-internal.h>
 #include <plugins-common.h>
 #include <glib.h>
 struct muxer_comp {
        /*
         * Array of struct
-        * bt_self_notification_iterator *
+        * bt_self_message_iterator *
         * (weak refs)
         */
-       GPtrArray *muxer_notif_iters;
+       GPtrArray *muxer_msg_iters;
 
        /* Weak ref */
        bt_self_component_filter *self_comp;
 
        unsigned int next_port_num;
        size_t available_input_ports;
-       bool initializing_muxer_notif_iter;
+       bool initializing_muxer_msg_iter;
        bool assume_absolute_clock_classes;
 };
 
-struct muxer_upstream_notif_iter {
+struct muxer_upstream_msg_iter {
        /* Owned by this, NULL if ended */
-       bt_self_component_port_input_notification_iterator *notif_iter;
+       bt_self_component_port_input_message_iterator *msg_iter;
 
-       /* Contains `const bt_notification *`, owned by this */
-       GQueue *notifs;
+       /* Contains `const bt_message *`, owned by this */
+       GQueue *msgs;
 };
 
-enum muxer_notif_iter_clock_class_expectation {
-       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ANY = 0,
-       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE,
-       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID,
-       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID,
+enum muxer_msg_iter_clock_class_expectation {
+       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ANY = 0,
+       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE,
+       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID,
+       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID,
 };
 
-struct muxer_notif_iter {
+struct muxer_msg_iter {
        /*
-        * Array of struct muxer_upstream_notif_iter * (owned by this).
+        * Array of struct muxer_upstream_msg_iter * (owned by this).
         *
         * NOTE: This array is searched in linearly to find the youngest
-        * current notification. Keep this until benchmarks confirm that
+        * current message. Keep this until benchmarks confirm that
         * another data structure is faster than this for our typical
         * use cases.
         */
-       GPtrArray *muxer_upstream_notif_iters;
+       GPtrArray *muxer_upstream_msg_iters;
 
        /*
         * List of "recently" connected input ports (weak) to
-        * handle by this muxer notification iterator.
+        * handle by this muxer message iterator.
         * muxer_port_connected() adds entries to this list, and the
-        * entries are removed when a notification iterator is created
+        * entries are removed when a message iterator is created
         * on the port's connection and put into
-        * muxer_upstream_notif_iters above by
-        * muxer_notif_iter_handle_newly_connected_ports().
+        * muxer_upstream_msg_iters above by
+        * muxer_msg_iter_handle_newly_connected_ports().
         */
        GList *newly_connected_self_ports;
 
-       /* Last time returned in a notification */
+       /* Last time returned in a message */
        int64_t last_returned_ts_ns;
 
        /* Clock class expectation state */
-       enum muxer_notif_iter_clock_class_expectation clock_class_expectation;
+       enum muxer_msg_iter_clock_class_expectation clock_class_expectation;
 
        /*
         * Expected clock class UUID, only valid when
         * clock_class_expectation is
-        * MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID.
+        * MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID.
         */
        unsigned char expected_clock_class_uuid[BABELTRACE_UUID_LEN];
 };
 
 static
-void destroy_muxer_upstream_notif_iter(
-               struct muxer_upstream_notif_iter *muxer_upstream_notif_iter)
+void destroy_muxer_upstream_msg_iter(
+               struct muxer_upstream_msg_iter *muxer_upstream_msg_iter)
 {
-       if (!muxer_upstream_notif_iter) {
+       if (!muxer_upstream_msg_iter) {
                return;
        }
 
-       BT_LOGD("Destroying muxer's upstream notification iterator wrapper: "
-               "addr=%p, notif-iter-addr=%p, queue-len=%u",
-               muxer_upstream_notif_iter,
-               muxer_upstream_notif_iter->notif_iter,
-               muxer_upstream_notif_iter->notifs->length);
-       bt_self_component_port_input_notification_iterator_put_ref(muxer_upstream_notif_iter->notif_iter);
+       BT_LOGD("Destroying muxer's upstream message iterator wrapper: "
+               "addr=%p, msg-iter-addr=%p, queue-len=%u",
+               muxer_upstream_msg_iter,
+               muxer_upstream_msg_iter->msg_iter,
+               muxer_upstream_msg_iter->msgs->length);
+       bt_self_component_port_input_message_iterator_put_ref(muxer_upstream_msg_iter->msg_iter);
 
-       if (muxer_upstream_notif_iter->notifs) {
-               const bt_notification *notif;
+       if (muxer_upstream_msg_iter->msgs) {
+               const bt_message *msg;
 
-               while ((notif = g_queue_pop_head(
-                               muxer_upstream_notif_iter->notifs))) {
-                       bt_notification_put_ref(notif);
+               while ((msg = g_queue_pop_head(
+                               muxer_upstream_msg_iter->msgs))) {
+                       bt_message_put_ref(msg);
                }
 
-               g_queue_free(muxer_upstream_notif_iter->notifs);
+               g_queue_free(muxer_upstream_msg_iter->msgs);
        }
 
-       g_free(muxer_upstream_notif_iter);
+       g_free(muxer_upstream_msg_iter);
 }
 
 static
-struct muxer_upstream_notif_iter *muxer_notif_iter_add_upstream_notif_iter(
-               struct muxer_notif_iter *muxer_notif_iter,
-               bt_self_component_port_input_notification_iterator *self_notif_iter)
+struct muxer_upstream_msg_iter *muxer_msg_iter_add_upstream_msg_iter(
+               struct muxer_msg_iter *muxer_msg_iter,
+               bt_self_component_port_input_message_iterator *self_msg_iter)
 {
-       struct muxer_upstream_notif_iter *muxer_upstream_notif_iter =
-               g_new0(struct muxer_upstream_notif_iter, 1);
+       struct muxer_upstream_msg_iter *muxer_upstream_msg_iter =
+               g_new0(struct muxer_upstream_msg_iter, 1);
 
-       if (!muxer_upstream_notif_iter) {
-               BT_LOGE_STR("Failed to allocate one muxer's upstream notification iterator wrapper.");
+       if (!muxer_upstream_msg_iter) {
+               BT_LOGE_STR("Failed to allocate one muxer's upstream message iterator wrapper.");
                goto end;
        }
 
-       muxer_upstream_notif_iter->notif_iter = self_notif_iter;
-       bt_self_component_port_input_notification_iterator_get_ref(muxer_upstream_notif_iter->notif_iter);
-       muxer_upstream_notif_iter->notifs = g_queue_new();
-       if (!muxer_upstream_notif_iter->notifs) {
+       muxer_upstream_msg_iter->msg_iter = self_msg_iter;
+       bt_self_component_port_input_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter);
+       muxer_upstream_msg_iter->msgs = g_queue_new();
+       if (!muxer_upstream_msg_iter->msgs) {
                BT_LOGE_STR("Failed to allocate a GQueue.");
                goto end;
        }
 
-       g_ptr_array_add(muxer_notif_iter->muxer_upstream_notif_iters,
-               muxer_upstream_notif_iter);
-       BT_LOGD("Added muxer's upstream notification iterator wrapper: "
-               "addr=%p, muxer-notif-iter-addr=%p, notif-iter-addr=%p",
-               muxer_upstream_notif_iter, muxer_notif_iter,
-               self_notif_iter);
+       g_ptr_array_add(muxer_msg_iter->muxer_upstream_msg_iters,
+               muxer_upstream_msg_iter);
+       BT_LOGD("Added muxer's upstream message iterator wrapper: "
+               "addr=%p, muxer-msg-iter-addr=%p, msg-iter-addr=%p",
+               muxer_upstream_msg_iter, muxer_msg_iter,
+               self_msg_iter);
 
 end:
-       return muxer_upstream_notif_iter;
+       return muxer_upstream_msg_iter;
 }
 
 static
@@ -232,12 +232,12 @@ void destroy_muxer_comp(struct muxer_comp *muxer_comp)
        }
 
        BT_LOGD("Destroying muxer component: muxer-comp-addr=%p, "
-               "muxer-notif-iter-count=%u", muxer_comp,
-               muxer_comp->muxer_notif_iters ?
-                       muxer_comp->muxer_notif_iters->len : 0);
+               "muxer-msg-iter-count=%u", muxer_comp,
+               muxer_comp->muxer_msg_iters ?
+                       muxer_comp->muxer_msg_iters->len : 0);
 
-       if (muxer_comp->muxer_notif_iters) {
-               g_ptr_array_free(muxer_comp->muxer_notif_iters, TRUE);
+       if (muxer_comp->muxer_msg_iters) {
+               g_ptr_array_free(muxer_comp->muxer_msg_iters, TRUE);
        }
 
        g_free(muxer_comp);
@@ -350,8 +350,8 @@ enum bt_self_component_status muxer_init(
                goto error;
        }
 
-       muxer_comp->muxer_notif_iters = g_ptr_array_new();
-       if (!muxer_comp->muxer_notif_iters) {
+       muxer_comp->muxer_msg_iters = g_ptr_array_new();
+       if (!muxer_comp->muxer_msg_iters) {
                BT_LOGE_STR("Failed to allocate a GPtrArray.");
                goto error;
        }
@@ -410,14 +410,14 @@ void muxer_finalize(bt_self_component_filter *self_comp)
 }
 
 static
-bt_self_component_port_input_notification_iterator *
-create_notif_iter_on_input_port(
+bt_self_component_port_input_message_iterator *
+create_msg_iter_on_input_port(
                bt_self_component_port_input *self_port, int *ret)
 {
        const bt_port *port = bt_self_component_port_as_port(
                bt_self_component_port_input_as_self_component_port(
                        self_port));
-       bt_self_component_port_input_notification_iterator *notif_iter =
+       bt_self_component_port_input_message_iterator *msg_iter =
                NULL;
 
        BT_ASSERT(ret);
@@ -426,86 +426,86 @@ create_notif_iter_on_input_port(
        BT_ASSERT(bt_port_is_connected(port));
 
        // TODO: Advance the iterator to >= the time of the latest
-       //       returned notification by the muxer notification
+       //       returned message by the muxer message
        //       iterator which creates it.
-       notif_iter = bt_self_component_port_input_notification_iterator_create(
+       msg_iter = bt_self_component_port_input_message_iterator_create(
                self_port);
-       if (!notif_iter) {
-               BT_LOGE("Cannot create upstream notification iterator on input port: "
+       if (!msg_iter) {
+               BT_LOGE("Cannot create upstream message iterator on input port: "
                        "port-addr=%p, port-name=\"%s\"",
                        port, bt_port_get_name(port));
                *ret = -1;
                goto end;
        }
 
-       BT_LOGD("Created upstream notification iterator on input port: "
-               "port-addr=%p, port-name=\"%s\", notif-iter-addr=%p",
-               port, bt_port_get_name(port), notif_iter);
+       BT_LOGD("Created upstream message iterator on input port: "
+               "port-addr=%p, port-name=\"%s\", msg-iter-addr=%p",
+               port, bt_port_get_name(port), msg_iter);
 
 end:
-       return notif_iter;
+       return msg_iter;
 }
 
 static
-enum bt_notification_iterator_status muxer_upstream_notif_iter_next(
-               struct muxer_upstream_notif_iter *muxer_upstream_notif_iter)
+enum bt_message_iterator_status muxer_upstream_msg_iter_next(
+               struct muxer_upstream_msg_iter *muxer_upstream_msg_iter)
 {
-       enum bt_notification_iterator_status status;
-       bt_notification_array_const notifs;
+       enum bt_message_iterator_status status;
+       bt_message_array_const msgs;
        uint64_t i;
        uint64_t count;
 
-       BT_LOGV("Calling upstream notification iterator's \"next\" method: "
-               "muxer-upstream-notif-iter-wrap-addr=%p, notif-iter-addr=%p",
-               muxer_upstream_notif_iter,
-               muxer_upstream_notif_iter->notif_iter);
-       status = bt_self_component_port_input_notification_iterator_next(
-               muxer_upstream_notif_iter->notif_iter, &notifs, &count);
-       BT_LOGV("Upstream notification iterator's \"next\" method returned: "
-               "status=%s", bt_notification_iterator_status_string(status));
+       BT_LOGV("Calling upstream message iterator's \"next\" method: "
+               "muxer-upstream-msg-iter-wrap-addr=%p, msg-iter-addr=%p",
+               muxer_upstream_msg_iter,
+               muxer_upstream_msg_iter->msg_iter);
+       status = bt_self_component_port_input_message_iterator_next(
+               muxer_upstream_msg_iter->msg_iter, &msgs, &count);
+       BT_LOGV("Upstream message iterator's \"next\" method returned: "
+               "status=%s", bt_message_iterator_status_string(status));
 
        switch (status) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+       case BT_MESSAGE_ITERATOR_STATUS_OK:
                /*
-                * Notification iterator's current notification is
+                * Message iterator's current message is
                 * valid: it must be considered for muxing operations.
                 */
-               BT_LOGV_STR("Validated upstream notification iterator wrapper.");
+               BT_LOGV_STR("Validated upstream message iterator wrapper.");
                BT_ASSERT(count > 0);
 
-               /* Move notifications to our queue */
+               /* Move messages to our queue */
                for (i = 0; i < count; i++) {
                        /*
                         * Push to tail in order; other side
-                        * (muxer_notif_iter_do_next_one()) consumes
+                        * (muxer_msg_iter_do_next_one()) consumes
                         * from the head first.
                         */
-                       g_queue_push_tail(muxer_upstream_notif_iter->notifs,
-                               (void *) notifs[i]);
+                       g_queue_push_tail(muxer_upstream_msg_iter->msgs,
+                               (void *) msgs[i]);
                }
                break;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
                /*
-                * Notification iterator's current notification is not
+                * Message iterator's current message is not
                 * valid anymore. Return
-                * BT_NOTIFICATION_ITERATOR_STATUS_AGAIN immediately.
+                * BT_MESSAGE_ITERATOR_STATUS_AGAIN immediately.
                 */
                break;
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:       /* Fall-through. */
-       case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED:
+       case BT_MESSAGE_ITERATOR_STATUS_END:    /* Fall-through. */
+       case BT_MESSAGE_ITERATOR_STATUS_CANCELED:
                /*
-                * Notification iterator reached the end: release it. It
+                * Message iterator reached the end: release it. It
                 * won't be considered again to find the youngest
-                * notification.
+                * message.
                 */
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(muxer_upstream_notif_iter->notif_iter);
-               status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(muxer_upstream_msg_iter->msg_iter);
+               status = BT_MESSAGE_ITERATOR_STATUS_OK;
                break;
        default:
                /* Error or unsupported status code */
                BT_LOGE("Error or unsupported status code: "
                        "status-code=%d", status);
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                break;
        }
 
@@ -513,29 +513,29 @@ enum bt_notification_iterator_status muxer_upstream_notif_iter_next(
 }
 
 static
-int muxer_notif_iter_handle_newly_connected_ports(
-               struct muxer_notif_iter *muxer_notif_iter)
+int muxer_msg_iter_handle_newly_connected_ports(
+               struct muxer_msg_iter *muxer_msg_iter)
 {
        int ret = 0;
 
        BT_LOGV("Handling newly connected ports: "
-               "muxer-notif-iter-addr=%p", muxer_notif_iter);
+               "muxer-msg-iter-addr=%p", muxer_msg_iter);
 
        /*
-        * Here we create one upstream notification iterator for each
+        * Here we create one upstream message iterator for each
         * newly connected port. We do NOT perform an initial "next" on
-        * those new upstream notification iterators: they are
+        * those new upstream message iterators: they are
         * invalidated, to be validated later. The list of newly
         * connected ports to handle here is updated by
         * muxer_port_connected().
         */
        while (true) {
-               GList *node = muxer_notif_iter->newly_connected_self_ports;
+               GList *node = muxer_msg_iter->newly_connected_self_ports;
                bt_self_component_port_input *self_port;
                const bt_port *port;
-               bt_self_component_port_input_notification_iterator *
-                       upstream_notif_iter = NULL;
-               struct muxer_upstream_notif_iter *muxer_upstream_notif_iter;
+               bt_self_component_port_input_message_iterator *
+                       upstream_msg_iter = NULL;
+               struct muxer_upstream_msg_iter *muxer_upstream_msg_iter;
 
                if (!node) {
                        break;
@@ -551,37 +551,37 @@ int muxer_notif_iter_handle_newly_connected_ports(
                        /*
                         * Looks like this port is not connected
                         * anymore: we can't create an upstream
-                        * notification iterator on its (non-existing)
+                        * message iterator on its (non-existing)
                         * connection in this case.
                         */
                        goto remove_node;
                }
 
-               upstream_notif_iter = create_notif_iter_on_input_port(
+               upstream_msg_iter = create_msg_iter_on_input_port(
                        self_port, &ret);
                if (ret) {
-                       /* create_notif_iter_on_input_port() logs errors */
-                       BT_ASSERT(!upstream_notif_iter);
+                       /* create_msg_iter_on_input_port() logs errors */
+                       BT_ASSERT(!upstream_msg_iter);
                        goto error;
                }
 
-               muxer_upstream_notif_iter =
-                       muxer_notif_iter_add_upstream_notif_iter(
-                               muxer_notif_iter, upstream_notif_iter);
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(upstream_notif_iter);
-               if (!muxer_upstream_notif_iter) {
+               muxer_upstream_msg_iter =
+                       muxer_msg_iter_add_upstream_msg_iter(
+                               muxer_msg_iter, upstream_msg_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(upstream_msg_iter);
+               if (!muxer_upstream_msg_iter) {
                        /*
-                        * muxer_notif_iter_add_upstream_notif_iter()
+                        * muxer_msg_iter_add_upstream_msg_iter()
                         * logs errors.
                         */
                        goto error;
                }
 
 remove_node:
-               bt_self_component_port_input_notification_iterator_put_ref(upstream_notif_iter);
-               muxer_notif_iter->newly_connected_self_ports =
+               bt_self_component_port_input_message_iterator_put_ref(upstream_msg_iter);
+               muxer_msg_iter->newly_connected_self_ports =
                        g_list_delete_link(
-                               muxer_notif_iter->newly_connected_self_ports,
+                               muxer_msg_iter->newly_connected_self_ports,
                                node);
        }
 
@@ -597,9 +597,9 @@ end:
 }
 
 static
-int get_notif_ts_ns(struct muxer_comp *muxer_comp,
-               struct muxer_notif_iter *muxer_notif_iter,
-               const bt_notification *notif, int64_t last_returned_ts_ns,
+int get_msg_ts_ns(struct muxer_comp *muxer_comp,
+               struct muxer_msg_iter *muxer_msg_iter,
+               const bt_message *msg, int64_t last_returned_ts_ns,
                int64_t *ts_ns)
 {
        const bt_clock_class *clock_class = NULL;
@@ -610,30 +610,30 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
        const char *cc_name;
        enum bt_clock_value_status cv_status = BT_CLOCK_VALUE_STATUS_KNOWN;
 
-       BT_ASSERT(notif);
+       BT_ASSERT(msg);
        BT_ASSERT(ts_ns);
 
-       BT_LOGV("Getting notification's timestamp: "
-               "muxer-notif-iter-addr=%p, notif-addr=%p, "
+       BT_LOGV("Getting message's timestamp: "
+               "muxer-msg-iter-addr=%p, msg-addr=%p, "
                "last-returned-ts=%" PRId64,
-               muxer_notif_iter, notif, last_returned_ts_ns);
+               muxer_msg_iter, msg, last_returned_ts_ns);
 
-       switch (bt_notification_get_type(notif)) {
-       case BT_NOTIFICATION_TYPE_EVENT:
-               event = bt_notification_event_borrow_event_const(notif);
+       switch (bt_message_get_type(msg)) {
+       case BT_MESSAGE_TYPE_EVENT:
+               event = bt_message_event_borrow_event_const(msg);
                BT_ASSERT(event);
                cv_status = bt_event_borrow_default_clock_value_const(event,
                        &clock_value);
                break;
 
-       case BT_NOTIFICATION_TYPE_INACTIVITY:
+       case BT_MESSAGE_TYPE_INACTIVITY:
                clock_value =
-                       bt_notification_inactivity_borrow_default_clock_value_const(
-                               notif);
+                       bt_message_inactivity_borrow_default_clock_value_const(
+                               msg);
                break;
        default:
-               /* All the other notifications have a higher priority */
-               BT_LOGV_STR("Notification has no timestamp: using the last returned timestamp.");
+               /* All the other messages have a higher priority */
+               BT_LOGV_STR("Message has no timestamp: using the last returned timestamp.");
                *ts_ns = last_returned_ts_ns;
                goto end;
        }
@@ -646,11 +646,11 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
 
        /*
         * If the clock value is missing, then we consider that this
-        * notification has no time. In this case it's always the
+        * message has no time. In this case it's always the
         * youngest.
         */
        if (!clock_value) {
-               BT_LOGV_STR("Notification's default clock value is missing: "
+               BT_LOGV_STR("Message's default clock value is missing: "
                        "using the last returned timestamp.");
                *ts_ns = last_returned_ts_ns;
                goto end;
@@ -661,43 +661,43 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
        cc_uuid = bt_clock_class_get_uuid(clock_class);
        cc_name = bt_clock_class_get_name(clock_class);
 
-       if (muxer_notif_iter->clock_class_expectation ==
-                       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ANY) {
+       if (muxer_msg_iter->clock_class_expectation ==
+                       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ANY) {
                /*
                 * This is the first clock class that this muxer
-                * notification iterator encounters. Its properties
+                * message iterator encounters. Its properties
                 * determine what to expect for the whole lifetime of
                 * the iterator without a true
                 * `assume-absolute-clock-classes` parameter.
                 */
                if (bt_clock_class_is_absolute(clock_class)) {
                        /* Expect absolute clock classes */
-                       muxer_notif_iter->clock_class_expectation =
-                               MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE;
+                       muxer_msg_iter->clock_class_expectation =
+                               MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE;
                } else {
                        if (cc_uuid) {
                                /*
                                 * Expect non-absolute clock classes
                                 * with a specific UUID.
                                 */
-                               muxer_notif_iter->clock_class_expectation =
-                                       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID;
-                               memcpy(muxer_notif_iter->expected_clock_class_uuid,
+                               muxer_msg_iter->clock_class_expectation =
+                                       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID;
+                               memcpy(muxer_msg_iter->expected_clock_class_uuid,
                                        cc_uuid, BABELTRACE_UUID_LEN);
                        } else {
                                /*
                                 * Expect non-absolute clock classes
                                 * with no UUID.
                                 */
-                               muxer_notif_iter->clock_class_expectation =
-                                       MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID;
+                               muxer_msg_iter->clock_class_expectation =
+                                       MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID;
                        }
                }
        }
 
        if (!muxer_comp->assume_absolute_clock_classes) {
-               switch (muxer_notif_iter->clock_class_expectation) {
-               case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE:
+               switch (muxer_msg_iter->clock_class_expectation) {
+               case MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE:
                        if (!bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting an absolute clock class, "
                                        "but got a non-absolute one: "
@@ -706,7 +706,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                                goto error;
                        }
                        break;
-               case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID:
+               case MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID:
                        if (bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting a non-absolute clock class with no UUID, "
                                        "but got an absolute one: "
@@ -740,7 +740,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                                goto error;
                        }
                        break;
-               case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID:
+               case MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID:
                        if (bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting a non-absolute clock class with a specific UUID, "
                                        "but got an absolute one: "
@@ -757,7 +757,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                                goto error;
                        }
 
-                       if (memcmp(muxer_notif_iter->expected_clock_class_uuid,
+                       if (memcmp(muxer_msg_iter->expected_clock_class_uuid,
                                        cc_uuid, BABELTRACE_UUID_LEN) != 0) {
                                BT_LOGE("Expecting a non-absolute clock class with a specific UUID, "
                                        "but got one with different UUID: "
@@ -765,22 +765,22 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                                        "expected-uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\", "
                                        "uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"",
                                        clock_class, cc_name,
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[0],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[1],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[2],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[3],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[4],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[5],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[6],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[7],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[8],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[9],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[10],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[11],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[12],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[13],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[14],
-                                       (unsigned int) muxer_notif_iter->expected_clock_class_uuid[15],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[0],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[1],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[2],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[3],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[4],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[5],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[6],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[7],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[8],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[9],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[10],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[11],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[12],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[13],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[14],
+                                       (unsigned int) muxer_msg_iter->expected_clock_class_uuid[15],
                                        (unsigned int) cc_uuid[0],
                                        (unsigned int) cc_uuid[1],
                                        (unsigned int) cc_uuid[2],
@@ -804,7 +804,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                        /* Unexpected */
                        BT_LOGF("Unexpected clock class expectation: "
                                "expectation-code=%d",
-                               muxer_notif_iter->clock_class_expectation);
+                               muxer_msg_iter->clock_class_expectation);
                        abort();
                }
        }
@@ -823,10 +823,10 @@ error:
 
 end:
        if (ret == 0) {
-               BT_LOGV("Found notification's timestamp: "
-                       "muxer-notif-iter-addr=%p, notif-addr=%p, "
+               BT_LOGV("Found message's timestamp: "
+                       "muxer-msg-iter-addr=%p, msg-addr=%p, "
                        "last-returned-ts=%" PRId64 ", ts=%" PRId64,
-                       muxer_notif_iter, notif, last_returned_ts_ns,
+                       muxer_msg_iter, msg, last_returned_ts_ns,
                        *ts_ns);
        }
 
@@ -834,77 +834,77 @@ end:
 }
 
 /*
- * This function finds the youngest available notification amongst the
- * non-ended upstream notification iterators and returns the upstream
- * notification iterator which has it, or
- * BT_NOTIFICATION_ITERATOR_STATUS_END if there's no available
- * notification.
+ * This function finds the youngest available message amongst the
+ * non-ended upstream message iterators and returns the upstream
+ * message iterator which has it, or
+ * BT_MESSAGE_ITERATOR_STATUS_END if there's no available
+ * message.
  *
  * This function does NOT:
  *
- * * Update any upstream notification iterator.
+ * * Update any upstream message iterator.
  * * Check for newly connected ports.
- * * Check the upstream notification iterators to retry.
+ * * Check the upstream message iterators to retry.
  *
- * On sucess, this function sets *muxer_upstream_notif_iter to the
- * upstream notification iterator of which the current notification is
+ * On sucess, this function sets *muxer_upstream_msg_iter to the
+ * upstream message iterator of which the current message is
  * the youngest, and sets *ts_ns to its time.
  */
 static
-enum bt_notification_iterator_status
-muxer_notif_iter_youngest_upstream_notif_iter(
+enum bt_message_iterator_status
+muxer_msg_iter_youngest_upstream_msg_iter(
                struct muxer_comp *muxer_comp,
-               struct muxer_notif_iter *muxer_notif_iter,
-               struct muxer_upstream_notif_iter **muxer_upstream_notif_iter,
+               struct muxer_msg_iter *muxer_msg_iter,
+               struct muxer_upstream_msg_iter **muxer_upstream_msg_iter,
                int64_t *ts_ns)
 {
        size_t i;
        int ret;
        int64_t youngest_ts_ns = INT64_MAX;
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
 
        BT_ASSERT(muxer_comp);
-       BT_ASSERT(muxer_notif_iter);
-       BT_ASSERT(muxer_upstream_notif_iter);
-       *muxer_upstream_notif_iter = NULL;
-
-       for (i = 0; i < muxer_notif_iter->muxer_upstream_notif_iters->len; i++) {
-               const bt_notification *notif;
-               struct muxer_upstream_notif_iter *cur_muxer_upstream_notif_iter =
-                       g_ptr_array_index(muxer_notif_iter->muxer_upstream_notif_iters, i);
-               int64_t notif_ts_ns;
-
-               if (!cur_muxer_upstream_notif_iter->notif_iter) {
-                       /* This upstream notification iterator is ended */
-                       BT_LOGV("Skipping ended upstream notification iterator: "
-                               "muxer-upstream-notif-iter-wrap-addr=%p",
-                               cur_muxer_upstream_notif_iter);
+       BT_ASSERT(muxer_msg_iter);
+       BT_ASSERT(muxer_upstream_msg_iter);
+       *muxer_upstream_msg_iter = NULL;
+
+       for (i = 0; i < muxer_msg_iter->muxer_upstream_msg_iters->len; i++) {
+               const bt_message *msg;
+               struct muxer_upstream_msg_iter *cur_muxer_upstream_msg_iter =
+                       g_ptr_array_index(muxer_msg_iter->muxer_upstream_msg_iters, i);
+               int64_t msg_ts_ns;
+
+               if (!cur_muxer_upstream_msg_iter->msg_iter) {
+                       /* This upstream message iterator is ended */
+                       BT_LOGV("Skipping ended upstream message iterator: "
+                               "muxer-upstream-msg-iter-wrap-addr=%p",
+                               cur_muxer_upstream_msg_iter);
                        continue;
                }
 
-               BT_ASSERT(cur_muxer_upstream_notif_iter->notifs->length > 0);
-               notif = g_queue_peek_head(cur_muxer_upstream_notif_iter->notifs);
-               BT_ASSERT(notif);
-               ret = get_notif_ts_ns(muxer_comp, muxer_notif_iter, notif,
-                       muxer_notif_iter->last_returned_ts_ns, &notif_ts_ns);
+               BT_ASSERT(cur_muxer_upstream_msg_iter->msgs->length > 0);
+               msg = g_queue_peek_head(cur_muxer_upstream_msg_iter->msgs);
+               BT_ASSERT(msg);
+               ret = get_msg_ts_ns(muxer_comp, muxer_msg_iter, msg,
+                       muxer_msg_iter->last_returned_ts_ns, &msg_ts_ns);
                if (ret) {
-                       /* get_notif_ts_ns() logs errors */
-                       *muxer_upstream_notif_iter = NULL;
-                       status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                       /* get_msg_ts_ns() logs errors */
+                       *muxer_upstream_msg_iter = NULL;
+                       status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                        goto end;
                }
 
-               if (notif_ts_ns <= youngest_ts_ns) {
-                       *muxer_upstream_notif_iter =
-                               cur_muxer_upstream_notif_iter;
-                       youngest_ts_ns = notif_ts_ns;
+               if (msg_ts_ns <= youngest_ts_ns) {
+                       *muxer_upstream_msg_iter =
+                               cur_muxer_upstream_msg_iter;
+                       youngest_ts_ns = msg_ts_ns;
                        *ts_ns = youngest_ts_ns;
                }
        }
 
-       if (!*muxer_upstream_notif_iter) {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_END;
+       if (!*muxer_upstream_msg_iter) {
+               status = BT_MESSAGE_ITERATOR_STATUS_END;
                *ts_ns = INT64_MIN;
        }
 
@@ -913,84 +913,84 @@ end:
 }
 
 static
-enum bt_notification_iterator_status validate_muxer_upstream_notif_iter(
-       struct muxer_upstream_notif_iter *muxer_upstream_notif_iter)
+enum bt_message_iterator_status validate_muxer_upstream_msg_iter(
+       struct muxer_upstream_msg_iter *muxer_upstream_msg_iter)
 {
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
 
-       BT_LOGV("Validating muxer's upstream notification iterator wrapper: "
-               "muxer-upstream-notif-iter-wrap-addr=%p",
-               muxer_upstream_notif_iter);
+       BT_LOGV("Validating muxer's upstream message iterator wrapper: "
+               "muxer-upstream-msg-iter-wrap-addr=%p",
+               muxer_upstream_msg_iter);
 
-       if (muxer_upstream_notif_iter->notifs->length > 0 ||
-                       !muxer_upstream_notif_iter->notif_iter) {
+       if (muxer_upstream_msg_iter->msgs->length > 0 ||
+                       !muxer_upstream_msg_iter->msg_iter) {
                BT_LOGV("Already valid or not considered: "
-                       "queue-len=%u, upstream-notif-iter-addr=%p",
-                       muxer_upstream_notif_iter->notifs->length,
-                       muxer_upstream_notif_iter->notif_iter);
+                       "queue-len=%u, upstream-msg-iter-addr=%p",
+                       muxer_upstream_msg_iter->msgs->length,
+                       muxer_upstream_msg_iter->msg_iter);
                goto end;
        }
 
-       /* muxer_upstream_notif_iter_next() logs details/errors */
-       status = muxer_upstream_notif_iter_next(muxer_upstream_notif_iter);
+       /* muxer_upstream_msg_iter_next() logs details/errors */
+       status = muxer_upstream_msg_iter_next(muxer_upstream_msg_iter);
 
 end:
        return status;
 }
 
 static
-enum bt_notification_iterator_status validate_muxer_upstream_notif_iters(
-               struct muxer_notif_iter *muxer_notif_iter)
+enum bt_message_iterator_status validate_muxer_upstream_msg_iters(
+               struct muxer_msg_iter *muxer_msg_iter)
 {
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
        size_t i;
 
-       BT_LOGV("Validating muxer's upstream notification iterator wrappers: "
-               "muxer-notif-iter-addr=%p", muxer_notif_iter);
+       BT_LOGV("Validating muxer's upstream message iterator wrappers: "
+               "muxer-msg-iter-addr=%p", muxer_msg_iter);
 
-       for (i = 0; i < muxer_notif_iter->muxer_upstream_notif_iters->len; i++) {
-               struct muxer_upstream_notif_iter *muxer_upstream_notif_iter =
+       for (i = 0; i < muxer_msg_iter->muxer_upstream_msg_iters->len; i++) {
+               struct muxer_upstream_msg_iter *muxer_upstream_msg_iter =
                        g_ptr_array_index(
-                               muxer_notif_iter->muxer_upstream_notif_iters,
+                               muxer_msg_iter->muxer_upstream_msg_iters,
                                i);
 
-               status = validate_muxer_upstream_notif_iter(
-                       muxer_upstream_notif_iter);
-               if (status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+               status = validate_muxer_upstream_msg_iter(
+                       muxer_upstream_msg_iter);
+               if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
                        if (status < 0) {
-                               BT_LOGE("Cannot validate muxer's upstream notification iterator wrapper: "
-                                       "muxer-notif-iter-addr=%p, "
-                                       "muxer-upstream-notif-iter-wrap-addr=%p",
-                                       muxer_notif_iter,
-                                       muxer_upstream_notif_iter);
+                               BT_LOGE("Cannot validate muxer's upstream message iterator wrapper: "
+                                       "muxer-msg-iter-addr=%p, "
+                                       "muxer-upstream-msg-iter-wrap-addr=%p",
+                                       muxer_msg_iter,
+                                       muxer_upstream_msg_iter);
                        } else {
-                               BT_LOGV("Cannot validate muxer's upstream notification iterator wrapper: "
-                                       "muxer-notif-iter-addr=%p, "
-                                       "muxer-upstream-notif-iter-wrap-addr=%p",
-                                       muxer_notif_iter,
-                                       muxer_upstream_notif_iter);
+                               BT_LOGV("Cannot validate muxer's upstream message iterator wrapper: "
+                                       "muxer-msg-iter-addr=%p, "
+                                       "muxer-upstream-msg-iter-wrap-addr=%p",
+                                       muxer_msg_iter,
+                                       muxer_upstream_msg_iter);
                        }
 
                        goto end;
                }
 
                /*
-                * Remove this muxer upstream notification iterator
+                * Remove this muxer upstream message iterator
                 * if it's ended or canceled.
                 */
-               if (!muxer_upstream_notif_iter->notif_iter) {
+               if (!muxer_upstream_msg_iter->msg_iter) {
                        /*
                         * Use g_ptr_array_remove_fast() because the
                         * order of those elements is not important.
                         */
-                       BT_LOGV("Removing muxer's upstream notification iterator wrapper: ended or canceled: "
-                               "muxer-notif-iter-addr=%p, "
-                               "muxer-upstream-notif-iter-wrap-addr=%p",
-                               muxer_notif_iter, muxer_upstream_notif_iter);
+                       BT_LOGV("Removing muxer's upstream message iterator wrapper: ended or canceled: "
+                               "muxer-msg-iter-addr=%p, "
+                               "muxer-upstream-msg-iter-wrap-addr=%p",
+                               muxer_msg_iter, muxer_upstream_msg_iter);
                        g_ptr_array_remove_index_fast(
-                               muxer_notif_iter->muxer_upstream_notif_iters,
+                               muxer_msg_iter->muxer_upstream_msg_iters,
                                i);
                        i--;
                }
@@ -1001,185 +1001,185 @@ end:
 }
 
 static inline
-enum bt_notification_iterator_status muxer_notif_iter_do_next_one(
+enum bt_message_iterator_status muxer_msg_iter_do_next_one(
                struct muxer_comp *muxer_comp,
-               struct muxer_notif_iter *muxer_notif_iter,
-               const bt_notification **notif)
+               struct muxer_msg_iter *muxer_msg_iter,
+               const bt_message **msg)
 {
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       struct muxer_upstream_notif_iter *muxer_upstream_notif_iter = NULL;
+       enum bt_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
+       struct muxer_upstream_msg_iter *muxer_upstream_msg_iter = NULL;
        int64_t next_return_ts;
 
        while (true) {
-               int ret = muxer_notif_iter_handle_newly_connected_ports(
-                       muxer_notif_iter);
+               int ret = muxer_msg_iter_handle_newly_connected_ports(
+                       muxer_msg_iter);
 
                if (ret) {
-                       BT_LOGE("Cannot handle newly connected input ports for muxer's notification iterator: "
-                               "muxer-comp-addr=%p, muxer-notif-iter-addr=%p, "
+                       BT_LOGE("Cannot handle newly connected input ports for muxer's message iterator: "
+                               "muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
                                "ret=%d",
-                               muxer_comp, muxer_notif_iter, ret);
-                       status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                               muxer_comp, muxer_msg_iter, ret);
+                       status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                        goto end;
                }
 
-               status = validate_muxer_upstream_notif_iters(muxer_notif_iter);
-               if (status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-                       /* validate_muxer_upstream_notif_iters() logs details */
+               status = validate_muxer_upstream_msg_iters(muxer_msg_iter);
+               if (status != BT_MESSAGE_ITERATOR_STATUS_OK) {
+                       /* validate_muxer_upstream_msg_iters() logs details */
                        goto end;
                }
 
                /*
                 * At this point, we know that all the existing upstream
-                * notification iterators are valid. However the
+                * message iterators are valid. However the
                 * operations to validate them (during
-                * validate_muxer_upstream_notif_iters()) may have
+                * validate_muxer_upstream_msg_iters()) may have
                 * connected new ports. If no ports were connected
                 * during this operation, exit the loop.
                 */
-               if (!muxer_notif_iter->newly_connected_self_ports) {
-                       BT_LOGV("Not breaking this loop: muxer's notification iterator still has newly connected input ports to handle: "
+               if (!muxer_msg_iter->newly_connected_self_ports) {
+                       BT_LOGV("Not breaking this loop: muxer's message iterator still has newly connected input ports to handle: "
                                "muxer-comp-addr=%p", muxer_comp);
                        break;
                }
        }
 
-       BT_ASSERT(!muxer_notif_iter->newly_connected_self_ports);
+       BT_ASSERT(!muxer_msg_iter->newly_connected_self_ports);
 
        /*
         * At this point we know that all the existing upstream
-        * notification iterators are valid. We can find the one,
-        * amongst those, of which the current notification is the
+        * message iterators are valid. We can find the one,
+        * amongst those, of which the current message is the
         * youngest.
         */
-       status = muxer_notif_iter_youngest_upstream_notif_iter(muxer_comp,
-                       muxer_notif_iter, &muxer_upstream_notif_iter,
+       status = muxer_msg_iter_youngest_upstream_msg_iter(muxer_comp,
+                       muxer_msg_iter, &muxer_upstream_msg_iter,
                        &next_return_ts);
-       if (status < 0 || status == BT_NOTIFICATION_ITERATOR_STATUS_END ||
-                       status == BT_NOTIFICATION_ITERATOR_STATUS_CANCELED) {
+       if (status < 0 || status == BT_MESSAGE_ITERATOR_STATUS_END ||
+                       status == BT_MESSAGE_ITERATOR_STATUS_CANCELED) {
                if (status < 0) {
-                       BT_LOGE("Cannot find the youngest upstream notification iterator wrapper: "
+                       BT_LOGE("Cannot find the youngest upstream message iterator wrapper: "
                                "status=%s",
-                               bt_notification_iterator_status_string(status));
+                               bt_message_iterator_status_string(status));
                } else {
-                       BT_LOGV("Cannot find the youngest upstream notification iterator wrapper: "
+                       BT_LOGV("Cannot find the youngest upstream message iterator wrapper: "
                                "status=%s",
-                               bt_notification_iterator_status_string(status));
+                               bt_message_iterator_status_string(status));
                }
 
                goto end;
        }
 
-       if (next_return_ts < muxer_notif_iter->last_returned_ts_ns) {
-               BT_LOGE("Youngest upstream notification iterator wrapper's timestamp is less than muxer's notification iterator's last returned timestamp: "
-                       "muxer-notif-iter-addr=%p, ts=%" PRId64 ", "
+       if (next_return_ts < muxer_msg_iter->last_returned_ts_ns) {
+               BT_LOGE("Youngest upstream message iterator wrapper's timestamp is less than muxer's message iterator's last returned timestamp: "
+                       "muxer-msg-iter-addr=%p, ts=%" PRId64 ", "
                        "last-returned-ts=%" PRId64,
-                       muxer_notif_iter, next_return_ts,
-                       muxer_notif_iter->last_returned_ts_ns);
-               status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                       muxer_msg_iter, next_return_ts,
+                       muxer_msg_iter->last_returned_ts_ns);
+               status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
-       BT_LOGV("Found youngest upstream notification iterator wrapper: "
-               "muxer-notif-iter-addr=%p, "
-               "muxer-upstream-notif-iter-wrap-addr=%p, "
+       BT_LOGV("Found youngest upstream message iterator wrapper: "
+               "muxer-msg-iter-addr=%p, "
+               "muxer-upstream-msg-iter-wrap-addr=%p, "
                "ts=%" PRId64,
-               muxer_notif_iter, muxer_upstream_notif_iter, next_return_ts);
-       BT_ASSERT(status == BT_NOTIFICATION_ITERATOR_STATUS_OK);
-       BT_ASSERT(muxer_upstream_notif_iter);
+               muxer_msg_iter, muxer_upstream_msg_iter, next_return_ts);
+       BT_ASSERT(status == BT_MESSAGE_ITERATOR_STATUS_OK);
+       BT_ASSERT(muxer_upstream_msg_iter);
 
        /*
         * Consume from the queue's head: other side
-        * (muxer_upstream_notif_iter_next()) writes to the tail.
+        * (muxer_upstream_msg_iter_next()) writes to the tail.
         */
-       *notif = g_queue_pop_head(muxer_upstream_notif_iter->notifs);
-       BT_ASSERT(*notif);
-       muxer_notif_iter->last_returned_ts_ns = next_return_ts;
+       *msg = g_queue_pop_head(muxer_upstream_msg_iter->msgs);
+       BT_ASSERT(*msg);
+       muxer_msg_iter->last_returned_ts_ns = next_return_ts;
 
 end:
        return status;
 }
 
 static
-enum bt_notification_iterator_status muxer_notif_iter_do_next(
+enum bt_message_iterator_status muxer_msg_iter_do_next(
                struct muxer_comp *muxer_comp,
-               struct muxer_notif_iter *muxer_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+               struct muxer_msg_iter *muxer_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
        uint64_t i = 0;
 
-       while (i < capacity && status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-               status = muxer_notif_iter_do_next_one(muxer_comp,
-                       muxer_notif_iter, &notifs[i]);
-               if (status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+       while (i < capacity && status == BT_MESSAGE_ITERATOR_STATUS_OK) {
+               status = muxer_msg_iter_do_next_one(muxer_comp,
+                       muxer_msg_iter, &msgs[i]);
+               if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
                        i++;
                }
        }
 
        if (i > 0) {
                /*
-                * Even if muxer_notif_iter_do_next_one() returned
+                * Even if muxer_msg_iter_do_next_one() returned
                 * something else than
-                * BT_NOTIFICATION_ITERATOR_STATUS_OK, we accumulated
-                * notification objects in the output notification
+                * BT_MESSAGE_ITERATOR_STATUS_OK, we accumulated
+                * message objects in the output message
                 * array, so we need to return
-                * BT_NOTIFICATION_ITERATOR_STATUS_OK so that they are
+                * BT_MESSAGE_ITERATOR_STATUS_OK so that they are
                 * transfered to downstream. This other status occurs
-                * again the next time muxer_notif_iter_do_next() is
+                * again the next time muxer_msg_iter_do_next() is
                 * called, possibly without any accumulated
-                * notification, in which case we'll return it.
+                * message, in which case we'll return it.
                 */
                *count = i;
-               status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
+               status = BT_MESSAGE_ITERATOR_STATUS_OK;
        }
 
        return status;
 }
 
 static
-void destroy_muxer_notif_iter(struct muxer_notif_iter *muxer_notif_iter)
+void destroy_muxer_msg_iter(struct muxer_msg_iter *muxer_msg_iter)
 {
-       if (!muxer_notif_iter) {
+       if (!muxer_msg_iter) {
                return;
        }
 
-       BT_LOGD("Destroying muxer component's notification iterator: "
-               "muxer-notif-iter-addr=%p", muxer_notif_iter);
+       BT_LOGD("Destroying muxer component's message iterator: "
+               "muxer-msg-iter-addr=%p", muxer_msg_iter);
 
-       if (muxer_notif_iter->muxer_upstream_notif_iters) {
-               BT_LOGD_STR("Destroying muxer's upstream notification iterator wrappers.");
+       if (muxer_msg_iter->muxer_upstream_msg_iters) {
+               BT_LOGD_STR("Destroying muxer's upstream message iterator wrappers.");
                g_ptr_array_free(
-                       muxer_notif_iter->muxer_upstream_notif_iters, TRUE);
+                       muxer_msg_iter->muxer_upstream_msg_iters, TRUE);
        }
 
-       g_list_free(muxer_notif_iter->newly_connected_self_ports);
-       g_free(muxer_notif_iter);
+       g_list_free(muxer_msg_iter->newly_connected_self_ports);
+       g_free(muxer_msg_iter);
 }
 
 static
-int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
-               struct muxer_notif_iter *muxer_notif_iter)
+int muxer_msg_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
+               struct muxer_msg_iter *muxer_msg_iter)
 {
        int64_t count;
        int64_t i;
        int ret = 0;
 
        /*
-        * Add the connected input ports to this muxer notification
+        * Add the connected input ports to this muxer message
         * iterator's list of newly connected ports. They will be
-        * handled by muxer_notif_iter_handle_newly_connected_ports().
+        * handled by muxer_msg_iter_handle_newly_connected_ports().
         */
        count = bt_component_filter_get_input_port_count(
                bt_self_component_filter_as_component_filter(
                        muxer_comp->self_comp));
        if (count < 0) {
-               BT_LOGD("No input port to initialize for muxer component's notification iterator: "
-                       "muxer-comp-addr=%p, muxer-notif-iter-addr=%p",
-                       muxer_comp, muxer_notif_iter);
+               BT_LOGD("No input port to initialize for muxer component's message iterator: "
+                       "muxer-comp-addr=%p, muxer-msg-iter-addr=%p",
+                       muxer_comp, muxer_msg_iter);
                goto end;
        }
 
@@ -1202,23 +1202,23 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
                        continue;
                }
 
-               muxer_notif_iter->newly_connected_self_ports =
+               muxer_msg_iter->newly_connected_self_ports =
                        g_list_append(
-                               muxer_notif_iter->newly_connected_self_ports,
+                               muxer_msg_iter->newly_connected_self_ports,
                                self_port);
-               if (!muxer_notif_iter->newly_connected_self_ports) {
-                       BT_LOGE("Cannot append port to muxer's notification iterator list of newly connected input ports: "
+               if (!muxer_msg_iter->newly_connected_self_ports) {
+                       BT_LOGE("Cannot append port to muxer's message iterator list of newly connected input ports: "
                                "port-addr=%p, port-name=\"%s\", "
-                               "muxer-notif-iter-addr=%p", port,
-                               bt_port_get_name(port), muxer_notif_iter);
+                               "muxer-msg-iter-addr=%p", port,
+                               bt_port_get_name(port), muxer_msg_iter);
                        ret = -1;
                        goto end;
                }
 
-               BT_LOGD("Appended port to muxer's notification iterator list of newly connected input ports: "
+               BT_LOGD("Appended port to muxer's message iterator list of newly connected input ports: "
                        "port-addr=%p, port-name=\"%s\", "
-                       "muxer-notif-iter-addr=%p", port,
-                       bt_port_get_name(port), muxer_notif_iter);
+                       "muxer-msg-iter-addr=%p", port,
+                       bt_port_get_name(port), muxer_msg_iter);
        }
 
 end:
@@ -1226,157 +1226,157 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status muxer_notif_iter_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status muxer_msg_iter_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_filter *self_comp,
                bt_self_component_port_output *port)
 {
        struct muxer_comp *muxer_comp = NULL;
-       struct muxer_notif_iter *muxer_notif_iter = NULL;
-       enum bt_self_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       struct muxer_msg_iter *muxer_msg_iter = NULL;
+       enum bt_self_message_iterator_status status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
        int ret;
 
        muxer_comp = bt_self_component_get_data(
                bt_self_component_filter_as_self_component(self_comp));
        BT_ASSERT(muxer_comp);
-       BT_LOGD("Initializing muxer component's notification iterator: "
-               "comp-addr=%p, muxer-comp-addr=%p, notif-iter-addr=%p",
-               self_comp, muxer_comp, self_notif_iter);
+       BT_LOGD("Initializing muxer component's message iterator: "
+               "comp-addr=%p, muxer-comp-addr=%p, msg-iter-addr=%p",
+               self_comp, muxer_comp, self_msg_iter);
 
-       if (muxer_comp->initializing_muxer_notif_iter) {
+       if (muxer_comp->initializing_muxer_msg_iter) {
                /*
                 * Weird, unhandled situation detected: downstream
-                * creates a muxer notification iterator while creating
-                * another muxer notification iterator (same component).
+                * creates a muxer message iterator while creating
+                * another muxer message iterator (same component).
                 */
-               BT_LOGE("Recursive initialization of muxer component's notification iterator: "
-                       "comp-addr=%p, muxer-comp-addr=%p, notif-iter-addr=%p",
-                       self_comp, muxer_comp, self_notif_iter);
+               BT_LOGE("Recursive initialization of muxer component's message iterator: "
+                       "comp-addr=%p, muxer-comp-addr=%p, msg-iter-addr=%p",
+                       self_comp, muxer_comp, self_msg_iter);
                goto error;
        }
 
-       muxer_comp->initializing_muxer_notif_iter = true;
-       muxer_notif_iter = g_new0(struct muxer_notif_iter, 1);
-       if (!muxer_notif_iter) {
-               BT_LOGE_STR("Failed to allocate one muxer component's notification iterator.");
+       muxer_comp->initializing_muxer_msg_iter = true;
+       muxer_msg_iter = g_new0(struct muxer_msg_iter, 1);
+       if (!muxer_msg_iter) {
+               BT_LOGE_STR("Failed to allocate one muxer component's message iterator.");
                goto error;
        }
 
-       muxer_notif_iter->last_returned_ts_ns = INT64_MIN;
-       muxer_notif_iter->muxer_upstream_notif_iters =
+       muxer_msg_iter->last_returned_ts_ns = INT64_MIN;
+       muxer_msg_iter->muxer_upstream_msg_iters =
                g_ptr_array_new_with_free_func(
-                       (GDestroyNotify) destroy_muxer_upstream_notif_iter);
-       if (!muxer_notif_iter->muxer_upstream_notif_iters) {
+                       (GDestroyNotify) destroy_muxer_upstream_msg_iter);
+       if (!muxer_msg_iter->muxer_upstream_msg_iters) {
                BT_LOGE_STR("Failed to allocate a GPtrArray.");
                goto error;
        }
 
        /*
-        * Add the muxer notification iterator to the component's array
-        * of muxer notification iterators here because
-        * muxer_notif_iter_init_newly_connected_ports() can cause
+        * Add the muxer message iterator to the component's array
+        * of muxer message iterators here because
+        * muxer_msg_iter_init_newly_connected_ports() can cause
         * muxer_port_connected() to be called, which adds the newly
-        * connected port to each muxer notification iterator's list of
+        * connected port to each muxer message iterator's list of
         * newly connected ports.
         */
-       g_ptr_array_add(muxer_comp->muxer_notif_iters, muxer_notif_iter);
-       ret = muxer_notif_iter_init_newly_connected_ports(muxer_comp,
-               muxer_notif_iter);
+       g_ptr_array_add(muxer_comp->muxer_msg_iters, muxer_msg_iter);
+       ret = muxer_msg_iter_init_newly_connected_ports(muxer_comp,
+               muxer_msg_iter);
        if (ret) {
-               BT_LOGE("Cannot initialize newly connected input ports for muxer component's notification iterator: "
+               BT_LOGE("Cannot initialize newly connected input ports for muxer component's message iterator: "
                        "comp-addr=%p, muxer-comp-addr=%p, "
-                       "muxer-notif-iter-addr=%p, notif-iter-addr=%p, ret=%d",
-                       self_comp, muxer_comp, muxer_notif_iter,
-                       self_notif_iter, ret);
+                       "muxer-msg-iter-addr=%p, msg-iter-addr=%p, ret=%d",
+                       self_comp, muxer_comp, muxer_msg_iter,
+                       self_msg_iter, ret);
                goto error;
        }
 
-       bt_self_notification_iterator_set_data(self_notif_iter,
-               muxer_notif_iter);
-       BT_LOGD("Initialized muxer component's notification iterator: "
-               "comp-addr=%p, muxer-comp-addr=%p, muxer-notif-iter-addr=%p, "
-               "notif-iter-addr=%p",
-               self_comp, muxer_comp, muxer_notif_iter, self_notif_iter);
+       bt_self_message_iterator_set_data(self_msg_iter,
+               muxer_msg_iter);
+       BT_LOGD("Initialized muxer component's message iterator: "
+               "comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
+               "msg-iter-addr=%p",
+               self_comp, muxer_comp, muxer_msg_iter, self_msg_iter);
        goto end;
 
 error:
-       if (g_ptr_array_index(muxer_comp->muxer_notif_iters,
-                       muxer_comp->muxer_notif_iters->len - 1) == muxer_notif_iter) {
-               g_ptr_array_remove_index(muxer_comp->muxer_notif_iters,
-                       muxer_comp->muxer_notif_iters->len - 1);
+       if (g_ptr_array_index(muxer_comp->muxer_msg_iters,
+                       muxer_comp->muxer_msg_iters->len - 1) == muxer_msg_iter) {
+               g_ptr_array_remove_index(muxer_comp->muxer_msg_iters,
+                       muxer_comp->muxer_msg_iters->len - 1);
        }
 
-       destroy_muxer_notif_iter(muxer_notif_iter);
-       bt_self_notification_iterator_set_data(self_notif_iter,
+       destroy_muxer_msg_iter(muxer_msg_iter);
+       bt_self_message_iterator_set_data(self_msg_iter,
                NULL);
-       status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+       status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
 
 end:
-       muxer_comp->initializing_muxer_notif_iter = false;
+       muxer_comp->initializing_muxer_msg_iter = false;
        return status;
 }
 
 BT_HIDDEN
-void muxer_notif_iter_finalize(
-               bt_self_notification_iterator *self_notif_iter)
+void muxer_msg_iter_finalize(
+               bt_self_message_iterator *self_msg_iter)
 {
-       struct muxer_notif_iter *muxer_notif_iter =
-               bt_self_notification_iterator_get_data(self_notif_iter);
+       struct muxer_msg_iter *muxer_msg_iter =
+               bt_self_message_iterator_get_data(self_msg_iter);
        bt_self_component *self_comp = NULL;
        struct muxer_comp *muxer_comp = NULL;
 
-       self_comp = bt_self_notification_iterator_borrow_component(
-               self_notif_iter);
+       self_comp = bt_self_message_iterator_borrow_component(
+               self_msg_iter);
        BT_ASSERT(self_comp);
        muxer_comp = bt_self_component_get_data(self_comp);
-       BT_LOGD("Finalizing muxer component's notification iterator: "
-               "comp-addr=%p, muxer-comp-addr=%p, muxer-notif-iter-addr=%p, "
-               "notif-iter-addr=%p",
-               self_comp, muxer_comp, muxer_notif_iter, self_notif_iter);
+       BT_LOGD("Finalizing muxer component's message iterator: "
+               "comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
+               "msg-iter-addr=%p",
+               self_comp, muxer_comp, muxer_msg_iter, self_msg_iter);
 
        if (muxer_comp) {
-               (void) g_ptr_array_remove_fast(muxer_comp->muxer_notif_iters,
-                       muxer_notif_iter);
-               destroy_muxer_notif_iter(muxer_notif_iter);
+               (void) g_ptr_array_remove_fast(muxer_comp->muxer_msg_iters,
+                       muxer_msg_iter);
+               destroy_muxer_msg_iter(muxer_msg_iter);
        }
 }
 
 BT_HIDDEN
-enum bt_notification_iterator_status muxer_notif_iter_next(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_message_iterator_status muxer_msg_iter_next(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       enum bt_notification_iterator_status status;
-       struct muxer_notif_iter *muxer_notif_iter =
-               bt_self_notification_iterator_get_data(self_notif_iter);
+       enum bt_message_iterator_status status;
+       struct muxer_msg_iter *muxer_msg_iter =
+               bt_self_message_iterator_get_data(self_msg_iter);
        bt_self_component *self_comp = NULL;
        struct muxer_comp *muxer_comp = NULL;
 
-       BT_ASSERT(muxer_notif_iter);
-       self_comp = bt_self_notification_iterator_borrow_component(
-               self_notif_iter);
+       BT_ASSERT(muxer_msg_iter);
+       self_comp = bt_self_message_iterator_borrow_component(
+               self_msg_iter);
        BT_ASSERT(self_comp);
        muxer_comp = bt_self_component_get_data(self_comp);
        BT_ASSERT(muxer_comp);
-       BT_LOGV("Muxer component's notification iterator's \"next\" method called: "
-               "comp-addr=%p, muxer-comp-addr=%p, muxer-notif-iter-addr=%p, "
-               "notif-iter-addr=%p",
-               self_comp, muxer_comp, muxer_notif_iter, self_notif_iter);
+       BT_LOGV("Muxer component's message iterator's \"next\" method called: "
+               "comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
+               "msg-iter-addr=%p",
+               self_comp, muxer_comp, muxer_msg_iter, self_msg_iter);
 
-       status = muxer_notif_iter_do_next(muxer_comp, muxer_notif_iter,
-               notifs, capacity, count);
+       status = muxer_msg_iter_do_next(muxer_comp, muxer_msg_iter,
+               msgs, capacity, count);
        if (status < 0) {
-               BT_LOGE("Cannot get next notification: "
-                       "comp-addr=%p, muxer-comp-addr=%p, muxer-notif-iter-addr=%p, "
-                       "notif-iter-addr=%p, status=%s",
-                       self_comp, muxer_comp, muxer_notif_iter, self_notif_iter,
-                       bt_notification_iterator_status_string(status));
+               BT_LOGE("Cannot get next message: "
+                       "comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, "
+                       "msg-iter-addr=%p, status=%s",
+                       self_comp, muxer_comp, muxer_msg_iter, self_msg_iter,
+                       bt_message_iterator_status_string(status));
        } else {
-               BT_LOGV("Returning from muxer component's notification iterator's \"next\" method: "
+               BT_LOGV("Returning from muxer component's message iterator's \"next\" method: "
                        "status=%s",
-                       bt_notification_iterator_status_string(status));
+                       bt_message_iterator_status_string(status));
        }
 
        return status;
@@ -1409,34 +1409,34 @@ enum bt_self_component_status muxer_input_port_connected(
                other_port,
                bt_port_get_name(bt_port_output_as_port_const(other_port)));
 
-       for (i = 0; i < muxer_comp->muxer_notif_iters->len; i++) {
-               struct muxer_notif_iter *muxer_notif_iter =
-                       g_ptr_array_index(muxer_comp->muxer_notif_iters, i);
+       for (i = 0; i < muxer_comp->muxer_msg_iters->len; i++) {
+               struct muxer_msg_iter *muxer_msg_iter =
+                       g_ptr_array_index(muxer_comp->muxer_msg_iters, i);
 
                /*
                 * Add this port to the list of newly connected ports
-                * for this muxer notification iterator. We append at
+                * for this muxer message iterator. We append at
                 * the end of this list while
-                * muxer_notif_iter_handle_newly_connected_ports()
+                * muxer_msg_iter_handle_newly_connected_ports()
                 * removes the nodes from the beginning.
                 */
-               muxer_notif_iter->newly_connected_self_ports =
+               muxer_msg_iter->newly_connected_self_ports =
                        g_list_append(
-                               muxer_notif_iter->newly_connected_self_ports,
+                               muxer_msg_iter->newly_connected_self_ports,
                                self_port);
-               if (!muxer_notif_iter->newly_connected_self_ports) {
-                       BT_LOGE("Cannot append port to muxer's notification iterator list of newly connected input ports: "
+               if (!muxer_msg_iter->newly_connected_self_ports) {
+                       BT_LOGE("Cannot append port to muxer's message iterator list of newly connected input ports: "
                                "port-addr=%p, port-name=\"%s\", "
-                               "muxer-notif-iter-addr=%p", self_port,
-                               bt_port_get_name(port), muxer_notif_iter);
+                               "muxer-msg-iter-addr=%p", self_port,
+                               bt_port_get_name(port), muxer_msg_iter);
                        status = BT_SELF_COMPONENT_STATUS_ERROR;
                        goto end;
                }
 
-               BT_LOGD("Appended port to muxer's notification iterator list of newly connected input ports: "
+               BT_LOGD("Appended port to muxer's message iterator list of newly connected input ports: "
                        "port-addr=%p, port-name=\"%s\", "
-                       "muxer-notif-iter-addr=%p", self_port,
-                       bt_port_get_name(port), muxer_notif_iter);
+                       "muxer-msg-iter-addr=%p", self_port,
+                       bt_port_get_name(port), muxer_msg_iter);
        }
 
        /* One less available input port */
index b2036e052c5eb8de6562b212d0638924fa238da7..c5b123f31c9eb924560ca4df4cdf5774fd24b8cf 100644 (file)
@@ -37,19 +37,19 @@ BT_HIDDEN
 void muxer_finalize(bt_self_component_filter *self_comp);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status muxer_notif_iter_init(
-               bt_self_notification_iterator *self_notif_iter,
+enum bt_self_message_iterator_status muxer_msg_iter_init(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_filter *self_comp,
                bt_self_component_port_output *self_port);
 
 BT_HIDDEN
-void muxer_notif_iter_finalize(
-               bt_self_notification_iterator *self_notif_iter);
+void muxer_msg_iter_finalize(
+               bt_self_message_iterator *self_msg_iter);
 
 BT_HIDDEN
-enum bt_self_notification_iterator_status muxer_notif_iter_next(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status muxer_msg_iter_next(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count);
 
 BT_HIDDEN
index 9c1d79dc4076249bbe7bddcfc9507d752aa7d883..bec501d9bde1cdb84dd81d2ba7bf12e93ec80e69 100644 (file)
@@ -41,7 +41,7 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(dummy, dummy_finalize);
 BT_PLUGIN_SINK_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD(dummy,
        dummy_port_connected);
 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(dummy,
-       "Consume notifications and discard them.");
+       "Consume messages and discard them.");
 
 /* sink.utils.counter */
 BT_PLUGIN_SINK_COMPONENT_CLASS(counter, counter_consume);
@@ -50,32 +50,32 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(counter, counter_finalize);
 BT_PLUGIN_SINK_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD(counter,
        counter_port_connected);
 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(counter,
-       "Count notifications and print the results.");
+       "Count messages and print the results.");
 
 #if 0
 /* flt.utils.trimmer */
 BT_PLUGIN_FILTER_COMPONENT_CLASS(trimmer, trimmer_iterator_next);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(trimmer,
-       "Keep notifications that occur within a specific time range.");
+       "Keep messages that occur within a specific time range.");
 BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(trimmer, trimmer_component_init);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD(trimmer, finalize_trimmer);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(trimmer,
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(trimmer,
        trimmer_iterator_init);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(trimmer,
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(trimmer,
        trimmer_iterator_finalize);
 #endif
 
 /* flt.utils.muxer */
-BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_notif_iter_next);
+BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_msg_iter_next);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(muxer,
-       "Sort notifications from multiple input ports to a single output port by time.");
+       "Sort messages from multiple input ports to a single output port by time.");
 BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(muxer, muxer_init);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD(muxer, muxer_finalize);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_INPUT_PORT_DISCONNECTED_METHOD(muxer,
        muxer_input_port_disconnected);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD(muxer,
        muxer_input_port_connected);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(muxer,
-       muxer_notif_iter_init);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(muxer,
-       muxer_notif_iter_finalize);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(muxer,
+       muxer_msg_iter_init);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(muxer,
+       muxer_msg_iter_finalize);
index 33583c20dd0f259e7c41640f9b59883860068362..5fab0d6ac7c919c93d827e916c7428c70ff8d0b3 100644 (file)
@@ -257,7 +257,7 @@ const bt_event *trimmer_output_event(
                goto error;
        }
 
-       /* We keep the reference on the writer_event to create a notification. */
+       /* We keep the reference on the writer_event to create a message. */
        goto end;
 
 error:
index b7e958ac937b88facf94102095a804beb37187d5..0e01511928bd824767f862c0212c86be910cfe20 100644 (file)
@@ -49,11 +49,11 @@ gboolean close_packets(gpointer key, gpointer value, gpointer user_data)
 }
 
 BT_HIDDEN
-void trimmer_iterator_finalize(bt_self_notification_iterator *it)
+void trimmer_iterator_finalize(bt_self_message_iterator *it)
 {
        struct trimmer_iterator *trim_it;
 
-       trim_it = bt_self_notification_iterator_get_user_data(it);
+       trim_it = bt_self_message_iterator_get_user_data(it);
        BT_ASSERT(trim_it);
 
        bt_object_put_ref(trim_it->input_iterator);
@@ -64,22 +64,22 @@ void trimmer_iterator_finalize(bt_self_notification_iterator *it)
 }
 
 BT_HIDDEN
-enum bt_notification_iterator_status trimmer_iterator_init(
-               bt_self_notification_iterator *iterator,
+enum bt_message_iterator_status trimmer_iterator_init(
+               bt_self_message_iterator *iterator,
                struct bt_private_port *port)
 {
-       enum bt_notification_iterator_status ret =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       enum bt_notification_iterator_status it_ret;
+       enum bt_message_iterator_status ret =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
+       enum bt_message_iterator_status it_ret;
        enum bt_connection_status conn_status;
        struct bt_private_port *input_port = NULL;
        struct bt_private_connection *connection = NULL;
        bt_self_component *component =
-               bt_self_notification_iterator_get_private_component(iterator);
+               bt_self_message_iterator_get_private_component(iterator);
        struct trimmer_iterator *it_data = g_new0(struct trimmer_iterator, 1);
 
        if (!it_data) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+               ret = BT_MESSAGE_ITERATOR_STATUS_NOMEM;
                goto end;
        }
 
@@ -90,10 +90,10 @@ enum bt_notification_iterator_status trimmer_iterator_init(
        connection = bt_private_port_get_connection(input_port);
        BT_ASSERT(connection);
 
-       conn_status = bt_private_connection_create_notification_iterator(connection,
+       conn_status = bt_private_connection_create_message_iterator(connection,
                        &it_data->input_iterator);
        if (conn_status != BT_CONNECTION_STATUS_OK) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               ret = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
@@ -101,7 +101,7 @@ enum bt_notification_iterator_status trimmer_iterator_init(
        it_data->packet_map = g_hash_table_new_full(g_direct_hash,
                        g_direct_equal, NULL, NULL);
 
-       it_ret = bt_self_notification_iterator_set_user_data(iterator,
+       it_ret = bt_self_message_iterator_set_user_data(iterator,
                it_data);
        if (it_ret) {
                goto end;
@@ -174,8 +174,8 @@ error:
 }
 
 static
-const bt_notification *evaluate_event_notification(
-               const bt_notification *notification,
+const bt_message *evaluate_event_message(
+               const bt_message *message,
                struct trimmer_iterator *trim_it,
                struct trimmer_bound *begin, struct trimmer_bound *end,
                bool *_event_in_range, bool *finished)
@@ -190,18 +190,18 @@ const bt_notification *evaluate_event_notification(
        const bt_stream_class *stream_class = NULL;
        bt_clock_value *clock_value = NULL;
        bool lazy_update = false;
-       const bt_notification *new_notification = NULL;
+       const bt_message *new_message = NULL;
        bt_clock_class_priority_map *cc_prio_map;
 
-       event = bt_notification_event_get_event(notification);
+       event = bt_message_event_get_event(message);
        BT_ASSERT(event);
-       cc_prio_map = bt_notification_event_get_clock_class_priority_map(
-                       notification);
+       cc_prio_map = bt_message_event_get_clock_class_priority_map(
+                       message);
        BT_ASSERT(cc_prio_map);
        writer_event = trimmer_output_event(trim_it, event);
        BT_ASSERT(writer_event);
-       new_notification = bt_notification_event_create(writer_event, cc_prio_map);
-       BT_ASSERT(new_notification);
+       new_message = bt_message_event_create(writer_event, cc_prio_map);
+       BT_ASSERT(new_message);
        bt_object_put_ref(cc_prio_map);
 
        stream = bt_event_get_stream(event);
@@ -254,7 +254,7 @@ const bt_notification *evaluate_event_notification(
        goto end;
 
 error:
-       BT_NOTIFICATION_PUT_REF_AND_RESET(new_notification);
+       BT_MESSAGE_PUT_REF_AND_RESET(new_message);
 end:
        bt_object_put_ref(event);
        bt_object_put_ref(writer_event);
@@ -264,7 +264,7 @@ end:
        bt_stream_class_put_ref(stream_class);
        bt_object_put_ref(clock_value);
        *_event_in_range = in_range;
-       return new_notification;
+       return new_message;
 }
 
 static
@@ -375,8 +375,8 @@ int64_t get_raw_timestamp(const bt_packet *writer_packet,
 }
 
 static
-const bt_notification *evaluate_packet_notification(
-               const bt_notification *notification,
+const bt_message *evaluate_packet_message(
+               const bt_message *message,
                struct trimmer_iterator *trim_it,
                struct trimmer_bound *begin, struct trimmer_bound *end,
                bool *_packet_in_range, bool *finished)
@@ -387,19 +387,19 @@ const bt_notification *evaluate_packet_notification(
        const bt_field *packet_context = NULL,
                        *timestamp_begin = NULL,
                        *timestamp_end = NULL;
-       const bt_notification *new_notification = NULL;
+       const bt_message *new_message = NULL;
        enum bt_component_status ret;
        bool lazy_update = false;
 
-        switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               packet = bt_notification_packet_beginning_get_packet(notification);
+        switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               packet = bt_message_packet_beginning_get_packet(message);
                BT_ASSERT(packet);
                writer_packet = trimmer_new_packet(trim_it, packet);
                BT_ASSERT(writer_packet);
                break;
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               packet = bt_notification_packet_end_get_packet(notification);
+       case BT_MESSAGE_TYPE_PACKET_END:
+               packet = bt_message_packet_end_get_packet(message);
                BT_ASSERT(packet);
                writer_packet = trimmer_close_packet(trim_it, packet);
                BT_ASSERT(writer_packet);
@@ -410,41 +410,41 @@ const bt_notification *evaluate_packet_notification(
 
        packet_context = bt_packet_get_context(writer_packet);
        if (!packet_context) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
 
        if (!bt_field_is_structure(packet_context)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
 
        timestamp_begin = bt_field_structure_get_field_by_name(
                        packet_context, "timestamp_begin");
        if (!timestamp_begin || !bt_field_is_integer(timestamp_begin)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
        timestamp_end = bt_field_structure_get_field_by_name(
                        packet_context, "timestamp_end");
        if (!timestamp_end || !bt_field_is_integer(timestamp_end)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
 
        if (ns_from_integer_field(timestamp_begin, &pkt_begin_ns)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
        if (ns_from_integer_field(timestamp_end, &pkt_end_ns)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
 
        if (update_lazy_bound(begin, "begin", pkt_begin_ns, &lazy_update)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
        if (update_lazy_bound(end, "end", pkt_end_ns, &lazy_update)) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
        if (lazy_update && begin->set && end->set) {
                if (begin->value > end->value) {
                        BT_LOGE_STR("Unexpected: time range begin value is above end value.");
-                       goto end_no_notif;
+                       goto end_no_msg;
                }
        }
 
@@ -457,7 +457,7 @@ const bt_notification *evaluate_packet_notification(
         */
        in_range = (pkt_end_ns >= begin_ns) && (pkt_begin_ns <= end_ns);
        if (!in_range) {
-               goto end_no_notif;
+               goto end_no_msg;
        }
        if (pkt_begin_ns > end_ns) {
                *finished = true;
@@ -478,101 +478,101 @@ const bt_notification *evaluate_packet_notification(
        }
 
 end:
-        switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               new_notification = bt_notification_packet_beginning_create(writer_packet);
-               BT_ASSERT(new_notification);
+        switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               new_message = bt_message_packet_beginning_create(writer_packet);
+               BT_ASSERT(new_message);
                break;
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               new_notification = bt_notification_packet_end_create(writer_packet);
-               BT_ASSERT(new_notification);
+       case BT_MESSAGE_TYPE_PACKET_END:
+               new_message = bt_message_packet_end_create(writer_packet);
+               BT_ASSERT(new_message);
                break;
        default:
                break;
        }
-end_no_notif:
+end_no_msg:
        *_packet_in_range = in_range;
        bt_packet_put_ref(packet);
        bt_packet_put_ref(writer_packet);
        bt_object_put_ref(packet_context);
        bt_object_put_ref(timestamp_begin);
        bt_object_put_ref(timestamp_end);
-       return new_notification;
+       return new_message;
 }
 
 static
-const bt_notification *evaluate_stream_notification(
-               const bt_notification *notification,
+const bt_message *evaluate_stream_message(
+               const bt_message *message,
                struct trimmer_iterator *trim_it)
 {
        const bt_stream *stream;
 
-       stream = bt_notification_stream_end_get_stream(notification);
+       stream = bt_message_stream_end_get_stream(message);
        BT_ASSERT(stream);
 
        /* FIXME: useless copy */
-       return bt_notification_stream_end_create(stream);
+       return bt_message_stream_end_create(stream);
 }
 
-/* Return true if the notification should be forwarded. */
+/* Return true if the message should be forwarded. */
 static
-enum bt_notification_iterator_status evaluate_notification(
-               const bt_notification **notification,
+enum bt_message_iterator_status evaluate_message(
+               const bt_message **message,
                struct trimmer_iterator *trim_it,
                struct trimmer_bound *begin, struct trimmer_bound *end,
                bool *in_range)
 {
-       enum bt_notification_type type;
-       const bt_notification *new_notification = NULL;
+       enum bt_message_type type;
+       const bt_message *new_message = NULL;
        bool finished = false;
 
        *in_range = true;
-       type = bt_notification_get_type(*notification);
+       type = bt_message_get_type(*message);
        switch (type) {
-       case BT_NOTIFICATION_TYPE_EVENT:
-               new_notification = evaluate_event_notification(*notification,
+       case BT_MESSAGE_TYPE_EVENT:
+               new_message = evaluate_event_message(*message,
                                trim_it, begin, end, in_range, &finished);
                break;
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               new_notification = evaluate_packet_notification(*notification,
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+       case BT_MESSAGE_TYPE_PACKET_END:
+               new_message = evaluate_packet_message(*message,
                                trim_it, begin, end, in_range, &finished);
                break;
-       case BT_NOTIFICATION_TYPE_STREAM_END:
-               new_notification = evaluate_stream_notification(*notification,
+       case BT_MESSAGE_TYPE_STREAM_END:
+               new_message = evaluate_stream_message(*message,
                                trim_it);
                break;
        default:
                break;
        }
-       BT_NOTIFICATION_PUT_REF_AND_RESET(*notification);
-       *notification = new_notification;
+       BT_MESSAGE_PUT_REF_AND_RESET(*message);
+       *message = new_message;
 
        if (finished) {
-               return BT_NOTIFICATION_ITERATOR_STATUS_END;
+               return BT_MESSAGE_ITERATOR_STATUS_END;
        }
 
-       return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       return BT_MESSAGE_ITERATOR_STATUS_OK;
 }
 
 BT_HIDDEN
-bt_notification_iterator_next_method_return trimmer_iterator_next(
-               bt_self_notification_iterator *iterator)
+bt_message_iterator_next_method_return trimmer_iterator_next(
+               bt_self_message_iterator *iterator)
 {
        struct trimmer_iterator *trim_it = NULL;
        bt_self_component *component = NULL;
        struct trimmer *trimmer = NULL;
-       bt_notification_iterator *source_it = NULL;
-       bt_notification_iterator_next_method_return ret = {
-               .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
-               .notification = NULL,
+       bt_message_iterator *source_it = NULL;
+       bt_message_iterator_next_method_return ret = {
+               .status = BT_MESSAGE_ITERATOR_STATUS_OK,
+               .message = NULL,
        };
-       bool notification_in_range = false;
+       bool message_in_range = false;
 
-       trim_it = bt_self_notification_iterator_get_user_data(iterator);
+       trim_it = bt_self_message_iterator_get_user_data(iterator);
        BT_ASSERT(trim_it);
 
-       component = bt_self_notification_iterator_get_private_component(
+       component = bt_self_message_iterator_get_private_component(
                iterator);
        BT_ASSERT(component);
        trimmer = bt_self_component_get_user_data(component);
@@ -581,27 +581,27 @@ bt_notification_iterator_next_method_return trimmer_iterator_next(
        source_it = trim_it->input_iterator;
        BT_ASSERT(source_it);
 
-       while (!notification_in_range) {
-               ret.status = bt_notification_iterator_next(source_it);
-               if (ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+       while (!message_in_range) {
+               ret.status = bt_message_iterator_next(source_it);
+               if (ret.status != BT_MESSAGE_ITERATOR_STATUS_OK) {
                        goto end;
                }
 
-               ret.notification = bt_notification_iterator_get_notification(
+               ret.message = bt_message_iterator_get_message(
                                source_it);
-               if (!ret.notification) {
-                       ret.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+               if (!ret.message) {
+                       ret.status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
                        goto end;
                }
 
-               ret.status = evaluate_notification(&ret.notification, trim_it,
+               ret.status = evaluate_message(&ret.message, trim_it,
                                &trimmer->begin, &trimmer->end,
-                               &notification_in_range);
-               if (!notification_in_range) {
-                       BT_OBJECT_PUT_REF_AND_RESET(ret.notification);
+                               &message_in_range);
+               if (!message_in_range) {
+                       BT_OBJECT_PUT_REF_AND_RESET(ret.message);
                }
 
-               if (ret.status != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+               if (ret.status != BT_MESSAGE_ITERATOR_STATUS_OK) {
                        break;
                }
        }
index e3f663dd9f752ead5dafcd5f479e023c0e16ab7e..bcfc416f15b70f040712ac48120c87c9eef65a6c 100644 (file)
 
 struct trimmer_iterator {
        /* Input iterator associated with this output iterator. */
-       bt_notification_iterator *input_iterator;
-       const bt_notification *current_notification;
+       bt_message_iterator *input_iterator;
+       const bt_message *current_message;
        FILE *err;
        /* Map between reader and writer packets. */
        GHashTable *packet_map;
 };
 
 BT_HIDDEN
-enum bt_notification_iterator_status trimmer_iterator_init(
-               bt_self_notification_iterator *iterator,
+enum bt_message_iterator_status trimmer_iterator_init(
+               bt_self_message_iterator *iterator,
                struct bt_private_port *port);
 
 BT_HIDDEN
-void trimmer_iterator_finalize(bt_self_notification_iterator *it);
+void trimmer_iterator_finalize(bt_self_message_iterator *it);
 
 BT_HIDDEN
-bt_notification_iterator_next_method_return trimmer_iterator_next(
-               bt_self_notification_iterator *iterator);
+bt_message_iterator_next_method_return trimmer_iterator_next(
+               bt_self_message_iterator *iterator);
 
 #endif /* BABELTRACE_PLUGIN_TRIMMER_ITERATOR_H */
index 39ad76e0fd9b0decb5d91119a7a73a962feada7f..a1fa87299614fc01563303b88e85873de58afe5a 100644 (file)
@@ -23,17 +23,17 @@ test_trace_ir_ref_LDADD = $(COMMON_TEST_LDADD)
 
 test_graph_topo_LDADD = $(COMMON_TEST_LDADD)
 
-test_bt_notification_iterator_LDADD = $(COMMON_TEST_LDADD)
+test_bt_message_iterator_LDADD = $(COMMON_TEST_LDADD)
 
 noinst_PROGRAMS = test_bitfield test_ctf_writer test_bt_values \
-       test_trace_ir_ref test_graph_topo test_bt_notification_iterator
+       test_trace_ir_ref test_graph_topo test_bt_message_iterator
 
 test_bitfield_SOURCES = test_bitfield.c
 test_ctf_writer_SOURCES = test_ctf_writer.c
 test_bt_values_SOURCES = test_bt_values.c
 test_trace_ir_ref_SOURCES = test_trace_ir_ref.c
 test_graph_topo_SOURCES = test_graph_topo.c
-test_bt_notification_iterator_SOURCES = test_bt_notification_iterator.c
+test_bt_message_iterator_SOURCES = test_bt_message_iterator.c
 
 check_SCRIPTS = test_ctf_writer_complete
 
index 77e6a656f932b4d94b1af17c71d10ed9b9bd2f68..b548750429c2506def5e75aefa36658b0a90b7ff 100644 (file)
@@ -24,33 +24,33 @@ static enum bt_self_component_status sink_consume(
        return BT_SELF_COMPONENT_STATUS_OK;
 }
 
-static enum bt_self_notification_iterator_status src_dummy_iterator_init_method(
-               bt_self_notification_iterator *self_notif_iter,
+static enum bt_self_message_iterator_status src_dummy_iterator_init_method(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port)
 {
-       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 }
 
-static enum bt_self_notification_iterator_status flt_dummy_iterator_init_method(
-               bt_self_notification_iterator *self_notif_iter,
+static enum bt_self_message_iterator_status flt_dummy_iterator_init_method(
+               bt_self_message_iterator *self_msg_iter,
                bt_self_component_filter *self_comp,
                bt_self_component_port_output *self_port)
 {
-       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
+       return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 }
 
 static void dummy_iterator_finalize_method(
-               bt_self_notification_iterator *self_notif_iter)
+               bt_self_message_iterator *self_msg_iter)
 {
 }
 
-static enum bt_self_notification_iterator_status dummy_iterator_next_method(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
+static enum bt_self_message_iterator_status dummy_iterator_next_method(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+       return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
 }
 
 static enum bt_query_status flt_query_method(
@@ -84,9 +84,9 @@ BT_PLUGIN_VERSION(1, 2, 3, "yes");
 
 BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_next_method);
 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source.");
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source,
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(source,
        src_dummy_iterator_init_method);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(source,
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(source,
        dummy_iterator_finalize_method);
 
 BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
@@ -100,8 +100,8 @@ BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(sink,
 
 BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_next_method);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter.");
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter,
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(filter,
        flt_dummy_iterator_init_method);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(filter,
+BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_FINALIZE_METHOD(filter,
        dummy_iterator_finalize_method);
 BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, flt_query_method);
diff --git a/tests/lib/test_bt_message_iterator.c b/tests/lib/test_bt_message_iterator.c
new file mode 100644 (file)
index 0000000..5a1ef54
--- /dev/null
@@ -0,0 +1,876 @@
+/*
+ * Copyright 2017 - Philippe Proulx <pproulx@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <string.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/assert-internal.h>
+#include <glib.h>
+
+#include "tap/tap.h"
+
+#define NR_TESTS       5
+
+enum test {
+       TEST_NO_AUTO_MSGS,
+       TEST_OUTPUT_PORT_MESSAGE_ITERATOR,
+};
+
+enum test_event_type {
+       TEST_EV_TYPE_MSG_UNEXPECTED,
+       TEST_EV_TYPE_MSG_EVENT,
+       TEST_EV_TYPE_MSG_STREAM_BEGIN,
+       TEST_EV_TYPE_MSG_PACKET_BEGIN,
+       TEST_EV_TYPE_MSG_PACKET_END,
+       TEST_EV_TYPE_MSG_STREAM_END,
+       TEST_EV_TYPE_END,
+       TEST_EV_TYPE_SENTINEL,
+};
+
+struct test_event {
+       enum test_event_type type;
+       const bt_stream *stream;
+       const bt_packet *packet;
+};
+
+static bool debug = false;
+static enum test current_test;
+static GArray *test_events;
+static bt_graph *graph;
+static bt_stream_class *src_stream_class;
+static bt_event_class *src_event_class;
+static bt_stream *src_stream1;
+static bt_stream *src_stream2;
+static bt_packet *src_stream1_packet1;
+static bt_packet *src_stream1_packet2;
+static bt_packet *src_stream2_packet1;
+static bt_packet *src_stream2_packet2;
+
+enum {
+       SEQ_END = -1,
+       SEQ_STREAM1_BEGIN = -2,
+       SEQ_STREAM2_BEGIN = -3,
+       SEQ_STREAM1_END = -4,
+       SEQ_STREAM2_END = -5,
+       SEQ_STREAM1_PACKET1_BEGIN = -6,
+       SEQ_STREAM1_PACKET2_BEGIN = -7,
+       SEQ_STREAM2_PACKET1_BEGIN = -8,
+       SEQ_STREAM2_PACKET2_BEGIN = -9,
+       SEQ_STREAM1_PACKET1_END = -10,
+       SEQ_STREAM1_PACKET2_END = -11,
+       SEQ_STREAM2_PACKET1_END = -12,
+       SEQ_STREAM2_PACKET2_END = -13,
+       SEQ_EVENT_STREAM1_PACKET1 = -14,
+       SEQ_EVENT_STREAM1_PACKET2 = -15,
+       SEQ_EVENT_STREAM2_PACKET1 = -16,
+       SEQ_EVENT_STREAM2_PACKET2 = -17,
+};
+
+struct src_iter_user_data {
+       int64_t *seq;
+       size_t at;
+};
+
+struct sink_user_data {
+       bt_self_component_port_input_message_iterator *msg_iter;
+};
+
+/*
+ * No automatic messages generated in this block.
+ * Stream 2 messages are more indented.
+ */
+static int64_t seq_no_auto_msgs[] = {
+       SEQ_STREAM1_BEGIN,
+       SEQ_STREAM1_PACKET1_BEGIN,
+       SEQ_EVENT_STREAM1_PACKET1,
+       SEQ_EVENT_STREAM1_PACKET1,
+               SEQ_STREAM2_BEGIN,
+       SEQ_EVENT_STREAM1_PACKET1,
+               SEQ_STREAM2_PACKET2_BEGIN,
+               SEQ_EVENT_STREAM2_PACKET2,
+       SEQ_EVENT_STREAM1_PACKET1,
+       SEQ_STREAM1_PACKET1_END,
+               SEQ_STREAM2_PACKET2_END,
+       SEQ_STREAM1_PACKET2_BEGIN,
+       SEQ_EVENT_STREAM1_PACKET2,
+               SEQ_STREAM2_END,
+       SEQ_STREAM1_PACKET2_END,
+       SEQ_STREAM1_END,
+       SEQ_END,
+};
+
+static
+void clear_test_events(void)
+{
+       g_array_set_size(test_events, 0);
+}
+
+static
+void print_test_event(FILE *fp, const struct test_event *event)
+{
+       fprintf(fp, "{ type = ");
+
+       switch (event->type) {
+       case TEST_EV_TYPE_MSG_UNEXPECTED:
+               fprintf(fp, "TEST_EV_TYPE_MSG_UNEXPECTED");
+               break;
+       case TEST_EV_TYPE_MSG_EVENT:
+               fprintf(fp, "TEST_EV_TYPE_MSG_EVENT");
+               break;
+       case TEST_EV_TYPE_MSG_STREAM_BEGIN:
+               fprintf(fp, "TEST_EV_TYPE_MSG_STREAM_BEGIN");
+               break;
+       case TEST_EV_TYPE_MSG_STREAM_END:
+               fprintf(fp, "TEST_EV_TYPE_MSG_STREAM_END");
+               break;
+       case TEST_EV_TYPE_MSG_PACKET_BEGIN:
+               fprintf(fp, "TEST_EV_TYPE_MSG_PACKET_BEGIN");
+               break;
+       case TEST_EV_TYPE_MSG_PACKET_END:
+               fprintf(fp, "TEST_EV_TYPE_MSG_PACKET_END");
+               break;
+       case TEST_EV_TYPE_END:
+               fprintf(fp, "TEST_EV_TYPE_END");
+               break;
+       case TEST_EV_TYPE_SENTINEL:
+               fprintf(fp, "TEST_EV_TYPE_SENTINEL");
+               break;
+       default:
+               fprintf(fp, "(UNKNOWN)");
+               break;
+       }
+
+       fprintf(fp, ", stream = %p, packet = %p }", event->stream,
+               event->packet);
+}
+
+static
+void append_test_event(struct test_event *event)
+{
+       g_array_append_val(test_events, *event);
+}
+
+static
+bool compare_single_test_events(const struct test_event *ev_a,
+               const struct test_event *ev_b)
+{
+       if (debug) {
+               fprintf(stderr, ":: Comparing test events: ");
+               print_test_event(stderr, ev_a);
+               fprintf(stderr, " vs. ");
+               print_test_event(stderr, ev_b);
+               fprintf(stderr, "\n");
+       }
+
+       if (ev_a->type != ev_b->type) {
+               return false;
+       }
+
+       switch (ev_a->type) {
+       case TEST_EV_TYPE_END:
+       case TEST_EV_TYPE_SENTINEL:
+               break;
+       default:
+               if (ev_a->stream != ev_b->stream) {
+                       return false;
+               }
+
+               if (ev_a->packet != ev_b->packet) {
+                       return false;
+               }
+               break;
+       }
+
+       return true;
+}
+
+static
+bool compare_test_events(const struct test_event *expected_events)
+{
+       const struct test_event *expected_event = expected_events;
+       size_t i = 0;
+
+       BT_ASSERT(expected_events);
+
+       while (true) {
+               const struct test_event *event;
+
+               if (expected_event->type == TEST_EV_TYPE_SENTINEL) {
+                       break;
+               }
+
+               if (i >= test_events->len) {
+                       return false;
+               }
+
+               event = &g_array_index(test_events, struct test_event, i);
+
+               if (!compare_single_test_events(event, expected_event)) {
+                       return false;
+               }
+
+               i++;
+               expected_event++;
+       }
+
+       if (i != test_events->len) {
+               return false;
+       }
+
+       return true;
+}
+
+static
+void init_static_data(void)
+{
+       bt_trace_class *trace_class;
+       bt_trace *trace;
+
+       /* Test events */
+       test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event));
+       BT_ASSERT(test_events);
+
+       /* Metadata, streams, and packets*/
+       trace_class = bt_trace_class_create();
+       BT_ASSERT(trace);
+       src_stream_class = bt_stream_class_create(trace_class);
+       BT_ASSERT(src_stream_class);
+       src_event_class = bt_event_class_create(src_stream_class);
+       BT_ASSERT(src_event_class);
+       trace = bt_trace_create(trace_class);
+       BT_ASSERT(trace);
+       src_stream1 = bt_stream_create(src_stream_class, trace);
+       BT_ASSERT(src_stream1);
+       src_stream2 = bt_stream_create(src_stream_class, trace);
+       BT_ASSERT(src_stream2);
+       src_stream1_packet1 = bt_packet_create(src_stream1);
+       BT_ASSERT(src_stream1_packet1);
+       src_stream1_packet2 = bt_packet_create(src_stream1);
+       BT_ASSERT(src_stream1_packet2);
+       src_stream2_packet1 = bt_packet_create(src_stream2);
+       BT_ASSERT(src_stream2_packet1);
+       src_stream2_packet2 = bt_packet_create(src_stream2);
+       BT_ASSERT(src_stream2_packet2);
+
+       if (debug) {
+               fprintf(stderr, ":: stream 1: %p\n", src_stream1);
+               fprintf(stderr, ":: stream 2: %p\n", src_stream2);
+               fprintf(stderr, ":: stream 1, packet 1: %p\n", src_stream1_packet1);
+               fprintf(stderr, ":: stream 1, packet 2: %p\n", src_stream1_packet2);
+               fprintf(stderr, ":: stream 2, packet 1: %p\n", src_stream2_packet1);
+               fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2);
+       }
+
+       bt_trace_put_ref(trace);
+       bt_trace_class_put_ref(trace_class);
+}
+
+static
+void fini_static_data(void)
+{
+       /* Test events */
+       g_array_free(test_events, TRUE);
+
+       /* Metadata */
+       bt_stream_class_put_ref(src_stream_class);
+       bt_event_class_put_ref(src_event_class);
+       bt_stream_put_ref(src_stream1);
+       bt_stream_put_ref(src_stream2);
+       bt_packet_put_ref(src_stream1_packet1);
+       bt_packet_put_ref(src_stream1_packet2);
+       bt_packet_put_ref(src_stream2_packet1);
+       bt_packet_put_ref(src_stream2_packet2);
+}
+
+static
+void src_iter_finalize(bt_self_message_iterator *self_msg_iter)
+{
+       struct src_iter_user_data *user_data =
+               bt_self_message_iterator_get_data(
+                       self_msg_iter);
+
+       if (user_data) {
+               g_free(user_data);
+       }
+}
+
+static
+enum bt_self_message_iterator_status src_iter_init(
+               bt_self_message_iterator *self_msg_iter,
+               bt_self_component_source *self_comp,
+               bt_self_component_port_output *self_port)
+{
+       struct src_iter_user_data *user_data =
+               g_new0(struct src_iter_user_data, 1);
+
+       BT_ASSERT(user_data);
+       bt_self_message_iterator_set_data(self_msg_iter, user_data);
+
+       switch (current_test) {
+       case TEST_NO_AUTO_MSGS:
+       case TEST_OUTPUT_PORT_MESSAGE_ITERATOR:
+               user_data->seq = seq_no_auto_msgs;
+               break;
+       default:
+               abort();
+       }
+
+       return BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+}
+
+static
+void src_iter_next_seq_one(bt_self_message_iterator* msg_iter,
+               struct src_iter_user_data *user_data,
+               const bt_message **msg)
+{
+       bt_packet *event_packet = NULL;
+
+       switch (user_data->seq[user_data->at]) {
+       case SEQ_STREAM1_BEGIN:
+               *msg = bt_message_stream_beginning_create(msg_iter,
+                                                                    src_stream1);
+               break;
+       case SEQ_STREAM2_BEGIN:
+               *msg = bt_message_stream_beginning_create(msg_iter,
+                                                            src_stream2);
+               break;
+       case SEQ_STREAM1_END:
+               *msg = bt_message_stream_end_create(msg_iter,
+                                                          src_stream1);
+               break;
+       case SEQ_STREAM2_END:
+               *msg = bt_message_stream_end_create(msg_iter,
+                                                          src_stream2);
+               break;
+       case SEQ_STREAM1_PACKET1_BEGIN:
+               *msg = bt_message_packet_beginning_create(msg_iter,
+                                                            src_stream1_packet1);
+               break;
+       case SEQ_STREAM1_PACKET2_BEGIN:
+               *msg = bt_message_packet_beginning_create(msg_iter,
+                                                            src_stream1_packet2);
+               break;
+       case SEQ_STREAM2_PACKET1_BEGIN:
+               *msg = bt_message_packet_beginning_create(msg_iter,
+                                                            src_stream2_packet1);
+               break;
+       case SEQ_STREAM2_PACKET2_BEGIN:
+               *msg = bt_message_packet_beginning_create(msg_iter,
+                                                            src_stream2_packet2);
+               break;
+       case SEQ_STREAM1_PACKET1_END:
+               *msg = bt_message_packet_end_create(msg_iter,
+                                                          src_stream1_packet1);
+               break;
+       case SEQ_STREAM1_PACKET2_END:
+               *msg = bt_message_packet_end_create(msg_iter,
+                                                          src_stream1_packet2);
+               break;
+       case SEQ_STREAM2_PACKET1_END:
+               *msg = bt_message_packet_end_create(msg_iter,
+                                                          src_stream2_packet1);
+               break;
+       case SEQ_STREAM2_PACKET2_END:
+               *msg = bt_message_packet_end_create(msg_iter,
+                                                          src_stream2_packet2);
+               break;
+       case SEQ_EVENT_STREAM1_PACKET1:
+               event_packet = src_stream1_packet1;
+               break;
+       case SEQ_EVENT_STREAM1_PACKET2:
+               event_packet = src_stream1_packet2;
+               break;
+       case SEQ_EVENT_STREAM2_PACKET1:
+               event_packet = src_stream2_packet1;
+               break;
+       case SEQ_EVENT_STREAM2_PACKET2:
+               event_packet = src_stream2_packet2;
+               break;
+       default:
+               abort();
+       }
+
+       if (event_packet) {
+               *msg = bt_message_event_create(msg_iter,
+                                                     src_event_class,
+                                                     event_packet);
+       }
+
+       BT_ASSERT(*msg);
+       user_data->at++;
+}
+
+static
+enum bt_self_message_iterator_status src_iter_next_seq(
+               bt_self_message_iterator *msg_iter,
+               struct src_iter_user_data *user_data,
+               bt_message_array_const msgs, uint64_t capacity,
+               uint64_t *count)
+{
+       enum bt_self_message_iterator_status status =
+               BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+       uint64_t i = 0;
+
+       BT_ASSERT(user_data->seq);
+
+       if (user_data->seq[user_data->at] == SEQ_END) {
+               status = BT_SELF_MESSAGE_ITERATOR_STATUS_END;
+               goto end;
+       }
+
+       while (i < capacity && user_data->seq[user_data->at] != SEQ_END) {
+               src_iter_next_seq_one(msg_iter, user_data, &msgs[i]);
+               i++;
+       }
+
+       BT_ASSERT(i > 0 && i <= capacity);
+       *count = i;
+
+end:
+       return status;
+}
+
+static
+enum bt_self_message_iterator_status src_iter_next(
+               bt_self_message_iterator *self_msg_iter,
+               bt_message_array_const msgs, uint64_t capacity,
+               uint64_t *count)
+{
+       struct src_iter_user_data *user_data =
+               bt_self_message_iterator_get_data(self_msg_iter);
+
+       BT_ASSERT(user_data);
+       return src_iter_next_seq(self_msg_iter, user_data, msgs,
+               capacity, count);
+}
+
+static
+enum bt_self_component_status src_init(
+               bt_self_component_source *self_comp,
+               const bt_value *params, void *init_method_data)
+{
+       int ret;
+
+       ret = bt_self_component_source_add_output_port(
+               self_comp, "out", NULL, NULL);
+       BT_ASSERT(ret == 0);
+       return BT_SELF_COMPONENT_STATUS_OK;
+}
+
+static
+void src_finalize(bt_self_component_source *self_comp)
+{
+}
+
+static
+void append_test_events_from_message(const bt_message *message)
+{
+       struct test_event test_event = { 0 };
+
+       switch (bt_message_get_type(message)) {
+       case BT_MESSAGE_TYPE_EVENT:
+       {
+               const bt_event *event;
+
+               test_event.type = TEST_EV_TYPE_MSG_EVENT;
+               event = bt_message_event_borrow_event_const(message);
+               BT_ASSERT(event);
+               test_event.packet = bt_event_borrow_packet_const(event);
+               BT_ASSERT(test_event.packet);
+               break;
+       }
+       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+               test_event.type = TEST_EV_TYPE_MSG_STREAM_BEGIN;
+               test_event.stream =
+                       bt_message_stream_beginning_borrow_stream_const(message);
+               BT_ASSERT(test_event.stream);
+               break;
+       case BT_MESSAGE_TYPE_STREAM_END:
+               test_event.type = TEST_EV_TYPE_MSG_STREAM_END;
+               test_event.stream =
+                       bt_message_stream_end_borrow_stream_const(message);
+               BT_ASSERT(test_event.stream);
+               break;
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               test_event.type = TEST_EV_TYPE_MSG_PACKET_BEGIN;
+               test_event.packet =
+                       bt_message_packet_beginning_borrow_packet_const(message);
+               BT_ASSERT(test_event.packet);
+               break;
+       case BT_MESSAGE_TYPE_PACKET_END:
+               test_event.type = TEST_EV_TYPE_MSG_PACKET_END;
+               test_event.packet =
+                       bt_message_packet_end_borrow_packet_const(message);
+               BT_ASSERT(test_event.packet);
+               break;
+       default:
+               test_event.type = TEST_EV_TYPE_MSG_UNEXPECTED;
+               break;
+       }
+
+       if (test_event.packet) {
+               test_event.stream = bt_packet_borrow_stream_const(
+                       test_event.packet);
+               BT_ASSERT(test_event.stream);
+       }
+
+       append_test_event(&test_event);
+}
+
+static
+enum bt_message_iterator_status common_consume(
+               void *msg_iter, bool is_output_port_msg_iter)
+{
+       enum bt_message_iterator_status ret;
+       bt_message_array_const messages = NULL;
+       uint64_t count = 0;
+       struct test_event test_event = { 0 };
+       uint64_t i;
+
+       BT_ASSERT(msg_iter);
+
+       if (is_output_port_msg_iter) {
+               ret = bt_port_output_message_iterator_next(msg_iter,
+                       &messages, &count);
+       } else {
+               ret = bt_self_component_port_input_message_iterator_next(
+                       msg_iter, &messages, &count);
+       }
+
+       if (ret < 0) {
+               goto end;
+       }
+
+       switch (ret) {
+       case BT_MESSAGE_ITERATOR_STATUS_END:
+               test_event.type = TEST_EV_TYPE_END;
+               append_test_event(&test_event);
+               goto end;
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+               abort();
+       default:
+               break;
+       }
+
+       BT_ASSERT(messages);
+       BT_ASSERT(count > 0);
+
+       for (i = 0; i < count; i++) {
+               append_test_events_from_message(messages[i]);
+               bt_message_put_ref(messages[i]);
+       }
+
+end:
+       return ret;
+}
+
+static
+enum bt_self_component_status sink_consume(
+               bt_self_component_sink *self_comp)
+{
+       enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+       struct sink_user_data *user_data =
+               bt_self_component_get_data(
+                       bt_self_component_sink_as_self_component(
+                               self_comp));
+       enum bt_message_iterator_status it_ret;
+
+       BT_ASSERT(user_data && user_data->msg_iter);
+       it_ret = common_consume(user_data->msg_iter, false);
+
+       if (it_ret < 0) {
+               ret = BT_SELF_COMPONENT_STATUS_ERROR;
+               goto end;
+       }
+
+       switch (it_ret) {
+       case BT_MESSAGE_ITERATOR_STATUS_END:
+               ret = BT_SELF_COMPONENT_STATUS_END;
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->msg_iter);
+               goto end;
+       case BT_MESSAGE_ITERATOR_STATUS_AGAIN:
+               abort();
+       default:
+               break;
+       }
+
+end:
+       return ret;
+}
+
+static
+enum bt_self_component_status sink_port_connected(
+               bt_self_component_sink *self_comp,
+               bt_self_component_port_input *self_port,
+               const bt_port_output *other_port)
+{
+       struct sink_user_data *user_data =
+               bt_self_component_get_data(
+                       bt_self_component_sink_as_self_component(
+                               self_comp));
+
+       BT_ASSERT(user_data);
+       user_data->msg_iter =
+               bt_self_component_port_input_message_iterator_create(
+                       self_port);
+       return BT_SELF_COMPONENT_STATUS_OK;
+}
+
+static
+enum bt_self_component_status sink_init(
+               bt_self_component_sink *self_comp,
+               const bt_value *params, void *init_method_data)
+{
+       struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
+       int ret;
+
+       BT_ASSERT(user_data);
+       bt_self_component_set_data(
+               bt_self_component_sink_as_self_component(self_comp),
+               user_data);
+       ret = bt_self_component_sink_add_input_port(
+               self_comp, "in", NULL, NULL);
+       BT_ASSERT(ret == 0);
+       return BT_SELF_COMPONENT_STATUS_OK;
+}
+
+static
+void sink_finalize(bt_self_component_sink *self_comp)
+{
+       struct sink_user_data *user_data =
+               bt_self_component_get_data(
+                       bt_self_component_sink_as_self_component(
+                               self_comp));
+
+       if (user_data) {
+               BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->msg_iter);
+               g_free(user_data);
+       }
+}
+
+static
+void create_source_sink(bt_graph *graph,
+               const bt_component_source **source,
+               const bt_component_sink **sink)
+{
+       bt_component_class_source *src_comp_class;
+       bt_component_class_sink *sink_comp_class;
+       int ret;
+
+       /* Create source component */
+       if (source) {
+               src_comp_class = bt_component_class_source_create("src",
+                       src_iter_next);
+               BT_ASSERT(src_comp_class);
+               ret = bt_component_class_source_set_init_method(
+                       src_comp_class, src_init);
+               BT_ASSERT(ret == 0);
+               ret = bt_component_class_source_set_finalize_method(
+                       src_comp_class, src_finalize);
+               BT_ASSERT(ret == 0);
+               ret = bt_component_class_source_set_message_iterator_init_method(
+                       src_comp_class, src_iter_init);
+               BT_ASSERT(ret == 0);
+               ret = bt_component_class_source_set_message_iterator_finalize_method(
+                       src_comp_class, src_iter_finalize);
+               BT_ASSERT(ret == 0);
+               ret = bt_graph_add_source_component(graph,
+                       src_comp_class, "source", NULL, source);
+               BT_ASSERT(ret == 0);
+               bt_component_class_source_put_ref(src_comp_class);
+       }
+
+       /* Create sink component */
+       if (sink) {
+               sink_comp_class = bt_component_class_sink_create("sink",
+                       sink_consume);
+               BT_ASSERT(sink_comp_class);
+               ret = bt_component_class_sink_set_init_method(
+                       sink_comp_class, sink_init);
+               BT_ASSERT(ret == 0);
+               ret = bt_component_class_sink_set_finalize_method(
+                       sink_comp_class, sink_finalize);
+               ret = bt_component_class_sink_set_input_port_connected_method(
+                       sink_comp_class, sink_port_connected);
+               BT_ASSERT(ret == 0);
+               ret = bt_graph_add_sink_component(graph,
+                       sink_comp_class,
+                       "sink", NULL, sink);
+               BT_ASSERT(ret == 0);
+               bt_component_class_sink_put_ref(sink_comp_class);
+       }
+}
+
+static
+void do_std_test(enum test test, const char *name,
+               const struct test_event *expected_test_events)
+{
+       const bt_component_source *src_comp;
+       const bt_component_sink *sink_comp;
+       const bt_port_output *upstream_port;
+       const bt_port_input *downstream_port;
+       enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
+
+       clear_test_events();
+       current_test = test;
+       diag("test: %s", name);
+       BT_ASSERT(!graph);
+       graph = bt_graph_create();
+       BT_ASSERT(graph);
+       create_source_sink(graph, &src_comp, &sink_comp);
+
+       /* Connect source to sink */
+       upstream_port =
+               bt_component_source_borrow_output_port_by_name_const(
+                       src_comp, "out");
+       BT_ASSERT(upstream_port);
+       downstream_port = bt_component_sink_borrow_input_port_by_name_const(
+               sink_comp, "in");
+       BT_ASSERT(downstream_port);
+       graph_status = bt_graph_connect_ports(graph, upstream_port,
+               downstream_port, NULL);
+
+       /* Run the graph until the end */
+       while (graph_status == BT_GRAPH_STATUS_OK ||
+                       graph_status == BT_GRAPH_STATUS_AGAIN) {
+               graph_status = bt_graph_run(graph);
+       }
+
+       ok(graph_status == BT_GRAPH_STATUS_END,
+               "graph finishes without any error");
+
+       /* Compare the resulting test events */
+       if (expected_test_events) {
+               ok(compare_test_events(expected_test_events),
+                       "the produced sequence of test events is the expected one");
+       }
+
+       bt_component_source_put_ref(src_comp);
+       bt_component_sink_put_ref(sink_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
+}
+
+static
+void test_no_auto_msgs(void)
+{
+       const struct test_event expected_test_events[] = {
+               { .type = TEST_EV_TYPE_MSG_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_END, .stream = src_stream2, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_END, .stream = src_stream1, .packet = NULL, },
+               { .type = TEST_EV_TYPE_END, },
+               { .type = TEST_EV_TYPE_SENTINEL, },
+       };
+
+       do_std_test(TEST_NO_AUTO_MSGS, "no automatic messages",
+               expected_test_events);
+}
+
+static
+void test_output_port_message_iterator(void)
+{
+       const struct test_event expected_test_events[] = {
+               { .type = TEST_EV_TYPE_MSG_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_END, .stream = src_stream2, .packet = NULL, },
+               { .type = TEST_EV_TYPE_MSG_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, },
+               { .type = TEST_EV_TYPE_MSG_STREAM_END, .stream = src_stream1, .packet = NULL, },
+               { .type = TEST_EV_TYPE_END, },
+               { .type = TEST_EV_TYPE_SENTINEL, },
+       };
+       const bt_component_source *src_comp;
+       bt_port_output_message_iterator *msg_iter;
+       enum bt_message_iterator_status iter_status =
+               BT_MESSAGE_ITERATOR_STATUS_OK;
+       const bt_port_output *upstream_port;
+
+       clear_test_events();
+       current_test = TEST_OUTPUT_PORT_MESSAGE_ITERATOR;
+       diag("test: output port message iterator");
+       BT_ASSERT(!graph);
+       graph = bt_graph_create();
+       BT_ASSERT(graph);
+       create_source_sink(graph, &src_comp, NULL);
+
+       /* Create message iterator on source's output port */
+       upstream_port = bt_component_source_borrow_output_port_by_name_const(src_comp,
+                                                                            "out");
+       msg_iter = bt_port_output_message_iterator_create(graph,
+               upstream_port);
+       ok(msg_iter, "bt_private_output_port_message_iterator_create() succeeds");
+
+       /* Consume the message iterator */
+       while (iter_status == BT_MESSAGE_ITERATOR_STATUS_OK) {
+               iter_status = common_consume(msg_iter, true);
+       }
+
+       ok(iter_status == BT_MESSAGE_ITERATOR_STATUS_END,
+               "output port message iterator finishes without any error");
+
+       /* Compare the resulting test events */
+       ok(compare_test_events(expected_test_events),
+               "the produced sequence of test events is the expected one");
+
+       bt_component_source_put_ref(src_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
+       bt_port_output_message_iterator_put_ref(msg_iter);
+}
+
+#define DEBUG_ENV_VAR  "TEST_BT_MESSAGE_ITERATOR_DEBUG"
+
+int main(int argc, char **argv)
+{
+       if (getenv(DEBUG_ENV_VAR) && strcmp(getenv(DEBUG_ENV_VAR), "1") == 0) {
+               debug = true;
+       }
+
+       plan_tests(NR_TESTS);
+       init_static_data();
+       test_no_auto_msgs();
+       test_output_port_message_iterator();
+       fini_static_data();
+       return exit_status();
+}
diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c
deleted file mode 100644 (file)
index 387eaa8..0000000
+++ /dev/null
@@ -1,876 +0,0 @@
-/*
- * Copyright 2017 - Philippe Proulx <pproulx@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <inttypes.h>
-#include <string.h>
-#include <babeltrace/babeltrace.h>
-#include <babeltrace/assert-internal.h>
-#include <glib.h>
-
-#include "tap/tap.h"
-
-#define NR_TESTS       5
-
-enum test {
-       TEST_NO_AUTO_NOTIFS,
-       TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR,
-};
-
-enum test_event_type {
-       TEST_EV_TYPE_NOTIF_UNEXPECTED,
-       TEST_EV_TYPE_NOTIF_EVENT,
-       TEST_EV_TYPE_NOTIF_STREAM_BEGIN,
-       TEST_EV_TYPE_NOTIF_PACKET_BEGIN,
-       TEST_EV_TYPE_NOTIF_PACKET_END,
-       TEST_EV_TYPE_NOTIF_STREAM_END,
-       TEST_EV_TYPE_END,
-       TEST_EV_TYPE_SENTINEL,
-};
-
-struct test_event {
-       enum test_event_type type;
-       const bt_stream *stream;
-       const bt_packet *packet;
-};
-
-static bool debug = false;
-static enum test current_test;
-static GArray *test_events;
-static bt_graph *graph;
-static bt_stream_class *src_stream_class;
-static bt_event_class *src_event_class;
-static bt_stream *src_stream1;
-static bt_stream *src_stream2;
-static bt_packet *src_stream1_packet1;
-static bt_packet *src_stream1_packet2;
-static bt_packet *src_stream2_packet1;
-static bt_packet *src_stream2_packet2;
-
-enum {
-       SEQ_END = -1,
-       SEQ_STREAM1_BEGIN = -2,
-       SEQ_STREAM2_BEGIN = -3,
-       SEQ_STREAM1_END = -4,
-       SEQ_STREAM2_END = -5,
-       SEQ_STREAM1_PACKET1_BEGIN = -6,
-       SEQ_STREAM1_PACKET2_BEGIN = -7,
-       SEQ_STREAM2_PACKET1_BEGIN = -8,
-       SEQ_STREAM2_PACKET2_BEGIN = -9,
-       SEQ_STREAM1_PACKET1_END = -10,
-       SEQ_STREAM1_PACKET2_END = -11,
-       SEQ_STREAM2_PACKET1_END = -12,
-       SEQ_STREAM2_PACKET2_END = -13,
-       SEQ_EVENT_STREAM1_PACKET1 = -14,
-       SEQ_EVENT_STREAM1_PACKET2 = -15,
-       SEQ_EVENT_STREAM2_PACKET1 = -16,
-       SEQ_EVENT_STREAM2_PACKET2 = -17,
-};
-
-struct src_iter_user_data {
-       int64_t *seq;
-       size_t at;
-};
-
-struct sink_user_data {
-       bt_self_component_port_input_notification_iterator *notif_iter;
-};
-
-/*
- * No automatic notifications generated in this block.
- * Stream 2 notifications are more indented.
- */
-static int64_t seq_no_auto_notifs[] = {
-       SEQ_STREAM1_BEGIN,
-       SEQ_STREAM1_PACKET1_BEGIN,
-       SEQ_EVENT_STREAM1_PACKET1,
-       SEQ_EVENT_STREAM1_PACKET1,
-               SEQ_STREAM2_BEGIN,
-       SEQ_EVENT_STREAM1_PACKET1,
-               SEQ_STREAM2_PACKET2_BEGIN,
-               SEQ_EVENT_STREAM2_PACKET2,
-       SEQ_EVENT_STREAM1_PACKET1,
-       SEQ_STREAM1_PACKET1_END,
-               SEQ_STREAM2_PACKET2_END,
-       SEQ_STREAM1_PACKET2_BEGIN,
-       SEQ_EVENT_STREAM1_PACKET2,
-               SEQ_STREAM2_END,
-       SEQ_STREAM1_PACKET2_END,
-       SEQ_STREAM1_END,
-       SEQ_END,
-};
-
-static
-void clear_test_events(void)
-{
-       g_array_set_size(test_events, 0);
-}
-
-static
-void print_test_event(FILE *fp, const struct test_event *event)
-{
-       fprintf(fp, "{ type = ");
-
-       switch (event->type) {
-       case TEST_EV_TYPE_NOTIF_UNEXPECTED:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_UNEXPECTED");
-               break;
-       case TEST_EV_TYPE_NOTIF_EVENT:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_EVENT");
-               break;
-       case TEST_EV_TYPE_NOTIF_STREAM_BEGIN:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_BEGIN");
-               break;
-       case TEST_EV_TYPE_NOTIF_STREAM_END:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_STREAM_END");
-               break;
-       case TEST_EV_TYPE_NOTIF_PACKET_BEGIN:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_PACKET_BEGIN");
-               break;
-       case TEST_EV_TYPE_NOTIF_PACKET_END:
-               fprintf(fp, "TEST_EV_TYPE_NOTIF_PACKET_END");
-               break;
-       case TEST_EV_TYPE_END:
-               fprintf(fp, "TEST_EV_TYPE_END");
-               break;
-       case TEST_EV_TYPE_SENTINEL:
-               fprintf(fp, "TEST_EV_TYPE_SENTINEL");
-               break;
-       default:
-               fprintf(fp, "(UNKNOWN)");
-               break;
-       }
-
-       fprintf(fp, ", stream = %p, packet = %p }", event->stream,
-               event->packet);
-}
-
-static
-void append_test_event(struct test_event *event)
-{
-       g_array_append_val(test_events, *event);
-}
-
-static
-bool compare_single_test_events(const struct test_event *ev_a,
-               const struct test_event *ev_b)
-{
-       if (debug) {
-               fprintf(stderr, ":: Comparing test events: ");
-               print_test_event(stderr, ev_a);
-               fprintf(stderr, " vs. ");
-               print_test_event(stderr, ev_b);
-               fprintf(stderr, "\n");
-       }
-
-       if (ev_a->type != ev_b->type) {
-               return false;
-       }
-
-       switch (ev_a->type) {
-       case TEST_EV_TYPE_END:
-       case TEST_EV_TYPE_SENTINEL:
-               break;
-       default:
-               if (ev_a->stream != ev_b->stream) {
-                       return false;
-               }
-
-               if (ev_a->packet != ev_b->packet) {
-                       return false;
-               }
-               break;
-       }
-
-       return true;
-}
-
-static
-bool compare_test_events(const struct test_event *expected_events)
-{
-       const struct test_event *expected_event = expected_events;
-       size_t i = 0;
-
-       BT_ASSERT(expected_events);
-
-       while (true) {
-               const struct test_event *event;
-
-               if (expected_event->type == TEST_EV_TYPE_SENTINEL) {
-                       break;
-               }
-
-               if (i >= test_events->len) {
-                       return false;
-               }
-
-               event = &g_array_index(test_events, struct test_event, i);
-
-               if (!compare_single_test_events(event, expected_event)) {
-                       return false;
-               }
-
-               i++;
-               expected_event++;
-       }
-
-       if (i != test_events->len) {
-               return false;
-       }
-
-       return true;
-}
-
-static
-void init_static_data(void)
-{
-       bt_trace_class *trace_class;
-       bt_trace *trace;
-
-       /* Test events */
-       test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event));
-       BT_ASSERT(test_events);
-
-       /* Metadata, streams, and packets*/
-       trace_class = bt_trace_class_create();
-       BT_ASSERT(trace);
-       src_stream_class = bt_stream_class_create(trace_class);
-       BT_ASSERT(src_stream_class);
-       src_event_class = bt_event_class_create(src_stream_class);
-       BT_ASSERT(src_event_class);
-       trace = bt_trace_create(trace_class);
-       BT_ASSERT(trace);
-       src_stream1 = bt_stream_create(src_stream_class, trace);
-       BT_ASSERT(src_stream1);
-       src_stream2 = bt_stream_create(src_stream_class, trace);
-       BT_ASSERT(src_stream2);
-       src_stream1_packet1 = bt_packet_create(src_stream1);
-       BT_ASSERT(src_stream1_packet1);
-       src_stream1_packet2 = bt_packet_create(src_stream1);
-       BT_ASSERT(src_stream1_packet2);
-       src_stream2_packet1 = bt_packet_create(src_stream2);
-       BT_ASSERT(src_stream2_packet1);
-       src_stream2_packet2 = bt_packet_create(src_stream2);
-       BT_ASSERT(src_stream2_packet2);
-
-       if (debug) {
-               fprintf(stderr, ":: stream 1: %p\n", src_stream1);
-               fprintf(stderr, ":: stream 2: %p\n", src_stream2);
-               fprintf(stderr, ":: stream 1, packet 1: %p\n", src_stream1_packet1);
-               fprintf(stderr, ":: stream 1, packet 2: %p\n", src_stream1_packet2);
-               fprintf(stderr, ":: stream 2, packet 1: %p\n", src_stream2_packet1);
-               fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2);
-       }
-
-       bt_trace_put_ref(trace);
-       bt_trace_class_put_ref(trace_class);
-}
-
-static
-void fini_static_data(void)
-{
-       /* Test events */
-       g_array_free(test_events, TRUE);
-
-       /* Metadata */
-       bt_stream_class_put_ref(src_stream_class);
-       bt_event_class_put_ref(src_event_class);
-       bt_stream_put_ref(src_stream1);
-       bt_stream_put_ref(src_stream2);
-       bt_packet_put_ref(src_stream1_packet1);
-       bt_packet_put_ref(src_stream1_packet2);
-       bt_packet_put_ref(src_stream2_packet1);
-       bt_packet_put_ref(src_stream2_packet2);
-}
-
-static
-void src_iter_finalize(bt_self_notification_iterator *self_notif_iter)
-{
-       struct src_iter_user_data *user_data =
-               bt_self_notification_iterator_get_data(
-                       self_notif_iter);
-
-       if (user_data) {
-               g_free(user_data);
-       }
-}
-
-static
-enum bt_self_notification_iterator_status src_iter_init(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_self_component_source *self_comp,
-               bt_self_component_port_output *self_port)
-{
-       struct src_iter_user_data *user_data =
-               g_new0(struct src_iter_user_data, 1);
-
-       BT_ASSERT(user_data);
-       bt_self_notification_iterator_set_data(self_notif_iter, user_data);
-
-       switch (current_test) {
-       case TEST_NO_AUTO_NOTIFS:
-       case TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR:
-               user_data->seq = seq_no_auto_notifs;
-               break;
-       default:
-               abort();
-       }
-
-       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
-}
-
-static
-void src_iter_next_seq_one(bt_self_notification_iterator* notif_iter,
-               struct src_iter_user_data *user_data,
-               const bt_notification **notif)
-{
-       bt_packet *event_packet = NULL;
-
-       switch (user_data->seq[user_data->at]) {
-       case SEQ_STREAM1_BEGIN:
-               *notif = bt_notification_stream_beginning_create(notif_iter,
-                                                                    src_stream1);
-               break;
-       case SEQ_STREAM2_BEGIN:
-               *notif = bt_notification_stream_beginning_create(notif_iter,
-                                                            src_stream2);
-               break;
-       case SEQ_STREAM1_END:
-               *notif = bt_notification_stream_end_create(notif_iter,
-                                                          src_stream1);
-               break;
-       case SEQ_STREAM2_END:
-               *notif = bt_notification_stream_end_create(notif_iter,
-                                                          src_stream2);
-               break;
-       case SEQ_STREAM1_PACKET1_BEGIN:
-               *notif = bt_notification_packet_beginning_create(notif_iter,
-                                                            src_stream1_packet1);
-               break;
-       case SEQ_STREAM1_PACKET2_BEGIN:
-               *notif = bt_notification_packet_beginning_create(notif_iter,
-                                                            src_stream1_packet2);
-               break;
-       case SEQ_STREAM2_PACKET1_BEGIN:
-               *notif = bt_notification_packet_beginning_create(notif_iter,
-                                                            src_stream2_packet1);
-               break;
-       case SEQ_STREAM2_PACKET2_BEGIN:
-               *notif = bt_notification_packet_beginning_create(notif_iter,
-                                                            src_stream2_packet2);
-               break;
-       case SEQ_STREAM1_PACKET1_END:
-               *notif = bt_notification_packet_end_create(notif_iter,
-                                                          src_stream1_packet1);
-               break;
-       case SEQ_STREAM1_PACKET2_END:
-               *notif = bt_notification_packet_end_create(notif_iter,
-                                                          src_stream1_packet2);
-               break;
-       case SEQ_STREAM2_PACKET1_END:
-               *notif = bt_notification_packet_end_create(notif_iter,
-                                                          src_stream2_packet1);
-               break;
-       case SEQ_STREAM2_PACKET2_END:
-               *notif = bt_notification_packet_end_create(notif_iter,
-                                                          src_stream2_packet2);
-               break;
-       case SEQ_EVENT_STREAM1_PACKET1:
-               event_packet = src_stream1_packet1;
-               break;
-       case SEQ_EVENT_STREAM1_PACKET2:
-               event_packet = src_stream1_packet2;
-               break;
-       case SEQ_EVENT_STREAM2_PACKET1:
-               event_packet = src_stream2_packet1;
-               break;
-       case SEQ_EVENT_STREAM2_PACKET2:
-               event_packet = src_stream2_packet2;
-               break;
-       default:
-               abort();
-       }
-
-       if (event_packet) {
-               *notif = bt_notification_event_create(notif_iter,
-                                                     src_event_class,
-                                                     event_packet);
-       }
-
-       BT_ASSERT(*notif);
-       user_data->at++;
-}
-
-static
-enum bt_self_notification_iterator_status src_iter_next_seq(
-               bt_self_notification_iterator *notif_iter,
-               struct src_iter_user_data *user_data,
-               bt_notification_array_const notifs, uint64_t capacity,
-               uint64_t *count)
-{
-       enum bt_self_notification_iterator_status status =
-               BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK;
-       uint64_t i = 0;
-
-       BT_ASSERT(user_data->seq);
-
-       if (user_data->seq[user_data->at] == SEQ_END) {
-               status = BT_SELF_NOTIFICATION_ITERATOR_STATUS_END;
-               goto end;
-       }
-
-       while (i < capacity && user_data->seq[user_data->at] != SEQ_END) {
-               src_iter_next_seq_one(notif_iter, user_data, &notifs[i]);
-               i++;
-       }
-
-       BT_ASSERT(i > 0 && i <= capacity);
-       *count = i;
-
-end:
-       return status;
-}
-
-static
-enum bt_self_notification_iterator_status src_iter_next(
-               bt_self_notification_iterator *self_notif_iter,
-               bt_notification_array_const notifs, uint64_t capacity,
-               uint64_t *count)
-{
-       struct src_iter_user_data *user_data =
-               bt_self_notification_iterator_get_data(self_notif_iter);
-
-       BT_ASSERT(user_data);
-       return src_iter_next_seq(self_notif_iter, user_data, notifs,
-               capacity, count);
-}
-
-static
-enum bt_self_component_status src_init(
-               bt_self_component_source *self_comp,
-               const bt_value *params, void *init_method_data)
-{
-       int ret;
-
-       ret = bt_self_component_source_add_output_port(
-               self_comp, "out", NULL, NULL);
-       BT_ASSERT(ret == 0);
-       return BT_SELF_COMPONENT_STATUS_OK;
-}
-
-static
-void src_finalize(bt_self_component_source *self_comp)
-{
-}
-
-static
-void append_test_events_from_notification(const bt_notification *notification)
-{
-       struct test_event test_event = { 0 };
-
-       switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_EVENT:
-       {
-               const bt_event *event;
-
-               test_event.type = TEST_EV_TYPE_NOTIF_EVENT;
-               event = bt_notification_event_borrow_event_const(notification);
-               BT_ASSERT(event);
-               test_event.packet = bt_event_borrow_packet_const(event);
-               BT_ASSERT(test_event.packet);
-               break;
-       }
-       case BT_NOTIFICATION_TYPE_STREAM_BEGINNING:
-               test_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN;
-               test_event.stream =
-                       bt_notification_stream_beginning_borrow_stream_const(notification);
-               BT_ASSERT(test_event.stream);
-               break;
-       case BT_NOTIFICATION_TYPE_STREAM_END:
-               test_event.type = TEST_EV_TYPE_NOTIF_STREAM_END;
-               test_event.stream =
-                       bt_notification_stream_end_borrow_stream_const(notification);
-               BT_ASSERT(test_event.stream);
-               break;
-       case BT_NOTIFICATION_TYPE_PACKET_BEGINNING:
-               test_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN;
-               test_event.packet =
-                       bt_notification_packet_beginning_borrow_packet_const(notification);
-               BT_ASSERT(test_event.packet);
-               break;
-       case BT_NOTIFICATION_TYPE_PACKET_END:
-               test_event.type = TEST_EV_TYPE_NOTIF_PACKET_END;
-               test_event.packet =
-                       bt_notification_packet_end_borrow_packet_const(notification);
-               BT_ASSERT(test_event.packet);
-               break;
-       default:
-               test_event.type = TEST_EV_TYPE_NOTIF_UNEXPECTED;
-               break;
-       }
-
-       if (test_event.packet) {
-               test_event.stream = bt_packet_borrow_stream_const(
-                       test_event.packet);
-               BT_ASSERT(test_event.stream);
-       }
-
-       append_test_event(&test_event);
-}
-
-static
-enum bt_notification_iterator_status common_consume(
-               void *notif_iter, bool is_output_port_notif_iter)
-{
-       enum bt_notification_iterator_status ret;
-       bt_notification_array_const notifications = NULL;
-       uint64_t count = 0;
-       struct test_event test_event = { 0 };
-       uint64_t i;
-
-       BT_ASSERT(notif_iter);
-
-       if (is_output_port_notif_iter) {
-               ret = bt_port_output_notification_iterator_next(notif_iter,
-                       &notifications, &count);
-       } else {
-               ret = bt_self_component_port_input_notification_iterator_next(
-                       notif_iter, &notifications, &count);
-       }
-
-       if (ret < 0) {
-               goto end;
-       }
-
-       switch (ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
-               test_event.type = TEST_EV_TYPE_END;
-               append_test_event(&test_event);
-               goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
-               abort();
-       default:
-               break;
-       }
-
-       BT_ASSERT(notifications);
-       BT_ASSERT(count > 0);
-
-       for (i = 0; i < count; i++) {
-               append_test_events_from_notification(notifications[i]);
-               bt_notification_put_ref(notifications[i]);
-       }
-
-end:
-       return ret;
-}
-
-static
-enum bt_self_component_status sink_consume(
-               bt_self_component_sink *self_comp)
-{
-       enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
-       struct sink_user_data *user_data =
-               bt_self_component_get_data(
-                       bt_self_component_sink_as_self_component(
-                               self_comp));
-       enum bt_notification_iterator_status it_ret;
-
-       BT_ASSERT(user_data && user_data->notif_iter);
-       it_ret = common_consume(user_data->notif_iter, false);
-
-       if (it_ret < 0) {
-               ret = BT_SELF_COMPONENT_STATUS_ERROR;
-               goto end;
-       }
-
-       switch (it_ret) {
-       case BT_NOTIFICATION_ITERATOR_STATUS_END:
-               ret = BT_SELF_COMPONENT_STATUS_END;
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
-                       user_data->notif_iter);
-               goto end;
-       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
-               abort();
-       default:
-               break;
-       }
-
-end:
-       return ret;
-}
-
-static
-enum bt_self_component_status sink_port_connected(
-               bt_self_component_sink *self_comp,
-               bt_self_component_port_input *self_port,
-               const bt_port_output *other_port)
-{
-       struct sink_user_data *user_data =
-               bt_self_component_get_data(
-                       bt_self_component_sink_as_self_component(
-                               self_comp));
-
-       BT_ASSERT(user_data);
-       user_data->notif_iter =
-               bt_self_component_port_input_notification_iterator_create(
-                       self_port);
-       return BT_SELF_COMPONENT_STATUS_OK;
-}
-
-static
-enum bt_self_component_status sink_init(
-               bt_self_component_sink *self_comp,
-               const bt_value *params, void *init_method_data)
-{
-       struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
-       int ret;
-
-       BT_ASSERT(user_data);
-       bt_self_component_set_data(
-               bt_self_component_sink_as_self_component(self_comp),
-               user_data);
-       ret = bt_self_component_sink_add_input_port(
-               self_comp, "in", NULL, NULL);
-       BT_ASSERT(ret == 0);
-       return BT_SELF_COMPONENT_STATUS_OK;
-}
-
-static
-void sink_finalize(bt_self_component_sink *self_comp)
-{
-       struct sink_user_data *user_data =
-               bt_self_component_get_data(
-                       bt_self_component_sink_as_self_component(
-                               self_comp));
-
-       if (user_data) {
-               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
-                       user_data->notif_iter);
-               g_free(user_data);
-       }
-}
-
-static
-void create_source_sink(bt_graph *graph,
-               const bt_component_source **source,
-               const bt_component_sink **sink)
-{
-       bt_component_class_source *src_comp_class;
-       bt_component_class_sink *sink_comp_class;
-       int ret;
-
-       /* Create source component */
-       if (source) {
-               src_comp_class = bt_component_class_source_create("src",
-                       src_iter_next);
-               BT_ASSERT(src_comp_class);
-               ret = bt_component_class_source_set_init_method(
-                       src_comp_class, src_init);
-               BT_ASSERT(ret == 0);
-               ret = bt_component_class_source_set_finalize_method(
-                       src_comp_class, src_finalize);
-               BT_ASSERT(ret == 0);
-               ret = bt_component_class_source_set_notification_iterator_init_method(
-                       src_comp_class, src_iter_init);
-               BT_ASSERT(ret == 0);
-               ret = bt_component_class_source_set_notification_iterator_finalize_method(
-                       src_comp_class, src_iter_finalize);
-               BT_ASSERT(ret == 0);
-               ret = bt_graph_add_source_component(graph,
-                       src_comp_class, "source", NULL, source);
-               BT_ASSERT(ret == 0);
-               bt_component_class_source_put_ref(src_comp_class);
-       }
-
-       /* Create sink component */
-       if (sink) {
-               sink_comp_class = bt_component_class_sink_create("sink",
-                       sink_consume);
-               BT_ASSERT(sink_comp_class);
-               ret = bt_component_class_sink_set_init_method(
-                       sink_comp_class, sink_init);
-               BT_ASSERT(ret == 0);
-               ret = bt_component_class_sink_set_finalize_method(
-                       sink_comp_class, sink_finalize);
-               ret = bt_component_class_sink_set_input_port_connected_method(
-                       sink_comp_class, sink_port_connected);
-               BT_ASSERT(ret == 0);
-               ret = bt_graph_add_sink_component(graph,
-                       sink_comp_class,
-                       "sink", NULL, sink);
-               BT_ASSERT(ret == 0);
-               bt_component_class_sink_put_ref(sink_comp_class);
-       }
-}
-
-static
-void do_std_test(enum test test, const char *name,
-               const struct test_event *expected_test_events)
-{
-       const bt_component_source *src_comp;
-       const bt_component_sink *sink_comp;
-       const bt_port_output *upstream_port;
-       const bt_port_input *downstream_port;
-       enum bt_graph_status graph_status = BT_GRAPH_STATUS_OK;
-
-       clear_test_events();
-       current_test = test;
-       diag("test: %s", name);
-       BT_ASSERT(!graph);
-       graph = bt_graph_create();
-       BT_ASSERT(graph);
-       create_source_sink(graph, &src_comp, &sink_comp);
-
-       /* Connect source to sink */
-       upstream_port =
-               bt_component_source_borrow_output_port_by_name_const(
-                       src_comp, "out");
-       BT_ASSERT(upstream_port);
-       downstream_port = bt_component_sink_borrow_input_port_by_name_const(
-               sink_comp, "in");
-       BT_ASSERT(downstream_port);
-       graph_status = bt_graph_connect_ports(graph, upstream_port,
-               downstream_port, NULL);
-
-       /* Run the graph until the end */
-       while (graph_status == BT_GRAPH_STATUS_OK ||
-                       graph_status == BT_GRAPH_STATUS_AGAIN) {
-               graph_status = bt_graph_run(graph);
-       }
-
-       ok(graph_status == BT_GRAPH_STATUS_END,
-               "graph finishes without any error");
-
-       /* Compare the resulting test events */
-       if (expected_test_events) {
-               ok(compare_test_events(expected_test_events),
-                       "the produced sequence of test events is the expected one");
-       }
-
-       bt_component_source_put_ref(src_comp);
-       bt_component_sink_put_ref(sink_comp);
-       BT_GRAPH_PUT_REF_AND_RESET(graph);
-}
-
-static
-void test_no_auto_notifs(void)
-{
-       const struct test_event expected_test_events[] = {
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, },
-               { .type = TEST_EV_TYPE_END, },
-               { .type = TEST_EV_TYPE_SENTINEL, },
-       };
-
-       do_std_test(TEST_NO_AUTO_NOTIFS, "no automatic notifications",
-               expected_test_events);
-}
-
-static
-void test_output_port_notification_iterator(void)
-{
-       const struct test_event expected_test_events[] = {
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, },
-               { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, },
-               { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, },
-               { .type = TEST_EV_TYPE_END, },
-               { .type = TEST_EV_TYPE_SENTINEL, },
-       };
-       const bt_component_source *src_comp;
-       bt_port_output_notification_iterator *notif_iter;
-       enum bt_notification_iterator_status iter_status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
-       const bt_port_output *upstream_port;
-
-       clear_test_events();
-       current_test = TEST_OUTPUT_PORT_NOTIFICATION_ITERATOR;
-       diag("test: output port notification iterator");
-       BT_ASSERT(!graph);
-       graph = bt_graph_create();
-       BT_ASSERT(graph);
-       create_source_sink(graph, &src_comp, NULL);
-
-       /* Create notification iterator on source's output port */
-       upstream_port = bt_component_source_borrow_output_port_by_name_const(src_comp,
-                                                                            "out");
-       notif_iter = bt_port_output_notification_iterator_create(graph,
-               upstream_port);
-       ok(notif_iter, "bt_private_output_port_notification_iterator_create() succeeds");
-
-       /* Consume the notification iterator */
-       while (iter_status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-               iter_status = common_consume(notif_iter, true);
-       }
-
-       ok(iter_status == BT_NOTIFICATION_ITERATOR_STATUS_END,
-               "output port notification iterator finishes without any error");
-
-       /* Compare the resulting test events */
-       ok(compare_test_events(expected_test_events),
-               "the produced sequence of test events is the expected one");
-
-       bt_component_source_put_ref(src_comp);
-       BT_GRAPH_PUT_REF_AND_RESET(graph);
-       bt_port_output_notification_iterator_put_ref(notif_iter);
-}
-
-#define DEBUG_ENV_VAR  "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
-
-int main(int argc, char **argv)
-{
-       if (getenv(DEBUG_ENV_VAR) && strcmp(getenv(DEBUG_ENV_VAR), "1") == 0) {
-               debug = true;
-       }
-
-       plan_tests(NR_TESTS);
-       init_static_data();
-       test_no_auto_notifs();
-       test_output_port_notification_iterator();
-       fini_static_data();
-       return exit_status();
-}
index 43c236e49d98b20607767c454720ccdbb6bda085..7cf870839efeadc7f01f511588e9281fa8dca699 100644 (file)
@@ -364,12 +364,12 @@ size_t event_pos(struct event *event)
 }
 
 static
-enum bt_self_notification_iterator_status src_iter_next(
-               bt_self_notification_iterator *self_iterator,
-               bt_notification_array_const notifs, uint64_t capacity,
+enum bt_self_message_iterator_status src_iter_next(
+               bt_self_message_iterator *self_iterator,
+               bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       return BT_SELF_NOTIFICATION_ITERATOR_STATUS_ERROR;
+       return BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
 }
 
 static
This page took 0.373324 seconds and 4 git commands to generate.