- const struct bt_clock_class *clock_class = NULL;
- bt_uuid clock_class_uuid = NULL;
-
- switch (bt_message_get_type(msg)) {
- case BT_MESSAGE_TYPE_STREAM_BEGINNING:
- {
- const struct bt_message_stream *stream_msg =
- (struct bt_message_stream *) msg;
-
- clock_class = stream_msg->stream->class->default_clock_class;
- break;
- }
- case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
- {
- const struct bt_message_message_iterator_inactivity *mii_msg =
- (struct bt_message_message_iterator_inactivity *) msg;
-
- clock_class = mii_msg->cs->clock_class;
- break;
- }
- default:
- return;
- }
-
- if (clock_class) {
- clock_class_uuid = bt_clock_class_get_uuid(clock_class);
- }
-
- switch (iterator->clock_expectation.type) {
- case CLOCK_EXPECTATION_UNSET:
- /*
- * This is the first time we see a message with a clock
- * snapshot: record the properties of that clock, against
- * which we'll compare the clock properties of the following
- * messages.
- */
+ 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);