+static
+const struct bt_field_class_variant_option *
+borrow_variant_field_selected_class_option(const struct bt_field *field)
+{
+ const struct bt_field_class_named_field_class_container *container_fc;
+ const struct bt_field_variant *var_field = (const void *) field;
+
+ BT_ASSERT(field);
+ BT_ASSERT_PRE_DEV(var_field->selected_field,
+ "Variant field has no selected field: %!+f", field);
+ container_fc = (const void *) field->class;
+ return container_fc->named_fcs->pdata[var_field->selected_index];
+}
+
+const struct bt_field_class_variant_option *
+bt_field_variant_borrow_selected_class_option_const(
+ const struct bt_field *field)
+{
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field");
+ return borrow_variant_field_selected_class_option(field);
+}
+
+const struct bt_field_class_variant_with_selector_unsigned_option *
+bt_field_variant_with_unsigned_selector_borrow_selected_class_option_const(
+ const struct bt_field *field)
+{
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
+ BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR, "Field");
+ return (const void *) borrow_variant_field_selected_class_option(field);
+}
+
+const struct bt_field_class_variant_with_selector_signed_option *
+bt_field_variant_with_signed_selector_borrow_selected_class_option_const(
+ const struct bt_field *field)
+{
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
+ BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR, "Field");
+ return (const void *) borrow_variant_field_selected_class_option(field);
+}
+
+enum bt_field_variant_select_option_field_by_index_status
+bt_field_variant_select_option_field_by_index(