+ 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) {
+ /*
+ * This is the first clock class that this muxer
+ * notification 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;
+ } 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,
+ 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;
+ }
+ }
+ }
+
+ if (!muxer_comp->assume_absolute_clock_classes) {
+ switch (muxer_notif_iter->clock_class_expectation) {
+ case MUXER_NOTIF_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: "
+ "clock-class-addr=%p, clock-class-name=\"%s\"",
+ clock_class, cc_name);
+ goto error;
+ }
+ break;
+ case MUXER_NOTIF_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: "
+ "clock-class-addr=%p, clock-class-name=\"%s\"",
+ clock_class, cc_name);
+ goto error;
+ }
+
+ if (cc_uuid) {
+ BT_LOGE("Expecting a non-absolute clock class with no UUID, "
+ "but got one with a UUID: "
+ "clock-class-addr=%p, clock-class-name=\"%s\", "
+ "uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"",
+ clock_class, cc_name,
+ (unsigned int) cc_uuid[0],
+ (unsigned int) cc_uuid[1],
+ (unsigned int) cc_uuid[2],
+ (unsigned int) cc_uuid[3],
+ (unsigned int) cc_uuid[4],
+ (unsigned int) cc_uuid[5],
+ (unsigned int) cc_uuid[6],
+ (unsigned int) cc_uuid[7],
+ (unsigned int) cc_uuid[8],
+ (unsigned int) cc_uuid[9],
+ (unsigned int) cc_uuid[10],
+ (unsigned int) cc_uuid[11],
+ (unsigned int) cc_uuid[12],
+ (unsigned int) cc_uuid[13],
+ (unsigned int) cc_uuid[14],
+ (unsigned int) cc_uuid[15]);
+ goto error;
+ }
+ break;
+ case MUXER_NOTIF_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: "
+ "clock-class-addr=%p, clock-class-name=\"%s\"",
+ clock_class, cc_name);
+ goto error;
+ }
+
+ if (!cc_uuid) {
+ BT_LOGE("Expecting a non-absolute clock class with a specific UUID, "
+ "but got one with no UUID: "
+ "clock-class-addr=%p, clock-class-name=\"%s\"",
+ clock_class, cc_name);
+ goto error;
+ }
+
+ if (memcmp(muxer_notif_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: "
+ "clock-class-addr=%p, clock-class-name=\"%s\", "
+ "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) cc_uuid[0],
+ (unsigned int) cc_uuid[1],
+ (unsigned int) cc_uuid[2],
+ (unsigned int) cc_uuid[3],
+ (unsigned int) cc_uuid[4],
+ (unsigned int) cc_uuid[5],
+ (unsigned int) cc_uuid[6],
+ (unsigned int) cc_uuid[7],
+ (unsigned int) cc_uuid[8],
+ (unsigned int) cc_uuid[9],
+ (unsigned int) cc_uuid[10],
+ (unsigned int) cc_uuid[11],
+ (unsigned int) cc_uuid[12],
+ (unsigned int) cc_uuid[13],
+ (unsigned int) cc_uuid[14],
+ (unsigned int) cc_uuid[15]);
+ goto error;
+ }
+ break;
+ default:
+ /* Unexpected */
+ BT_LOGF("Unexpected clock class expectation: "
+ "expectation-code=%d",
+ muxer_notif_iter->clock_class_expectation);
+ abort();
+ }