+ result = ns_from_origin >= iterator->last_ns_from_origin;
+ iterator->last_ns_from_origin = ns_from_origin;
+end:
+ return result;
+}
+
+BT_ASSERT_COND_DEV_FUNC
+static
+bool clock_snapshots_are_monotonic(
+ struct bt_message_iterator *iterator,
+ bt_message_array_const msgs, uint64_t msg_count)
+{
+ uint64_t i;
+ bool result;
+
+ for (i = 0; i < msg_count; i++) {
+ if (!clock_snapshots_are_monotonic_one(iterator, msgs[i])) {
+ result = false;
+ goto end;
+ }
+ }
+
+ result = true;
+
+end:
+ return result;
+}
+
+#define NEXT_METHOD_NAME "bt_message_iterator_class_next_method"
+
+#ifdef BT_DEV_MODE
+
+/*
+ * When a new stream begins, verify that the clock class tied to this
+ * stream is compatible with what we've seen before.
+ */
+
+static
+void assert_post_dev_clock_classes_are_compatible_one(
+ struct bt_message_iterator *iterator,
+ const struct bt_message *msg)
+{
+ enum bt_clock_correlation_validator_error_type type;
+ bt_uuid expected_uuid;
+ const bt_clock_class *actual_clock_cls;
+ const bt_clock_class *expected_clock_cls;
+
+ if (!bt_clock_correlation_validator_validate_message(
+ iterator->correlation_validator, msg, &type,
+ &expected_uuid, &actual_clock_cls,
+ &expected_clock_cls)) {
+ switch (type) {
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_NO_CLOCK_CLASS_GOT_ONE:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "stream-class-has-no-clock-class", false,
+ "Expecting no clock class, got one.");
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NONE:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "stream-class-has-clock-class-with-unix-epoch-origin", false,
+ "Expecting a clock class, got none.");
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_OTHER:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "clock-class-has-unix-epoch-origin", false,
+ "Expecting a clock class with Unix epoch origin: %![cc-]+K",
+ actual_clock_cls);
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NONE:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "stream-class-has-clock-class-with-uuid", false,
+ "Expecting a clock class, got none.");
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_UNIX:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "clock-class-has-non-unix-epoch-origin", false,
+ "Expecting a clock class without Unix epoch origin: %![cc-]+K",
+ actual_clock_cls);
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NO_UUID:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "clock-class-has-uuid", false,
+ "Expecting a clock class with UUID: %![cc-]+K",
+ actual_clock_cls);
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "clock-class-has-expected-uuid", false,
+ "Expecting a clock class with UUID, got one with a different UUID: %![cc-]+K, expected-uuid=%!u",
+ actual_clock_cls, expected_uuid);
+
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_NONE:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "stream-class-has-clock-class", false,
+ "Expecting a clock class, got none.");
+ case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_OTHER:
+ BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
+ "clock-class-is-expected", false,
+ "Unexpected clock class: %![expected-cc-]+K, %![actual-cc-]+K",
+ expected_clock_cls, actual_clock_cls);
+ }
+
+ bt_common_abort();
+ }
+}
+
+static
+void assert_post_dev_clock_classes_are_compatible(
+ struct bt_message_iterator *iterator,
+ bt_message_array_const msgs, uint64_t msg_count)
+{
+ uint64_t i;
+
+ for (i = 0; i < msg_count; i++) {
+ assert_post_dev_clock_classes_are_compatible_one(iterator, msgs[i]);
+ }
+}
+
+static
+const bt_stream *get_stream_from_msg(const struct bt_message *msg)
+{
+ struct bt_stream *stream;
+
+ switch (msg->type) {
+ case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+ case BT_MESSAGE_TYPE_STREAM_END: